Created Date: 06 Nov, 2020 17:59
Last Modifed Date: 20 May, 2022 09:47

Sample code

Jaws PDF Library is an SDK; to use it, a developer must write an application to make use of it.

A sample application, testpdflibcmd, is provided not just to show how to write code for the SDK, but to provide a practical utility that can be used to exercise the RIP’s features without the need to write code.

An equivalent application, makodistillercmd, is included in the Mako SDK that can be built for any supported platform.

While the two programs use similar arguments and options, they only apply to the conversion from PostScript to PDF which is the only conversion path offered by makodistillercmd. Conversion in the opposite direction as well as conversion of PDLs in addition to PostScript and PDF is offered by makoconverter, another sample application from the Mako SDK.

A detailed comparison between the options offered by the two programs is presented in the page "Comparison of testlibpdfcmd to makodistillercmd"

MakoDistillerCmd sample

Makodistillercmd Usage

(C) Copyright 2021-2022 Global Graphics Software Ltd.
All Rights Reserved.

Usage: makodistillercmd <arg_file>


 Mode switches:
  -d           : distiller mode, convert PS files to PDF (default)

 Distill (PDF output) mode options:
  -da          : ASCII encode
  -dA<author>  : Set the PDF Author
  -db...       : Thumbnail options (see below)
  -dB(C|N|P)   : Use the DSC BoundingBox for:
                 C=Crop box, N=Nothing (default), P=Page size
  -dc...       : Colour image options (see below)
  -dC          : Convert device independent colours to device dependent colours
  -dd<dpi>     : Resolution of the whole file (default 72)
  -dfb         : Embed the base 14 fonts
  -dfc         : Embed disk-based (external) CIDFonts
  -dfe         : Embed fonts (use -dfb for the base 14 fonts and -dfc for CID)
  -dfs         : Subset fonts
  -dg...       : Greyscale image options (see below)
  -dh          : Preserve halftones
  -dI          : Disable Illustrator overprint mode (requires -dv)
  -dj...       : Job Ticket options (see below)
  -dm...       : Monochrome image options (see below)
  -do          : Preserve OPI
  -dO          : Optimize (aka linearize) the PDF file
  -dP<format>  : PDF file format (for example: -dP1.3 or -dP1.4)
  -dr          : Auto-rotate
  -dR<creator> : Set the PDF Creator
  -ds...       : Security options (see below)
  -dS<subject> : Set the PDF Subject
  -dta         : Apply transfer functions
  -dtp         : Preserve transfer functions
  -dtr         : Remove transfer functions
  -dT<title>   : Set the PDF Title
  -dv          : Preserve overprint
  -dz          : Flate/Zip compress text
  -dZ<option>  : PDF1.5 object compression; option can be None, Tags or All
                 -dZ is equivalent to -dZAll; no -dZ means -dZNone

 Distill (PDF output) mode Job Ticket options:
  -dj<0|1>     : enable (-dj1) or disable (-dj0) the generation of Job
                 ticket in the PDF file (default 0)

 Distill (PDF output) mode image options:
  -db*         : Thumbnails
    where * is one of c=colour, m=mono, n=none (default)
  -dc*         : Colour image options
  -dg*         : Greyscale image options
  -dm*         : Monochrome image options
    where * is one or more of the following:
          a          = Average downsample
          b          = Bicubic downsample (not monochrome)
          s          = Subsample downsample
          A          = Auto compression
                       (NB: for colour/greyscale only, set JPEG options
                       with l/m/h/q switches)
          f          = Flate/Zip compression
          p          = Flate/Zip with Predictor compression
          l          = JPEG low compression (QFactor 0.1)
          m          = JPEG medium compression (QFactor 0.5)
          h          = JPEG high compression (QFactor 1.3)
          q<QFactor> = JPEG compression using specified QFactor
                       (NB: JPEG is for colour/greyscale only)
          c          = CCITT compression (monochrome only)
          y          = Convert CMYK to RGB
          r<dpi>     = image downsampling resolution

 Distill (PDF output) mode security options:
  -dso<password> : owner password (default empty)
  -dsp<perms>    : permission flags (default value is 0xFFFFFFFC or -4 decimal,
                   see the PDF spec for details of bit meanings)
                   the permissions integer must be specified in decimal
  -dsu<password> : user password (default empty)

 Page-filtering options: (pages are numbered starting from 1)
  -pl<pageno>  : The lowest page number to include in the output
  -ph<pageno>  : The highest page number to include in the output

 Font-related options:
  -fp<fontpath>: Specifies the font directory (must occur BEFORE
                 -fa or -fr if they're used).  If you use this,
                 remember to put the Font\*.* files in the specified
                 directory! (same as the -Pf option)
  -fa<filename>: Adds the font filename so that Mako can use it,
                 the filename can contain wildcards
  -ff<filename>: Lists the names of the fonts that are available
                 in the specified font file
  -fr<fontname>: removes the named font from Mako (this switch
                 may be repeated if necessary)

 Path options:
  -Pf<fontpath> : Sets the path where font files can be found (same as -fp).
  -Pr<respath>  : Sets the path where the external resource files are found.

 PostScript injection:
  -J<when><type><source><data> :
       Where <when> is p for prolog or e for epilog
       and <type> is d for PDF output
       and <source> is f for a filename (data is a filename)
                    or c for command line (data is PostScript code)
       and <data> specifies PS code (literal or a filename) to be injected
           into the stream fed to the interpeter at the specified point for
           the specified type of output.  Implicit newline characters are
           added to the start and end of the data if <source> is c.
    Example: '-Jpdf' would prefix all jobs producing PDF output
             with the PostScript code contained within the file ''
    Example: '-Jedcshowpage' would perform an extra 'showpage' after all jobs
             producing PDF output.
    Note that at most only one of each of the four -J<when><type> options
    should be used.

 Miscellaneous options:
  -o<filename> : Overrides the default output file name
  -i<options>  : Passes the <options> string verbatim as extra options.
                 <options> is a semicolon-separated list of key=value pairs.
                 Note: only ONE -i argument can be supplied and it should be
                        the first argument on the command line.
                 Valid options are:

  -h or -?     : This usage information

makodistillercmd "dist.args"

Where dist.args is the configuration file for this particular
instance of distiller.

Sample dist.args

In most cases, it will be possible to swap a testpdflibcmd.exe command for makodistillercmd.exe command in a script or batch file, when the distill function (-d) of PDFLib (PostScript to PDF) is specified.