Storing PCL5 permanent resources
📌 Overview
PCL5 allows certain resources to be set as permanent. Mako 7.0 introduced support for permanent resources, allowing different types of resources that may be marked as permanent (fonts, symbol sets and macros) to survive a printer reset/UEL command in the PCL stream.
A feature added to IPCL5Input in Mako 7.4.0 enables it to get/set a reference to an object to be used for storing PCL5 permanent resources. While it is possible to achieve by keeping a pointer to an IPCL5Input, there are situations where these resources need to be shared between input classes. A specific example is when using a PJL parser to create IPCL5Inputs in unencapsulated mode, where a printer reset/UEL may return to PJL and then later execute another PCL5 stream that requires resources from an earlier stream. IPRNInput works this way.
📗 Instructions
A new API, IPCL5Input::setPermanentResourceStore() can be used for this. Passing a reference to a null IRCObjectPtr initializes the object so that it can be used with another IPCL5Input.
⌨️ Sample Code
A simple example when using with PJL might be:
IRCObjectPtr resources;
if (pjlParser->parse(pushbackStream) == CPjlParser::ePREnterPcl)
{
IPCL5InputPtr pclInput = IPCL5Input::create(jawsMako);
pclInput->enableUnencapsulatedMode(true);
pclInput->setPermanentResourceStore(resources);
IDocumentAssemblyPtr assembly = pclInput->open(pushbackStream);
...
}
// resources now points to an object that holds permanent resources.
if (pjlParser->parse(pushbackStream) == CPjlParser::ePREnterPcl)
{
IPCL5InputPtr pclInput = IPCL5Input::create(jawsMako);
pclInput->enableUnencapsulatedMode(true);
// Pass the permanent resources to a newly created IPCL5Input.
pclInput->setPermanentResourceStore(resources);
IDocumentAssemblyPtr assembly = pclInput->open(pushbackStream);
...
}
☑️ Conclusion
Mako's support for PCL5 permanent resources allows for efficient management of resources such as fonts, symbol sets, and macros across multiple PCL streams. By utilizing the IPCL5Input::setPermanentResourceStore() API, users can ensure that these resources persist even after a printer reset or UEL command. The provided sample code demonstrates how to implement this feature effectively, particularly when working with PJL parsers.
📚 Additional Resources
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.