· data2print ·

The solution for preparing, composing and personalizing
complex printed matter

Startpage · Introduction · Input/Processing/Output · Examples

Rearrange existing PDF documents
PDF document in individual pages
Split PDF document into front pages/back pages
Extract specific PDF pages
Extract specific PDF front/back pages

Composition of multiple PDF documents
Combine PDF documents
Scale PDF document
Duplicate PDF document on print sheet

Change existing PDF documents
Create multi-page mail merge
Resort PDF documents

 

Example – Scale PDF document

A Din A4 PDF document can be scaled into different formats. This makes sense when printing books, for example if an A4 book needs to be reduced to B5 format.

<?xml version="1.0" encoding="utf-8"?>
<job>
  <dialog>
    <topic>
      <prompt>PDF-Inputfile</prompt>
      <type>file</type>
      <filter>'.pdf'</filter>
      <variable>inFile</variable>
    </topic>
    <topic>
      <prompt>Zielbogen</prompt>
      <choices>
        <choice><value>'A4'</value></choice>
        <choice><value>'A5'</value></choice>
        <choice><value>'B5'</value></choice>
        <choice><value>'D6'</value></choice>
      </choices>
      <variable>inSize</variable>
    </topic>
  </dialog>

  <moulds>
    <mould name="paper">
      <width>variable('papersize.'+{inSize}+'.width')</width>
      <height>variable('papersize.'+{inSize}+'.height')</height>
    </mould>
  </moulds>

  <eval variable="outFile" expression="filepath({inFile})+'_'+{inSize}+'.pdf'" />

  <instance>
    <iterate file="{inFile}" variable="pdfin">
      <append>
        <template mould="paper"/>
        <compose file="'scale.compose.xml'"/>
        <output file="{outFile}"/>
        <eval variable="pageNr" expression="{pdfin.pagenr}"/>
      </append>
    </iterate>
  </instance>
</job>
 


Open selection window

Description field in the selection window

Only allow PDF files
Remember selected file name


Query target arc size

The paper sizes are written to a selection list




Note target arc size




Define blank sheet.
The paper sizes can be easily adjusted using the
Access to built-in values for all common DIN sizes.



Name output file


Cycle through the selected file
Append page to output file
Take a defined pressure area
Where something should be positioned
Specify output file
Transfer current page number

End of program loop

The appropriate compose file, "scale.compose.xml", only describes the placement of the PDF page in the specified area. Registration marks or labels could also be specified at this point.

<?xml version="1.0" encoding="utf-8"?>
<compose>

    <field type="pdf" left="0mm" right="0mm"
                      top="0mm" bottom="0mm">
      <file>{inFile}</file>
      <page>{pageNr}</page>
      <scale>fit</scale>
      <halign>center</halign>
      <valign>middle</valign>
    </field>    

</compose>
 



Field is 100% of the page (so margins are 0mm)

PDF input file
Just take this current page
Allow scaling
Center align if original size is not in same aspect ratio