Skip to main content
Skip table of contents

Mako Splitter

Mako Splitter divides the source file into a number of separate files of equal size. It employs a threading pattern, in effect writing the output files in parallel.

Mako Splitter v1.0.0.X

   Makosplitter [output.yyy] [parameter=setting] [parameter=setting] ...
 Where:          source file from which to extract pages, where xxx is pdf, xps, pxl (PCL/XL) or pcl (PCL5).
   output.yyy         target file to write the output to, where yyy is pdf, xps, pxl or pcl.
                        If no output file is declared, <input>.pdf is assumed.
   parameter=setting  one or more settings, described below.

   pw=<password>      PDF password, if required to open the file.
   c=<chunk size>     The number of pages per output file (omitted or 0 means one file per page)
   f=yes|no           Create a folder to contain the output, named according to the output file name.
   s=yes|no           Use a single thread (yes), otherwise multiple threads are used to write the output files, the default.

How it works

The program creates "jobs", each of which consists of a number of pages, determined by the "chunk" size. These are then scheduled by a threadrunner that is initialized with the number of available threads. Jobs are scheduled until they are exhausted.

The final file written may have fewer pages than the chunk size if the number of pages in the source file cannot be evenly divided.

When a job is processed, a simple loop copies the pages over from the source to the target document. For example:

IDocumentAssemblyPtr assembly = IDocumentAssembly::create(mako);
IDocumentPtr document = IDocument::create(mako);
for (uint32 i = 0; i < chunkSize; i++)
   document->appendPage(clonedPages[i], sourceDocument);
output->writeAssembly(assembly, outputFile);

Making the source document available to the appendPage() call is important, as it allows Mako to copy over related page information (for example, form field metadata and bookmarks that target the page).

Useful sample code

  • Threading pattern
  • Efficiently copying content from one document to another

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.