Printer Job Language --> PDF
Solution 1
The @PJL
lines indicate a Print Job Language header that was inserted before the actual print job. PJL is used to control print job options (such as duplexing, paper tray selection, stapling, punching, folding the output). It was invented by HP.
The print job's format could be anything -- lots of printer vendors support and use it for their own (proprietary) printer language.
The interesting part is what follows after the @PJL
header lines. It could be PDF, or PostScript, or PCL, or anything else.
Also interesting is the line saying @PJL ENTER LANGUAGE = ...
-- it usually reliably indicates the format of the print data stream.
In the case of the mystery.pdf this is HBP
, a format that I've so far not yet encountered.
If indeed there is another open or semi-open format following (in violation to what the ENTER LANGUAGE = ...
line says), like PostScript or PCL, Ghostscript or GhostPDL will be able to convert it to PDF. Just delete all the @PJL
lines from the header first. Then run:
For PostScript files:
gs -o out.pdf -sDEVICE=pdfwrite input-file
For PCL files:
pcl6 -o out.pdf -sDEVICE=pdfwrite input-file
Solution 2
Kurt's answer is correct. The only addition I would like to make is that when dealing with PRN files from Windows, there are multiple types of files that get printed under PRN file type, so make sure it is a PCL file. Even after that, pcl used maybe MS PCLXL, in which case pcl6 conks out. Download ghostpcl and use the command:
gpcl6-9533-linux_x86_64 -sDEVICE=pdfwrite -o output.pdf input-file
Related videos on Youtube
Thufir
Updated on September 18, 2022Comments
-
Thufir over 1 year
I have received a non-human readable file which I would like to make human readable.
How would I go about getting the text content from the following file:
thufir@dur:~/Documents$ thufir@dur:~/Documents$ file mystery.pdf mystery.pdf: HP Printer Job Language data thufir@dur:~/Documents$ thufir@dur:~/Documents$ pdfinfo mystery.pdf Syntax Warning: May not be a PDF file (continuing anyway) Syntax Error: Couldn't find trailer dictionary Syntax Error: Couldn't read xref table thufir@dur:~/Documents$ thufir@dur:~/Documents$ head -n 2 mystery.pdf %-12345X@PJL @PJL ENTER LANGUAGE = HBP thufir@dur:~/Documents$
I don't think it is a pdf file at all,but has been
print to file
'ed instead ofexport pdf
'ed, or similar, so the result is a file in PJL not a pdf.see also:
http://forums.fedoraforum.org/showthread.php?t=247913
I can use ghostscript to get it back into something human readable?
It's about 4000 lines of:
�x]�x�
when directly viewed with cat or similar.
-
Kurt Pfeifle over 9 yearscan you run
head -n 50 mystery.pdf
and see if after the@PJL
lines end there is a%PDF-1.X
line appearing?
-
-
Thufir almost 8 yearspardon, I never got a chance to try this, I don't think I even have the file anymore. Marked as correct.
-
Mr. DOS over 6 yearsThanks for this suggestion! The Debian-packaged Ghostscript failed completely on me, but GhostPCL did the trick.
-
Ferenc Géczi over 3 yearsIn my case the
@PJL ENTER LANGUAGE
wasn'tHBP
like in the original post, but@PJL ENTER LANGUAGE = PCLXL
as inHP-PCL XL;3;0;Comment Copyright (c) 2013 RICOH COMPANY,LTD. ;Version 0.0.1.0
butgpcl6-9533-linux_x86_64
did a perfect job in converting it to pdf.