Sponsored Content
Top Forums Shell Programming and Scripting Create a text file and a pdf file from Linux command results. Post 303042514 by jcdole on Friday 27th of December 2019 01:25:22 PM
Old 12-27-2019
Create a text file and a pdf file from Linux command results.

Hello.


The task :
Using multiple commands like :
Code:
gdisk -l $SOME_DISK >> $SOME_FILE

I generate some text file.
For readiness I must insert page break.
When the program is finished I want to convert the final text file to a pdf file.
When finished, I got two files : One text file and One pdf file.
When printing both, you cannot differentiate them.


What I have done :
I build a single groff base file by copying data :
First I initialize the base document with :
Code:
#echo ".nf" > "$BASE_FILE"
echo ".sp 1" >> "$BASE_FILE"
echo "PROGRAM : $MY_PROG" >> "$BASE_FILE"
echo ".sp 1" >> "$BASE_FILE"

Then I fill the base file with the result of :
Code:
 while true ; do
echo "$SOME_TEXT_AS_TITLE" >> "$BASE_FILE" gdisk -l $SOME_DISK >> $BASE_FILE if [[ "$FLAG_SET_PAGE_BREAK" == "true" ]] ; then
echo ".bp" >> "$BASE_FILE"
fi if [[ "$IS_FINISHED" == "true" ]] ; then
break
fi
done echo ".ex" >> "$BASE_FILE"

Then I build the pdf file like this :
Code:
ENSCRIPT="--no-header --font=$CUR_FONT  --word-wrap"
export ENSCRIPT
/usr/bin/enscript -p"$TEMP_FILE"  "$BASE_FILE" 

/usr/bin/ps2pdf  "$TEMP_FILE"  "$FILE_OUT_PDF"

Problem N°1
The page break is always at line 67.
I tried to change page length with :
Code:
.pl 29.0c

With different value but the page break arise always at the same place.
So How to change the page break.


Problem N°2
I want to use different fonts type and size.
This will certainly affect the presentation of the document.
How to fix the problem of page breaks.


Problem N°3
How to set page length by lines/per page ?


Problem N°4
With enscript you can explicitly set page format, font, .....

--lines-per-page= ?

--margins=?:?:?:?

--font=?

--media=?

This may contradict the presentation of the document generated by groff.


Problem N°5
I have look after hundreds of web page and I have not found a good tutorial to help me is that task that should be simple.


Any help is welcome.
 

10 More Discussions You Might Find Interesting

1. AIX

How convert PCL or PDF file to text in AIX

I need to conver a PCL or PDF file to text in AIX, and I don´t know how. (0 Replies)
Discussion started by: 10789
0 Replies

2. Shell Programming and Scripting

Create multiple text file from a single text file on AIX

Hi I need to create multiple text files from onc text file on AIX. The data of text files is as below: ********************************************** ********************************************** DBVERIFY: Release 10.2.0.4.0 - Production on Tue Nov 10 13:45:42 2009 Copyright (c) 1982,... (11 Replies)
Discussion started by: lodhi1978
11 Replies

3. SCO

Create a PDF file

Currently own an SCO OpenServer 6 system. Will like to know how to convert files printed to PDF so they can be sent to customers via e-mail. Ex. account statements. (4 Replies)
Discussion started by: RicardoM
4 Replies

4. HP-UX

Convert text file into pdf on HP-UX platform

I am looking for a tool to convert text file into pdf on HP-UX platform. Current version of OS - $ uname -a HP-UX XXXXXXX B.11.23 U ia64 4125393404 unlimited-user license I'm able to get "ClibPDF-2.02"; A library for creating PDF files on HP-UX 11.00, PA-RISC 1.1 Not sure if... (2 Replies)
Discussion started by: mail4usr
2 Replies

5. Shell Programming and Scripting

Print some results in a text file using script in linux

hello everyone, i really need your help to write a script which would just print following kind of result into a text file (result.txt) XYZ test Results ID: <unique-id> Date: <date> ------------------------------------------------- | Task | Result | Time |... (3 Replies)
Discussion started by: viriimind
3 Replies

6. UNIX for Dummies Questions & Answers

Text file + image/form/overlay file to PDF

Hi, We have an app specific legacy environment running SCO Openserver 5.0.7. I need to be able to (1) scan a pre-existing “form” consisting of logo/boxes/lines/static text as an image , (2) lay a print file from the app "on top of the image" and (3) output the "merge" as a PDF file. Scanning... (1 Reply)
Discussion started by: 65bit
1 Replies

7. Red Hat

create pdf of text file help

Can someone please tell me why this is not working? I have created numerous pdf's from text files by following these instructions and this time it is not working. Convert jpeg files to PDF under Linux | bitPrison.net convert /home/liveuser/Documents/hw7 /home/liveuser/Documents/hw7.pdf... (5 Replies)
Discussion started by: cokedude
5 Replies

8. Shell Programming and Scripting

Create a file from ls -l command and append additional info to results

I need to be able to take the results from ls -l command and modify the output as follows: I will run ls -l *.mak My results will be aa.mak bb.mak cc.mak I then need to take those results and create a file that has the following info: dsjj/ubin/aa dsjj/ubin/bb dsjj/ubin/cc ... (3 Replies)
Discussion started by: jclanc8
3 Replies

9. Shell Programming and Scripting

Create invoice pdf file

Hi all, I'm trying to create a script to merge a csv or txt file with a pdf template. So i have a pdf template with company logo and i want to merge it with a csv or txt file so i can create a complete invoice in pdf. now i do find some command line tools to do this but i need a pro version... (3 Replies)
Discussion started by: dicenl
3 Replies

10. Red Hat

Setting Password For PDF File--Linux

Hi, I am in need of help. My requirements are : 1) To convert the existing files (irrespective of their format) in a directory to PDF format 2) To make the converted files password protected. I did the attempt to do the same. Though the existing files (irrespective of their format) are... (1 Reply)
Discussion started by: MKR
1 Replies
Locale::Codes::LangVar(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangVar(3pm)

NAME
Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('en','alpha-2'); $lvar = code2langvar('en',LOCALE_CODE_ALPHA_2); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 Locale::Codes::LangVar(3pm)
All times are GMT -4. The time now is 07:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy