Created Date: 21 Mar, 2022 17:42
Last Modified Date: 21 Mar, 2022 17:42


The IDistiller input was created to convert PostScript files to PDF, bypassing intermediate conversion to Mako DOM (Document Object Model), thereby improving conversion performance.

IDistiller has parameters that are not available to IPSInput, but may be useful when converting to Mako DOM. One example is IDistiller::setHiResBox(), which uses the HiResBoundingBox defined in the PostScript input file to more accurately determine page size.

A simple way of using the IDistiller input in this way is to use a Mako temporary reader writer to create a PDF and then pass this to the Mako DOM. Below is sample code which achieves this.

IDistiller to Mako DOM

 // Create an input stream.
 IInputStreamPtr inputStream = IInputStream::createFromFile(jawsMako, makoParams.m_inputFilePath);

 IDistillerPtr distiller = IDistiller::create(jawsMako);

 distiller->setTrimToBBox(true);
 distiller->setHiResBBox(true);

 // Create a temporary stream to write the PDF to.
 IRAInputStreamPtr reader;
 IRAOutputStreamPtr writer;
 jawsMako->getTempStore()->createTemporaryReaderWriterPair(reader, writer);

 // Convert!
 distiller->distill(inputStream, writer, progressMonitor);

 if (writer)
 {
        writer->close();
 }

 input = IPDFInput::create(jawsMako);
 assembly = input->open(reader);
CPP