Mako Converter
Converts PDL files from one format to another, including converting files of the same PDL to change their characteristics.
TEXT
Mako Converter v1.0.0.X
Usage:
makoconverter.exe <input.ext> <output.ext> [InputPassword=xxx] [Key=XXXX-XXXX-XXXX-XXXX] [?] [<parameter>=<setting>] ...
Where:
input.ext The name of the input file (pdf/xps/pxl/pcl/ps/eps).
InputPassword= Password required to open the input (PDF) file.
Key= Product key for PdfLib (if absent, PS input is watermarked during conversion).
? Display this help.
parameter=setting parameters to be applied to output, eg pdfversion=1.4
See developer.globalgraphics.com for details of output parameters.
How it works
Based on the simpler makoconverter
sample that is included in the SDK, this version adds support for PostScript input, using Jaws PDF Library (PDFLib) to convert PostScript (.ps
) and Encapsulated PostScript (.eps
) files to PDF before processing them further. Like its cousin, Mako Converter works by opening a IDocumentAssembly
with an IInput
to match the input file type, then immediately writing the assembly with an IOutput
of the requested type. There is an opportunity to modify the output by setting one or more output parameters.
XPS output
Converting what may be CMYK content in a PDF to XPS can result in inverted images. To overcome this, Mako Converter sets the output color space for XPS to RGB, using this code:
CPP
IOutputPtr output = IOutput::create(mako, eFileFormat);
// Make XPS output RGB
IXPSOutputPtr xpsOutput = obj2IXPSOutput(output);
if (xpsOutput)
{
xpsOutput->setTargetColorSpace(IDOMColorSpacesRGB::create(mako));
}
This snippet also demonstrates the use of a Mako casting macro, obj2IXPSOutput()
. It is used here to check if the output is XPS; the result of the cast will be NULL
if it fails. They are useful, as in this case, when you need to access a method or property that is available from an instance of the class but not the parent.
There is a list of casting macros at É http://developer.globalgraphics.com but as they all begin obj2...
or edlobj2...
then you can use your IDE to help you find the right one.
Useful sample code
- Conversion
- Setting output parameters with strings and in code
- Example of casting an Mako object