PJL and PrintTickets
📌 Overview
This page was written in response to a customer question about PJL entries and describes how to access print tickets and parse PJL using IPJLParser
.
Issue Description
A customer asked: "How can I find out if a PCL document has a duplex setting?".
💡 Solution
The short answer is that Mako will parse PJL (Printer Job Language) entries when loading a PCL or PCL/XL document using the appropriate Mako API (IPCLInput
or IPCLXLInput
), and automatically populate print tickets in the Mako DOM. The print tickets use keywords that adhere to the Microsoft Print Schema Specification. For example, the PJL entry @PJL SET DUPLEX = OFF
would result in a print ticket entry of PageDuplex
with a value of OneSided.
IDOMJobTk
Print tickets are stored in the Mako DOM as a tree structure, at the document and/or page level. They are accessed via the IDOMJobTk
family of Mako APIs (IDOMJobTk
, IDOMJobTkContent
and IDOMJobTkNode
).
Hint: To quickly get an understanding of how Mako will interpret PJL, use makoconverter
(another Mako SDK example) to convert a PCL or PCL/XL file to XPS. There, the print ticket information is written as XML and therefore human-readable. Simply open the XPS with your favorite ZIP tool (here 7Zip is used) and look for a print ticket XML file:
![]() | Print ticket content
XML
|
IPJLParser
The PJL parser used internally by Mako is a public API (IPJLParser
) and may be used directly by a Mako developer. This can speed up processing of document-level PJL because the stream can be closed as soon as PCL or PCL/XL content is encountered.
⌨️ Sample Code
How to do this is demonstrated by prnstream.cpp
in the Mako simpleexamples
, included in the SDK. A longer example, makopjltest
, is provided at makopjltest.cpp . It demonstrates both techniques. In the output below right, the first result (initial two lines) is from parsing the PCL directly, while the remainder the result of reporting the document print tickets.
The example enumerates all the print ticket entries it finds in the Mako DOM. If you need to look for a specific entry, you can use IDOMJobTkNodePtr::findChild()
.
PCL input
TEXT
| makopjltest PJL
TEXT
|
☑️ Conclusion
Understanding and utilizing PJL and PrintTickets in Mako is essential for managing print job settings effectively. By leveraging the IPJLParser
and IDOMJobTk
APIs, users can parse PJL entries and access print tickets within the Mako DOM, ensuring accurate print configurations. The examples provided demonstrate how to interpret and manipulate these settings, offering a practical approach to handling complex print jobs.
📚 Additional Resources
Here are some related links you may find useful.
If you need additional help, see our API documentation for detailed information on class/method usage, or raise a support ticket via our customer portal.