[bug-pcl] GhostPCL output corrupted

Brian K. White brian at aljex.com
Fri May 20 09:45:47 PDT 2005


----- Original Message ----- 
From: "Daniel Gapinski" <dangapinski-at-qsi-r2.com at ghostscript.com>
To: <bug-pcl at ghostscript.com>
Sent: Thursday, May 19, 2005 4:06 PM
Subject: [bug-pcl] GhostPCL output corrupted


> Hello,
>
> I have GhostPCL compiled and producing PDF output, but when I try to
> convert to PDF, it always turns out badly. Acrobat Reader says "Acrobat
> could not open 'test.pdf' because it is either not a supported file
> type, or because the file has been corrupted"... You get the idea. This
> happens if I use v1.38p1 or 1.41.
>
> I use the command line as such: pcl6 -sDevice=pdfwrite
> -sOutputFile=test.pdf -dNOPAUSE file.pcl
>
> Pretty straightforward I hope. I don't know what to do about this. Any
> thoughts? Would anyone like to take a look at the PCL file I'm trying to
> convert?
>
> Thanks a lot,
> Dan Gapinski
> Quasar Systems

How are you transferring the file to windows?
IE: Use anything but ftp, or if using ftp remember to ensure that the ftp 
client uses binary mode.
For a quicky, just put the file in /path/to/htdocs and open it in a web 
browser.

> P.S. This 49KB PCL file converts to a whopping 3.9MB PDF. I can use NTFS
> compression to reduce its size to 2.28MB, but that's as small as I can
> get it. Just thought you might like to know.

Welcome to PDF.
In the commercial software I develop, I usually email pcl output by running 
it through a couple of one-line sed scripts I wrote that strips out all pcl, 
converts the line-draw ibm characters to plain ascii -+| and then wrap the 
whole thing in an html PRE tag, and set the cotent-type for the email to 
text/html.

This forces the client to view in a fixed width font and adds only about 
35-40 bytes to the file, but it also subtracts more than that when it strips 
out the pcl codes.

The sed script can't strip pcl graphics, only normal escape sequences. 
Sometimes I'll prepend more than just <html><body><pre> to create an email 
that looks nicer and has a company logo etc... and the main formerly pcl 
text will still be in a pre tag, usually also in a table cell to make a 
border or to allow the text to be black on white with some other color as 
the overall background.

Doing this is only about the same amount of work on your part as the 
programmer trying to add email to a legacy app that only prints, because 
this can all be automated in a single script that takes a few command line 
options.

see http://www.aljex.com/bkw/filepro/index.html#reptmail
it's still kinda klunky but I'm using that a lot with great success and 
satisfaction of the users.
It's been in production at somwhere around a hundred sites for 3 or 4 years, 
and goes into every new customers box, so, klunky as I feel it is, I guess I 
have to allow myself to call it at least "good enough" by now.

I only convert to pdf when absolutely necessary.

You can mail me the pcl if you want. I have 1.41 built and have been using 
it since 1.38. The only times I got an output that acrobat choked on were 
when I used pcl code to set to set the character set to ibm on 1.38. You 
could use sed to convert any ibm line-draw characters to the latin 
equivalents and strip out that one code, but It's ok to use the ibm 
character set now anyways. At least I do with no problems on 1.41

Also, try using the pcl2pdf script that comes with ghostpcl rather than 
using pcl6 directly. If that works, just look at the script and see what it 
does and you can go back to using pcl6 directly if you want.
(I never use it directly fwiw)

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx  Linux SCO  Prosper/FACTS AutoCAD  #callahans Satriani



More information about the bug-pcl mailing list