To convert a PJL print task file to PDF, especially when facing issues with fonts and compatibility, follow these steps:
1. Analyze the PJL File Structure
PJL files often encapsulate PCL (Printer Command Language) or PostScript. First, determine the embedded format:
- Open the file in a text editor (e.g.,
less, vim, or hexdump on Linux/macOS, or a hex editor like HxD on Windows).
- Look for:
- PCL: Starts with
ESC% (e.g., %!PCL).
- PostScript: Starts with
%!PS.
- PJL commands: Lines like
@PJL indicate PJL headers.
2. Extract the Embedded PDL (PCL or PostScript)
Remove PJL headers/footers to isolate the actual content:
- For PostScript:
- Search for
%!PS and extract everything from that line onward.
- Remove trailing PJL commands (e.g.,
@PJL EOJ).
- For PCL:
- Look for
ESC% and extract the binary/data stream after PJL headers.
Use sed or a script to automate cleanup:
# Example: Extract PostScript from PJL
sed -n '/^%!PS/,//p' input.pjl > output.ps
3. Convert to PDF
If the file contains PostScript:
Use Ghostscript (a powerful tool for handling PostScript/PDF conversions):
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf -f input.ps
- Adjust font handling with flags like
-dEmbedAllFonts=true or -dPDFSETTINGS=/prepress.
If the file contains PCL:
- Use PCL Reader (Windows) or Ghostscript with PCL support:
# Ghostscript PCL-to-PDF example (requires PCL interpreter)
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pcl
- Alternatively, convert PCL to PDF first via
pcl6 (part of Ghostscript):
pcl6 -sDEVICE=pdfwrite -o output.pdf input.pcl
4. Troubleshoot Font Issues
5. Identify the Original Driver
Check the PJL header for clues:
head -n 20 input.pjl
Look for lines like:
@PJL SET INITIALIZE DEFAULT
@PJL ENTER LANGUAGE=PCL
Or:
@PJL JOB NAME="document" USERNAME="user"
- Driver name: May appear in
@PJL SET commands or job metadata.
- Printer model: Use
lpinfo -v (Linux) or printer logs to match the driver.
6. Alternative Tools
7. Virtual Printer Workaround
If the original driver is known:
- Install a virtual PDF printer (e.g., CUPS-PDF, Microsoft Print to PDF).
- Set the virtual printer to use the original driver.
- Print the PJL file through the virtual printer.
Summary
- Extract PostScript/PCL from the PJL file.
- Use Ghostscript to convert to PDF, adjusting font settings.
- If fonts persist, identify the driver and regenerate the print job with proper settings.
Example full command for PostScript:
gs -dNOPAUSE -dBATCH -dEmbedAllFonts=true -sDEVICE=pdfwrite -sOutputFile=output.pdf -f cleaned.ps
This method addresses font issues and leverages open-source tools for reliability.