Output parameters and presets
Created Date: 27 Nov, 2020 09:42
Last Modifed Date: 29 Nov, 2021 15:13
Mako supports methods to control the way in which an output file is produced. These can be set in code in two ways. For example, to set the version of PDF that will be written, the code is:
IPDFOutputPtr output = IPDFOutput::create(jawsMako); output->setVersion(IPDFOutput::ePDF1_4);
IPDFOutput output = IPDFOutput.create(jawsMako); output.setVersion(IPDFOutput.ePDF1_4);
Or the same parameter can be expressed as two strings:
IPDFOutputPtr output = IPDFOutput::create(jawsMako); output->setParameter("PDFVersion", "1.4");
IPDFOutput output = IPDFOutput.create(jawsMako); output.setParameter("PDFVersion", "1.4");
This method was added to support scenarios where it is necessary to set an output parameter at runtime (for example, in a printer driver where the user is offered options from a menu).
The sample makoconverter (included in the SDK) allows you to experiment with these parameters by adding them to a command line (for example):
makoconverter MyInput.pdf MyOutput.pdf pdfversion=1.4 TargetColorSpace=DeviceGray ConvertAllColors=true makoconverter MyInput.pdf MyOutput.pdf preset=PDF/X-4
The various output classes that Mako supports offer their own set of output parameters, described on the pages in this section.
Presets "roll up" several parameters to be set together. They are a useful shortcut, particularly for PDF standards such as PDF/X or PDF/A, as they guarantee a compliant file, content permitting. They work in a similar way to parameters - see Output presets (PDF) for details.