Question about saving to SaveFormat.PCL

Hello Team,

I have a question about the new save format “PCL”. My need is to be able to generate generic PCL6 (PCL XL) so that a Word document can be routed to any number of Laser printers. When I save to PCL, Aspose.Words creates the file, however when I route it to a printer… nothing prints (or blank page prints).

For comparison, I setup a generic HP LaserJet printer driver on a Windows machine. I open the document in MS Word and print-to-file using this generic printer driver. It generates PCL XL *.prn file. The file generated in this way will print on any of our printers, while the PCL XL file that is generated by Aspose.Words will NOT print on any of them.

My theory is this… the PCL generated via HP print driver embeds the font, where as the PCL generated by Aspose.Words relies on the font being installed on the individual hardware??? Is that correct? If so, is there any future plans for Aspose.Words to be able to embed the fonts into the PCL file?

I will try to attach the original document and the two PCL files.

The code I’m using is from your example:

Document document = new Document(rtfPath);
PclSaveOptions saveOptions = new PclSaveOptions();
saveOptions.setSaveFormat(SaveFormat.PCL);
saveOptions.setRasterizeTransformedElements(false);
document.save(pclPath, saveOptions);

Thank you,

Ken Kennedy
document.png (28.7 KB)
pcl-aspose.png (37.4 KB)
pcl-hppcl6-printdriver.png (66.3 KB)

@kkennedy

Thanks for your inquiry. Please note currently Aspose.Words for Java does not support custom fonts, we have plan to implement this feature in future. However, we will appreciate it if you please share your source files as ZIP file here. We will look into the issue and will provide you further information accordingly.

Thank you for looking into this, Tilal. I am attaching these files in a zip file. You can see that I tried to use the most basic font I know of “Arial” in the original document “test.rtf”. The PCL generated by the generic HP Printer driver is “test-hplaserjetpcl6.pcl”, and the PCL generated by Aspose.Words is “test-aspose.pcl”.

I saw in your documentation where you stated it does not support “Custom Fonts”. I am confused what you mean by “custom fonts”? I can think of two ways to interpret the statement in your documentation…

  1. Currently, Aspose.Words does not embed any font into the PCL file when it gets generated/saved, but there are plans to include this functionality in the future.
  2. Aspose.Words will never be able to embed a standard font (like Arial) in the PCL file that it generates.

Are either of my interpretations true? Or, am I completely misunderstanding?

Aspose.zip (18.8 KB)

Thanks!

@kkennedy

Thanks for sharing the source documents. We have rendered your shared PCL files with PdfConverterOnline tool and unable to notice any issue. However, we will test the scenario on a Laser printer and will share our findings here. Furthermore, regarding custom fonts query, we are coordinating with our product team and will update you accordingly.

Thanks for the link to the online tool, that is very helpful to know the PCL file isn’t corrupt in some way. Just to let you know, I have attempted to send both PCL files to 3 different laser printers (3 different models), and I get the similar results on all of them… The PCL generated by HP print driver prints fine on all three, but the PCL generated by Aspose.Words doesn’t print on any of them (one printer prints 2 blank pages, and the other two nothing at all prints).

@kkennedy,

Thanks for sharing your findings. We are testing PCL printing on Laser Printer and will update you our findings soon. We also logged a ticket WORDSNET-15884 regarding information of custom fonts and will share details with you as soon as we get a feedback from our product team.

@kkennedy

Thanks for your patience. We have tested the PCL printing on HP Laser Printer and noticed the reported issue with Aspose.Words for Java generated PCL file. We have logged a ticket WORDSNET-15888 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

@kkennedy,

The issues you have found earlier (filed as WORDSNET-15616) have been fixed in this Aspose.Words for .NET 17.11 update and this Aspose.Words for Java 17.11 update.

Please also check the following articles:

@kkennedy

In reference to WORDSNET-15884, your first understanding is correct. We will provide support to embed custom fonts in PCL file in future. Currently, we have included 52 fonts of HP LaserJest Printers in Aspose.Words. Please refer to PCL specification, appendix L:

The PCL XL SetFont operator requires the user to name the font to be used in all following Text
operators for the current graphics state level. The font name for downloaded fonts is userdefined.
However, this font name must not be the same as the device’s internal fonts. For the
internal fonts available in a specific product, see that product’s Software Application Notes.

The following table provides examples of the internal font name field format used in HP LaserJet
Printers:

As we do not know which internal fonts are uploaded by manufacturer in specific user’s printer. So we have provided AddPrinterFont method, to add info of such fonts in Aspose.Words.