[SOLVED] Need bold or clearer font when converting text file to PDF.
SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Need bold or clearer font when converting text file to PDF.
We are running legacy software on OpenSUSE 12.1 32-bit.
Unfortunately we cannot move onto a newer operating system as the software gives floating point exception errors and will not run.
Currently the legacy software will output files in text or HP PCL formats only. However I have yet to find a way to convert PCL to PDF.
So currently the software will create a plain text file which I then run through the CUPS-PDF printer to convert it to pdf using the following script:
This works fine but the default font is very light and hard to read.
Is there any way that I can make the font more bold?
So far my investigating has revealed the following:
It is impossible to change the default font in CUPS-PDF from Courier to Courier-Bold as that will have been ideal.
There is also no way of specifying in the lp command to make the font bold. I will be quite happy to change the DEFAULT font for the lp command in the entire system from Courier to Courier-Bold but I do not know how.
I also looked into using enscript to convert the text file to postscript and make it bold and then use pstopdf to create the pdf. My problem here is that there does not seem to be a way to disable the wrap feature in enscript. (My document is in landscape).
Note that I do not mind running the file through multiple filters and processes, i.e. does not have to be elegant.
Any help or ideas that could steer me in the right direction will be highly appreciated ...
Can you put a document through the CUPS-PDF which contains the correctly sized Courier-Bold text and will that work? If so, then find a way to convert the document you have, text or otherwise, to be using the correct font before you do the CUPS-PDF conversion.
We are running legacy software on OpenSUSE 12.1 32-bit.
Unfortunately we cannot move onto a newer operating system as the software gives floating point exception errors and will not run.
Currently the legacy software will output files in text or HP PCL formats only. However I have yet to find a way to convert PCL to PDF. So currently the software will create a plain text file which I then run through the CUPS-PDF printer to convert it to pdf using the following script:
This works fine but the default font is very light and hard to read. Is there any way that I can make the font more bold? So far my investigating has revealed the following:
It is impossible to change the default font in CUPS-PDF from Courier to Courier-Bold as that will have been ideal. There is also no way of specifying in the lp command to make the font bold. I will be quite happy to change the DEFAULT font for the lp command in the entire system from Courier to Courier-Bold but I do not know how. I also looked into using enscript to convert the text file to postscript and make it bold and then use pstopdf to create the pdf. My problem here is that there does not seem to be a way to disable the wrap feature in enscript. (My document is in landscape).
Note that I do not mind running the file through multiple filters and processes, i.e. does not have to be elegant.
Any help or ideas that could steer me in the right direction will be highly appreciated ...
The enscript command has a flag to
From the enscript man page:
Code:
-c, --truncate-lines
Cut lines that are too long for the page. As a default, enscript wraps long lines to the next line so no information is lost.
You can also use the --slice option which slices long lines to separate pages.
...and you can also specify the font using the "-f or--font-name" flag in enscript. The font specification name contains two parts: the name of the font and its size in PostScript points. For example, "Times-Roman12" selects the "Times-Roman" font with size 12pt (from the man page). So try CourierBold12.
So....
...should work. Or, the ps2pdf command takes the same options as Ghostscript, which will let you specify a font.
But this:
Quote:
Originally Posted by Casey
Unfortunately we cannot move onto a newer operating system as the software gives floating point exception errors and will not run.
..is NOT good. This application needs to be updated ASAP. OpenSUSE is a short-development/release cycle system, and won't be supported for a long time, like other 'server grade' distros. Staying on old stuff isn't a good idea, ever.
If you prefer the plain text input file, one option might be to convert it to a simple markup language (like Markdown/ReStructuredText/etc) with some shell/perl code, and then convert that to PDF or LaTeX for printing using pandoc. You should be able to accomplish basic formatting like bold text this way.
Alternately you could probably just convert the text straight to something like LaTeX with a home grown filter ;-)
Thanks for all the advice.
Note that the objective is not to print it per say but rather to merge it with a pdf background that provides all the company logos and layouts.
Decided to use a2ps instead of enscript as it provides an option to designate chars-per-line and avoid the wrap/truncate problem I had with enscript.
I have come up with the following code:
{legacyreportsystem with plain text output} > example.txt
a2ps --output=$HOME/result.ps --prologue=bold --chars-per-line=165 --lines-per-page=40 --font-size=8 --no-header --landscape --columns=1 --borders=no $HOME/example.txt 2> /dev/null
ps2pdf $HOME/result.ps $HOME/result.pdf 2> /dev/null
pdftk $HOME/result.pdf background $HOME/Inv_Template.pdf output $HOME/Invoice.pdf
The font is now much more bold and easier to read and horizontally all is good with a font-size of 8. My only real problem now is line spacing as the background template is based upon 6 lines per inch.
a2ps will scrunch all the lines up at the top of the page.
I have been sifting through the massive manual available from the command line with `info a2ps` but cannot find any way to designate line spacing!
Thanks again for the help.
Linuxquestions.org is just awesome!
And here are the initialisation PCL codes that I used in my legacy system:
ESC,E, {Initialise}
ESC,&,l,3,O {Reverse Landscape}
ESC,&,a,0,L {Set left margin to 0}
ESC,&,s,1,C {Disable Line Wrap}
ESC,&,k,2,G {Line Termination = CR}
ESC,(,s,5,B {BOLD - Woohoo - The reason for all this}
ESC,&,l,6,D { 6 lines per inch }
ESC,(,s,19,H { 19 chars per inch }
Note: the ghostpcl command is the precompiled runtime from the link that Clifford supplied above that I just renamed and added to my path.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.