Skip to main content

Can anyone recommend a test-to-pdf conversion program that I can run at the command line?

- Bob



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Can anyone recommend a test-to-pdf conversion program that I can run at the command line?

- Bob



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Hi Bob,

if you are doing it from D3, then :
1. create the relevent printer for PDF (if not done already)

2. set your printer to the PDF "printer" / creator

3. enter  COPY <file> <item> (p<other options>

If from Windows using a DOS command window :

  1. in Windows, set the PDF printer / creator as your default
  2. in the DOS / CMD window enter  (I think)  PRINT <file>      where <file> can be the full path

Regards,

Warwick



------------------------------
Warwick Dreher
Warwick Dreher
Croydon AU
------------------------------

Hi Bob,

if you are doing it from D3, then :
1. create the relevent printer for PDF (if not done already)

2. set your printer to the PDF "printer" / creator

3. enter  COPY <file> <item> (p<other options>

If from Windows using a DOS command window :

  1. in Windows, set the PDF printer / creator as your default
  2. in the DOS / CMD window enter  (I think)  PRINT <file>      where <file> can be the full path

Regards,

Warwick



------------------------------
Warwick Dreher
Warwick Dreher
Croydon AU
------------------------------

I can print to a pdf in Windows.  When I print from d3, at what point do I tell it what file to create?



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Can anyone recommend a test-to-pdf conversion program that I can run at the command line?

- Bob



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

From the ensuing discussion I assume you're on Windows.

I have a very small, very crude program that was originally written in 1996 that will take text and create a PDF (it is called text2pdf and it runs on Windows, Linux, and MacOS, and probably can be compiled with little trouble for any other OS you might like to try!). It does no fancy formatting, it doesn't even produce a compressed PDF at the end, but it will produce a PDF from text if that's all you need.

Beyond this there are many options available I'm sure, but I avoid using Windows so can probably only offer further thoughts for *nix systems!



------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

From the ensuing discussion I assume you're on Windows.

I have a very small, very crude program that was originally written in 1996 that will take text and create a PDF (it is called text2pdf and it runs on Windows, Linux, and MacOS, and probably can be compiled with little trouble for any other OS you might like to try!). It does no fancy formatting, it doesn't even produce a compressed PDF at the end, but it will produce a PDF from text if that's all you need.

Beyond this there are many options available I'm sure, but I avoid using Windows so can probably only offer further thoughts for *nix systems!



------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

Sounds great - can you send me a copy?



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Sounds great - can you send me a copy?



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Hi Bob,

I can't figure out how to attach the text2pdf.exe file to this message, so if you can reply with your email address I'll attach it to an email (it's a tiny file but I would ZIP it before sending it as some mail filters object to executable files being sent in emails). If you run it from the command line (e.g. Windows PowerShell), you can give it the "-h" flag to see the help which then shows this:

text2pdf [options] [filename]
 
  text2pdf makes a 7-bit clean PDF file (version 1.1) from any input file.
  It reads from standard input or a named file, and writes the PDF file
  to standard output.
 
  There are various options as follows:
 
  -h show this message
  -f<font> use PostScript <font> (must be in standard 14, default: Courier)
  -I use ISOLatin1Encoding
  -s<size> use font at given pointsize (default 10.0)
  -p<padding> add horizontal character padding (default 0.0)
  -v<dist> use given line spacing (default 12.00 points)
  -l<lines> lines per page (default 60, determined automatically
if unspecified)
  -c<chars> maximum characters per line (default 80)
  -t<spaces> spaces per tab character (default 8)
  -F ignore formfeed characters (^L)
  -A4 use A4 paper (default Letter)
  -A3 use A3 paper (default Letter)
  -x<width> independent paper width in points
  -y<height> independent paper height in points
  -2 format in 2 columns
  -L landscape mode
  -a left margin (default 50)
  -b top margin (default 40)
 
  Note that where one variable is implied by two options, the second option
  takes precedence for that variable. (e.g. -A4 -y500)
  In landscape mode, page width and height are simply swapped over before
  formatting, no matter how or when they were defined.
 
text2pdf v1.1 (c) Phil Smith, 1996
So an very example of how to use it would be, given a plain ASCII text file (note that ^L = char(12) is treated as a new page):
c:\\path\\to\\text2pdf mytextfile.txt > mytextfile.pdf
As I said, this is very rudimentary but does the job and offers enough options to format the output on a page. If I need further changes to the PDF created by this I use an open source product called "qpdf".


------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

Hi Bob,

I can't figure out how to attach the text2pdf.exe file to this message, so if you can reply with your email address I'll attach it to an email (it's a tiny file but I would ZIP it before sending it as some mail filters object to executable files being sent in emails). If you run it from the command line (e.g. Windows PowerShell), you can give it the "-h" flag to see the help which then shows this:

text2pdf [options] [filename]
 
  text2pdf makes a 7-bit clean PDF file (version 1.1) from any input file.
  It reads from standard input or a named file, and writes the PDF file
  to standard output.
 
  There are various options as follows:
 
  -h show this message
  -f<font> use PostScript <font> (must be in standard 14, default: Courier)
  -I use ISOLatin1Encoding
  -s<size> use font at given pointsize (default 10.0)
  -p<padding> add horizontal character padding (default 0.0)
  -v<dist> use given line spacing (default 12.00 points)
  -l<lines> lines per page (default 60, determined automatically
if unspecified)
  -c<chars> maximum characters per line (default 80)
  -t<spaces> spaces per tab character (default 8)
  -F ignore formfeed characters (^L)
  -A4 use A4 paper (default Letter)
  -A3 use A3 paper (default Letter)
  -x<width> independent paper width in points
  -y<height> independent paper height in points
  -2 format in 2 columns
  -L landscape mode
  -a left margin (default 50)
  -b top margin (default 40)
 
  Note that where one variable is implied by two options, the second option
  takes precedence for that variable. (e.g. -A4 -y500)
  In landscape mode, page width and height are simply swapped over before
  formatting, no matter how or when they were defined.
 
text2pdf v1.1 (c) Phil Smith, 1996
So an very example of how to use it would be, given a plain ASCII text file (note that ^L = char(12) is treated as a new page):
c:\\path\\to\\text2pdf mytextfile.txt > mytextfile.pdf
As I said, this is very rudimentary but does the job and offers enough options to format the output on a page. If I need further changes to the PDF created by this I use an open source product called "qpdf".


------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

bob@synapse-cs.com

Thanks!



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

bob@synapse-cs.com

Thanks!



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Sent! Let me know here if it doesn't show up!



------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

Sent! Let me know here if it doesn't show up!



------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

I did not receive it.  Try sending it to bobthomson2001@yahoo.com.

Thanks!



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Hi Bob,

if you are doing it from D3, then :
1. create the relevent printer for PDF (if not done already)

2. set your printer to the PDF "printer" / creator

3. enter  COPY <file> <item> (p<other options>

If from Windows using a DOS command window :

  1. in Windows, set the PDF printer / creator as your default
  2. in the DOS / CMD window enter  (I think)  PRINT <file>      where <file> can be the full path

Regards,

Warwick



------------------------------
Warwick Dreher
Warwick Dreher
Croydon AU
------------------------------

We have been using PCL2PDF software sucessfully for many years.

We use the same programs as to print to a PCL laser printer the report; but, we capture the print being generated.

Then use the command line as instructed to convert it to PDF



------------------------------
Frank Diaz
Consultant
Compucot Inc
Doral FL US
------------------------------

We have been using PCL2PDF software sucessfully for many years.

We use the same programs as to print to a PCL laser printer the report; but, we capture the print being generated.

Then use the command line as instructed to convert it to PDF



------------------------------
Frank Diaz
Consultant
Compucot Inc
Doral FL US
------------------------------

PCL2PDF creates the PDF file just fine, but it hangs up the d3 port it's running on.  When I run it at the command line, it warns me this file is not in standard PCF format, and prompts me to click OK.  How do I get it to exit gracefully?

- Bob



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

PCL2PDF creates the PDF file just fine, but it hangs up the d3 port it's running on.  When I run it at the command line, it warns me this file is not in standard PCF format, and prompts me to click OK.  How do I get it to exit gracefully?

- Bob



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------
Tom:

Here is the routine we developed it returns the path of the one of many
files converted to PDF.

SUBROUTINE DVP.PCL2PDF(ATTACH)
************************************************************************
* COPYRIGHT 1982-2024 COMPUCOT INC. *
* AS AN UNPUBLISHED WORK. ALL RIGHTS RESERVED. *
* THIS WORK IS THE PROPERTY OF, AND EMBODIES TRADE *
* SECRETS AND CONFIDENTIAL INFORMATION PROPRIETARY *
* TO COMPUCOT INC. *
* IT MAY NOT BE REPRODUCED, COPIED, USED, DISCLOSED, *
* TRANSFERED, ADAPTED, OR MODIFIED WITHOUT THE EXPRESS *
* WRITTEN APPROVAL OF COMPUCOT INC. *
* * (305) 477-5788 * *
************************************************************************
RPATH='C:\\PCLWORK'
WPATH='C:\\PICKTEMP'
AM=CHAR(254)
MAX=DCOUNT(ATTACH,AM)
NATTACH=''
FOR X=1 TO MAX
FILENAME=ATTACH
FFILENAME=RPATH:'\\':FILENAME:'.PCL'
TFILENAME=WPATH:'\\':FILENAME:'.PDF'
COMMAND=RPATH:'\\PCL2PDF535 "':FFILENAME:'" "':TFILENAME:'" -S'
IF ATTACH#'' THEN
COMMAND=COMMAND:' -load:C:\\Laserforms\\':ATTACH
<<<<< This is used if you loaded a template to your printer
END
NATTACH<-1>=TFILENAME
CALL DVP.DOSCOMMAND(COMMAND)
19 NEXT X
ATTACH=NATTACH
RETURN
END

Frank Diaz
Consultant
Compucot Inc.
10441 NW 28th Street #A101
Doral, Florida 33172
Tel: (305) 477-5788
Fax: (305) 599-3059
Email: Frank@compucot.com
Web:

ot.com%2F&data=04%7C01%7CAlejandro.Franco%40goya.com%7C1b3b8966cf0542cf90500
8d89665f9da%7Ca9295b22d0c5456ab48719f605708737%7C0%7C0%7C637424712011509269%
7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
LCJXVCI6Mn0%3D%7C1000&sdata=12Ii7KMU7WLoSnoZuaULkzm8nKNXuGdXtr3rNLN3vfE%3D&r
eserved=0> www.compucot.com
This electronic transmission message is intended only for the use of the
individual or entity to which it is addressed. The information in this
transmission may be proprietary, confidential, privileged and exempt from
disclosure under applicable law. If the reader of this Notice is not the
intended recipient (or the employee or agent responsible for delivering the
message to the intended recipient), you are hereby notified that any use,
dissemination, distribution or copying of this communication is prohibited.
If you have received this communication in error, please immediately notify
us by telephone (at our expense) or by e-mail and destroy the material
transmitted to you in error. Thank you for your cooperation.

Tom:

Here is the routine we developed it returns the path of the one of many
files converted to PDF.

SUBROUTINE DVP.PCL2PDF(ATTACH)
************************************************************************
* COPYRIGHT 1982-2024 COMPUCOT INC. *
* AS AN UNPUBLISHED WORK. ALL RIGHTS RESERVED. *
* THIS WORK IS THE PROPERTY OF, AND EMBODIES TRADE *
* SECRETS AND CONFIDENTIAL INFORMATION PROPRIETARY *
* TO COMPUCOT INC. *
* IT MAY NOT BE REPRODUCED, COPIED, USED, DISCLOSED, *
* TRANSFERED, ADAPTED, OR MODIFIED WITHOUT THE EXPRESS *
* WRITTEN APPROVAL OF COMPUCOT INC. *
* * (305) 477-5788 * *
************************************************************************
RPATH='C:\\PCLWORK'
WPATH='C:\\PICKTEMP'
AM=CHAR(254)
MAX=DCOUNT(ATTACH,AM)
NATTACH=''
FOR X=1 TO MAX
FILENAME=ATTACH
FFILENAME=RPATH:'\\':FILENAME:'.PCL'
TFILENAME=WPATH:'\\':FILENAME:'.PDF'
COMMAND=RPATH:'\\PCL2PDF535 "':FFILENAME:'" "':TFILENAME:'" -S'
IF ATTACH#'' THEN
COMMAND=COMMAND:' -load:C:\\Laserforms\\':ATTACH
<<<<< This is used if you loaded a template to your printer
END
NATTACH<-1>=TFILENAME
CALL DVP.DOSCOMMAND(COMMAND)
19 NEXT X
ATTACH=NATTACH
RETURN
END

Frank Diaz
Consultant
Compucot Inc.
10441 NW 28th Street #A101
Doral, Florida 33172
Tel: (305) 477-5788
Fax: (305) 599-3059
Email: Frank@compucot.com
Web:

ot.com%2F&data=04%7C01%7CAlejandro.Franco%40goya.com%7C1b3b8966cf0542cf90500
8d89665f9da%7Ca9295b22d0c5456ab48719f605708737%7C0%7C0%7C637424712011509269%
7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
LCJXVCI6Mn0%3D%7C1000&sdata=12Ii7KMU7WLoSnoZuaULkzm8nKNXuGdXtr3rNLN3vfE%3D&r
eserved=0> www.compucot.com
This electronic transmission message is intended only for the use of the
individual or entity to which it is addressed. The information in this
transmission may be proprietary, confidential, privileged and exempt from
disclosure under applicable law. If the reader of this Notice is not the
intended recipient (or the employee or agent responsible for delivering the
message to the intended recipient), you are hereby notified that any use,
dissemination, distribution or copying of this communication is prohibited.
If you have received this communication in error, please immediately notify
us by telephone (at our expense) or by e-mail and destroy the material
transmitted to you in error. Thank you for your cooperation.

I don't recognize the PCL2PDF535 version of the command name.  I've been using PCL2PDF.

It still works when I execute the command in the shell, but it hangs up when I run it in d3.

- Bob



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Can anyone recommend a test-to-pdf conversion program that I can run at the command line?

- Bob



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Hi Bob,

I needed a simple way to go from text to pdf a few years back and couldn't find a simple solution.

I did find a PS2PDF (Postscript) and was able to implement it.

I haven't really explored the postscript possibilities because a simple text PDF is fine for our needs, but I believe there are a wealth of possibilities.

a              = @AM
v              = @VM
c              = CHAR( 13 ) : CHAR( 10 )
l              = CHAR( 10 )
t              = CHAR( 9 )
UnixPath       = '/u/home/lance/'

OPEN UnixPath TO h_home ELSE STOP


heading     = '""'                  ;! Page header - Left blank for my use
txt_name    = 'Txt2Pdf-Test.txt'
ps_name     = 'Txt2Pdf-Test.ps'
pdf_name    = 'Txt2Pdf-Test.pdf'

report      = 'Some data to write to text file' : c : 'With two lines of text.' 
WRITE report TO h_home, txt_name

cmd  = '!cd ' : UnixPath : l
cmd := 'enscript -b ' : heading  : ' --margins=0:0:0:0 -f Courier10 -F Courier10 -p ' : ps_name  : ' ' : txt_name : ' >/dev/null 2>&1' : l
cmd := 'ps2pdf '      : ps_name  : ' ' : pdf_name : ' >/dev/null 2>&1' : l
cmd := 'cp -f '       : pdf_name : ' ' : pdf_name : ' >/dev/null 2>&1' : l
cmd := 'rm -f ' : txt_name : l
cmd := 'rm -f ' : ps_name : l

EXECUTE cmd CAPTURING abc

Hope this helps...

Lance



------------------------------
Lance McMillin
Sr Programmer Analyst
Health Advocates LLC
Chatsworth CA US
------------------------------

Hi Bob,

I needed a simple way to go from text to pdf a few years back and couldn't find a simple solution.

I did find a PS2PDF (Postscript) and was able to implement it.

I haven't really explored the postscript possibilities because a simple text PDF is fine for our needs, but I believe there are a wealth of possibilities.

a              = @AM
v              = @VM
c              = CHAR( 13 ) : CHAR( 10 )
l              = CHAR( 10 )
t              = CHAR( 9 )
UnixPath       = '/u/home/lance/'

OPEN UnixPath TO h_home ELSE STOP


heading     = '""'                  ;! Page header - Left blank for my use
txt_name    = 'Txt2Pdf-Test.txt'
ps_name     = 'Txt2Pdf-Test.ps'
pdf_name    = 'Txt2Pdf-Test.pdf'

report      = 'Some data to write to text file' : c : 'With two lines of text.' 
WRITE report TO h_home, txt_name

cmd  = '!cd ' : UnixPath : l
cmd := 'enscript -b ' : heading  : ' --margins=0:0:0:0 -f Courier10 -F Courier10 -p ' : ps_name  : ' ' : txt_name : ' >/dev/null 2>&1' : l
cmd := 'ps2pdf '      : ps_name  : ' ' : pdf_name : ' >/dev/null 2>&1' : l
cmd := 'cp -f '       : pdf_name : ' ' : pdf_name : ' >/dev/null 2>&1' : l
cmd := 'rm -f ' : txt_name : l
cmd := 'rm -f ' : ps_name : l

EXECUTE cmd CAPTURING abc

Hope this helps...

Lance



------------------------------
Lance McMillin
Sr Programmer Analyst
Health Advocates LLC
Chatsworth CA US
------------------------------

Unfortunately, I'm on d3/Windows.

- Bob



------------------------------
Bob Thomson
President
Synapse Computer Solutions Inc
San Rafael CA US
------------------------------

Hi Bob,

I needed a simple way to go from text to pdf a few years back and couldn't find a simple solution.

I did find a PS2PDF (Postscript) and was able to implement it.

I haven't really explored the postscript possibilities because a simple text PDF is fine for our needs, but I believe there are a wealth of possibilities.

a              = @AM
v              = @VM
c              = CHAR( 13 ) : CHAR( 10 )
l              = CHAR( 10 )
t              = CHAR( 9 )
UnixPath       = '/u/home/lance/'

OPEN UnixPath TO h_home ELSE STOP


heading     = '""'                  ;! Page header - Left blank for my use
txt_name    = 'Txt2Pdf-Test.txt'
ps_name     = 'Txt2Pdf-Test.ps'
pdf_name    = 'Txt2Pdf-Test.pdf'

report      = 'Some data to write to text file' : c : 'With two lines of text.' 
WRITE report TO h_home, txt_name

cmd  = '!cd ' : UnixPath : l
cmd := 'enscript -b ' : heading  : ' --margins=0:0:0:0 -f Courier10 -F Courier10 -p ' : ps_name  : ' ' : txt_name : ' >/dev/null 2>&1' : l
cmd := 'ps2pdf '      : ps_name  : ' ' : pdf_name : ' >/dev/null 2>&1' : l
cmd := 'cp -f '       : pdf_name : ' ' : pdf_name : ' >/dev/null 2>&1' : l
cmd := 'rm -f ' : txt_name : l
cmd := 'rm -f ' : ps_name : l

EXECUTE cmd CAPTURING abc

Hope this helps...

Lance



------------------------------
Lance McMillin
Sr Programmer Analyst
Health Advocates LLC
Chatsworth CA US
------------------------------
Here is a link to the PCL2PDF we use:

https://origin2.cdn.componentsource.com/sites/default/files/resources/visual
-software/549226/pcl2pdf_v6_9_user_guide.htm


Frank Diaz
Consultant
Compucot Inc.
10441 NW 28th Street #A101
Doral, Florida 33172
Tel: (305) 477-5788
Fax: (305) 599-3059
Email: Frank@compucot.com
Web:

ot.com%2F&data=04%7C01%7CAlejandro.Franco%40goya.com%7C1b3b8966cf0542cf90500
8d89665f9da%7Ca9295b22d0c5456ab48719f605708737%7C0%7C0%7C637424712011509269%
7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
LCJXVCI6Mn0%3D%7C1000&sdata=12Ii7KMU7WLoSnoZuaULkzm8nKNXuGdXtr3rNLN3vfE%3D&r
eserved=0> www.compucot.com
This electronic transmission message is intended only for the use of the
individual or entity to which it is addressed. The information in this
transmission may be proprietary, confidential, privileged and exempt from
disclosure under applicable law. If the reader of this Notice is not the
intended recipient (or the employee or agent responsible for delivering the
message to the intended recipient), you are hereby notified that any use,
dissemination, distribution or copying of this communication is prohibited.
If you have received this communication in error, please immediately notify
us by telephone (at our expense) or by e-mail and destroy the material
transmitted to you in error. Thank you for your cooperation.