Converter Parameters

The "Converter" web service can be used to convert various formats to PDF format.

 

Optionally, the parameter structure for the "Pdfa" and "Signature" web services can also be specified for the conversion operation. In this case, these web services will be run directly afterwards.

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<operation xmlns="http://schema.webpdf.de/1.0/operation">
<converter pages="*"
            accessPassword="xyz"
            compression="true"
            dpi="300"
            embedFonts="true"
            jpegQuality="90"
            reduceResolution="true"

            fileExtension="">
  <html adjustFonts="true"
        baseURL="http://www.webpdf.net/"

        useAsTemplate="false"

        useBackground="true"
        downloadImages="true">

         ...

  </html>
  <mail adjustFonts="true"
        attachmentMode="embed"
        downloadImages="true"

        useBackground="true"

        ignoreMissingBodyChunk="false"/>

   <text>

     ...

   </text>
  <officeBridge/>
  <sharePointBridge/>
  <page bottom="20"
        height="297"
        left="20"
        right="20"
        metrics="mm"
        top="20"
        width="210"/>
  <signature>
     ...
  </signature>
  <pdfa>
     ...
  </pdfa>
  <report contentProblems="true"
          fontAliasUsage="true"
          fontIsMissing="true"/>
  <template language="en"
</converter>
</operation>

{
"converter": {
  "pages": "*",
  "accessPassword": "xyz",
  "compression": true,
  "dpi": 300,
  "embedFonts": true,
  "jpegQuality": 90,
  "reduceResolution": true,

  "fileExtension": "xyz",
  "html": {
    "adjustFonts": true,
    "baseURL": "http://www.webpdf.net/",

    "useAsTemplate": : false,

    "useBackground": true,
    "downloadImages": true,

     ...

   },
  "mail": {

    "adjustFonts": true,

    "attachmentMode": "embed",

    "downloadImages": true,

    "useBackground": true,

    "ignoreMissingBodyChunk": false
   },

   "text": {

     ...
   },
  "officeBridge": {},
  "sharePointBridge": {},
  "page": {
    "bottom": 20,
    "height": 297,
    "left": 20,
    "right": 20,
    "metrics": "mm",
    "top": 20,
    "width": 210
   },
  "signature": {
     ...
   },
  "pdfa": {
     ...
   },
  "report": {
    "contentProblems": true,
    "fontAliasUsage": true,
    "fontIsMissing": true
   },
  "template": {
    "language": "en"

   }
 }
}

 

 

converter element

 

Performs the conversion of a document.

 

 
<converter pages="*"
          accessPassword="xyz"
          compression="true"
          dpi="300"
          embedFonts="true"
          jpegQuality="90"
          reduceResolution="true"
          fileExtension="">
            ...
</converter>

{
"converter": {
  "pages": "*",
  "accessPassword":"xyz",
  "compression":true,
  "dpi":300,
  "embedFonts":true,
  "jpegQuality":90,
  "reduceResolution":true,

   "fileExtension": "xyz",
   ...
 }
}

 

pages (default: "")

A text that defines the page range for the export. Individual pages or a range of pages can be defined here. If the text is empty, the entire file will be exported (e.g.: "1-10" or "1,2,5-10")

 

accessPassword (Default: "")

This parameter can be used to declare a password that will be used to open the source document if it is protected.

 

hint

This option is currently only supported for Microsoft Office 97-2003 binary documents and Microsoft Office 2007 documents. Only the default password methods are supported. Encryption based on digital certificates is not supported.

 

compression (default: true)

If "true," the data objects in the PDF document will be compressed (ZLib compression), reducing the size of the document.

 

dpi (default: 300)

Used to set the DPI solution (pixels per inch) for images.

 

embedFonts (default: false)

If "true," fonts will be embedded in the PDF document that is created.

 

hint

If the original fonts are not available on the conversion system, substitute fonts may be embedded instead.

 

hint

If, after the conversion, you want to convert the PDF document to PDF/A, you should not embed any of the fonts, but should instead let the "Pdfa" web service do this.

 

jpegQuality (default: 90)

Used to set the quality (as a percentage) of JPEG images in the PDF document.

 

reduceResolution (default: false)

If "true," then the DPI resolution of graphics is reduced. The reduction value is set with "dpi."

 

fileExtension (default: "")

If you use this attribute to enter an extension for the file (e.g., "doc”) that is currently being processed, automatic file format detection will be disabled. Normally, webPDF does not detect file formats based on the corresponding file extension, but on the file contents instead. Accordingly, webPDF will analyze the file and assign the file the appropriate "mime-type" so that the appropriate file converter can then be selected.

 

hint

You should only set a file extension in exceptional cases, as this will completely disable automatic detection. If, for instance, you specify an extension for which webPDF does not have a "mime-type," the conversion will fail.

 

 

html element

 

These settings are only used for HTML (e.g., websites) and HTML-based documents (e.g., e-mails).

 

<html adjustFonts="true"
    baseURL="http://www.webpdf.net/"
    useAsTemplate="false"

    useBackground="true"
    downloadImages="true">

<templateData>a29J60iOHFQkrn01...JUVPRg0K</templateData>
</html>

"html":{
    "adjustFonts":true,
    "baseURL":"http://www.webpdf.net/",
    "useAsTemplate": : false,
    "useBackground": true,
    "downloadImages":true,
    "templateData": {
        "value": "a29J60iOHFQkrn01...JUVPRg0K",
     }
}

 

adjustFonts (Default: false)

If "true", then the font specifications "Arial", "Helvetica" and "Sans-Serif" in HTML documents and e-mails (which are based on HTML) are automatically replaced by the "Arial Unicode MS" font. The improves the appearance of the typeface in the PDF result.

 

baseURL (Default: "")

Used to define the URL used as a basis for all URLs in the HTML document that are not defined as absolute URLs.

 

downloadImages (default: false)

If “true”, then the images of an e-mail or an HTML document are downloaded automatically. This option could slow down the conversion considerably if there are many images contained or if, for example, e-mail documents are converted in which the images can no longer be invoked.

 

useAsTemplate (Default: false)

If "true", the HTML document will be interpreted as a template, i.e., the system will search for variables in the HTML and replace them with the data passed in "templateData". The document will not be converted to HTML format until after this step is completed. This means that by using the HTML document as a template together with passed data, you can obtain a dynamically generated PDF document.

 

useBackground (Default: true)

If "true", the background defined in the HTML document will be output in the PDF document as well. If "false", the background will be hidden.

 

 

templateData element

Contains the Base64-encoded JSON structure that is used as variables in the HTML template if "useAsTemplate" has a value of "true".

 

<templateData>a29J60iOHFQkrn01...JUVPRg0K</templateData>
 

"templateData": {
"value": "a29J60iOHFQkrn01...JUVPRg0K"
}

 

Example for data as JSON structure:

 

{
"page1": "Text for page 1",
"page2": "Text for page 2",
"page3": "Text for page 3",
"image": {
  "name": "Warning!",

  "data": "... BASE64 encoded image ..."
 }
}

 

Within the HTML document, the "custom." prefix will be prepended to each variable from the JSON structure. The variables can then be used as follows in the HTML code:

 

<body>
<div class="page">
  <h1>This is Page 1</h1>
  <i>${custom.page1}</i>
  <br>
   ${custom.image.name}<img src="${custom.image.data}" width="100" height="100"/>
</div>
<div class="page">
  <h1>This is Page 2</h1>
  <b>${custom.page2}</b>
</div>
<div class="page">
  <h1>This is Page 3</h1>
  <u>${custom.page3}</u>
</div>
...
</body>

 

For more information regarding the use of the templates, please refer to the "Templates" document.

 

 

mail element

 

These settings are only used for e-mail documents. The "MIME" (eml; RFC-822) and Outlook (msg) e-mail formats are supported.

 

<mail adjustFonts="true"
    attachmentMode="embed"
    downloadImages="true"

    useBackground="true"

    ignoreMissingBodyChunk="false"/>

"mail": {

  "adjustFonts": true,

  "attachmentMode": "embed",

  "downloadImages": true,

  "useBackground": true,

  "ignoreMissingBodyChunk": false
 }

 

adjustFonts (Default: false)

If "true", then the font specifications "Arial", "Helvetica" and "Sans-Serif" in HTML documents and e-mails (which are based on HTML) are automatically replaced by the "Arial Unicode MS" font. The improves the appearance of the typeface in the PDF result.

 

attachmentMode (default: embed)

Specifies the manner in which attachments are to be processed in e-mails.

embed = Embed in original format

remove = Remove attachments

convert = Converts the attachments to PDF format and embeds them as an attachment

convertMerge = Converts the attachments to PDF format and appends them as additional page(s) at the end

 

hint

If conversion to PDF format is not possible when using "convert" or "convertMerge”, the attachment will be embedded in its original format.

 

downloadImages (default: false)

If “true”, then the images of an e-mail or an HTML document are downloaded automatically. This option could slow down the conversion considerably if there are many images contained or if, for example, e-mail documents are converted in which the images can no longer be invoked.

 

ignoreMissingBodyChunk (default: false)

If this option is enabled, an error will not be triggered (the conversion will not be aborted) for e-mails if there is no body element in the file structure. However, this should not be confused with an e-mail not having any content.

 

useBackground (Default: true)

If "true", then a background defined in the e-mail (in the HTML content) is also output in the PDF document. If "false", the background will be hidden.

 

 

officeBridge element

 

Used to specify whether "Office Bridge" should be used when converting Word, Excel, and PowerPoint documents. If this element is set (and Office Bridge is enabled), the document will be converted using the Office software installed on the server.

 

<officeBridge/>

"officeBridge":{},

 

 

sharePointBridge element

 

Used to specify whether "SharePoint Bridge" should be used when converting a Word document. If the element is set, the Word document will be converted using the SharePoint service (if SharePoint Bridge is enabled).

 

<sharePointBridge/>

"sharePointBridge":{},  

 

 

page element

 

Used to define the page format for the output file. If this element is present, then any settings configured in the document (e.g., Word document) for the page will be overwritten. Please note that not all the documents that can be converted by webPDF support a page format.

 

<page bottom="20"
    height="297"
    left="20"
    right="20"
    metrics="mm"
    top="20"
    width="210"/>

"page":{
"bottom":20,

"height":297,
"left":20,
"right":20,
"metrics":"mm",
"top":20,
"width":210
},

 

bottom (default: 20)

top (default: 20)

left (default: 20)

right (default: 20)

Margin settings (in millimetres) for the output in PDF format.

 

height (default: 297)

Paper height (in millimetres) for the output in PDF format.

 

width (default: 210)

Paper width (in millimetres) for the output in PDF format.

 

metrics (default: "mm")

Unit for the arguments. As of this writing, the only option is "mm."

 

 

pdfa element

 

You can use the parameter structure described for the PDF/A service and insert it into the element.

 

<pdfa>
     ...
</pdfa>

"pdfa":{
     ...
},

 

hint

If this element is set, the "Pdfa" web service will be called automatically after the conversion.

 

 

signature element

 

You can use the parameter structure described for the signature service and insert it into the element.

 

<signature>
     ...
</signature>

"signature":{
     ...
},  

 

hint

If this element is set, the "Signature" web service will be called automatically after the conversion.

 

 

report element

 

Can be used to enable expanded error reporting for text-based documents (e.g., Word).

 

<report contentProblems="true"
      fontAliasUsage="true"
      fontIsMissing="true"/>

"report": {
"contentProblems": true,
"fontAliasUsage": true,
"fontIsMissing": true
}

 

contentProblems (default: false)

If "true", then an error (ERR_CONVERTER_CONTENT_PROBLEMS) is triggered if a problem occurs with a content item during the conversion. The following are among the problems:

- Unicode resolution of characters is not possible

- Vertical text elements

- Unsupported text effects

- Unsupported graphics compression

- Unsupported colour space

- Non-integrated sub-document that was not converted

- Tables with a “right-to-left” alignment in the content

- The document contains mathematical formulas

 

fontAliasUsage (default: false)

If "true", then an error (ERR_CONVERTER_FONT_ALIAS_USED) is triggered if a font was not found during conversion and in its place a substitute (alias) font was used.

 

fontIsMissing (default: false)

If "true", then an error (ERR_CONVERTER_FONT_IS_MISSING) is triggered if a font was not found during conversion.

 

 

template element

 

Can be used to define settings for file formats for which a template is required for conversion. As of this writing, these settings apply to the following file formats:

 

MIME mail (eml)

Outlook message (msg)

iCalendar (ics) / vCalendar (vcs)

vCard (vcf)

Serial Vector Format (svg)

Text document (txt)

 

In addition, you can replace the default template with a custom template of your own in "file". You can also use your own variables in this custom template. These variables would then need to be passed with a JSON structure (Base64-encoded) in "data".

 

<template language="de">
<file>a29J60iOHFQkrn01...JUVPRg0K</file>
 <data>a29J60iOHFQkrn01...JUVPRg0K</data>
</template>

"template": {
"language": "en"
}

 

language (default: "")

An ISO 639-1-compliant language code consisting of 2 letters. If there is one, a localized template will be selected using the language selected here. If not defined, the language in which webPDF is run will be used.

 

 

file element

 

The template is passed as Base64-encoded content in the "file" element. This template is HTML-based and can contain variables. For more information regarding the use of the templates, please refer to the "Templates" document.

 

 

data element

 

A Base64-encoded data structure can be passed in the "data" element so that it can be used in the template specified with the "file" element.

 

Example for data as JSON structure:

 

{
"page1": "Text for page 1",
"page2": "Text for page 2",
"page3": "Text for page 3",
"image": {
  "name": "Warning!",

  "data": "... BASE64 encoded image ..."
 }
}

 

Within the HTML document, the "custom." prefix will be prepended to each variable from the JSON structure. The variables can then be used as follows in the HTML code:

 

<body>
<div class="page">
  <h1>This is Page 1</h1>
  <i>${custom.page1}</i>
  <br>
   ${custom.image.name}<img src="${custom.image.data}" width="100" height="100"/>
</div>
<div class="page">
  <h1>This is Page 2</h1>
  <b>${custom.page2}</b>
</div>
<div class="page">
  <h1>This is Page 3</h1>
  <u>${custom.page3}</u>
</div>
...
</body>

 

For more information regarding the use of the templates, please refer to the "Templates" document.

 

 

text element

 

The settings are used in purely text-based files that can contain source code that would make syntax highlighting advisable. If you configure this element, the system will attempt, during conversion, to detect whether and in which programming/script language content is stored. Based on the result, it will then determine the type of highlighting (in the generated PDF document) is required.

SyntaxHighlighter and TextHighlighter are specified alternately. If the syntax highlighter is unable to determine whether the contents belong to any language it knows, the text highlighter will be used instead for formatting.

 

<text useSyntaxDetection="true">

 <syntaxHighlighter .../>

 <textHighlighter .../>
</text>

"text":{
    "useSyntaxDetection":true,
    "syntaxHighlighter":{...},

    "textHighlighter":{...},
   }

 

useSyntaxDetection (Default: false)

If this value is set to "true", syntax highlighting and language detection will be enabled.

 

 

syntaxHighlighter element

 

This element is used to configure language detection and the representation of syntax elements in recognized programming/script languages.

 

<syntaxHighlighter fontSize="12px"

                  fontOrigin="system"

                  fontFamily="Arial"

                  wordBreak="word"

                  lineNumbers="true"

                  lineHeight="12px"

                  language="java"

                  available="java,cpp"

                  relevance="100"/>

"text":{
    "fontSize":"12px",
    "fontOrigin":"system",

     "fontFamily":"Arial",

     "wordBreak":"word",

     "lineNumbers":true,

     "lineHeight":"12px",

     "language":"java",

     "available":"java,cpp",

     "relevance":100
   }

 

fontSize (Default: "10px")

Used to set the font size for syntax highlighting to the specified value.

You can use any of the following units:

px = Pixels

cm = Centimeters

mm = Millimetres

in = Inches

pt = Points

pc = Pica

 

fontOrigin (Default: "system")

Used to specify whether the selected font should be obtained from your operating system or from the "templates/fonts" folder (in your webPDF installation path).

Possible values:

system = It will be possible to select from the fonts available system-wide.

folder =It will be possible to select from the fonts in "templates/fonts".

 

fontFamily (Default: "")

Used to specify the font that should be used for syntax highlighting. If you select "folder" for the "fontOrigin" parameter, the font here needs to be specified with the filename for the file. Otherwise, use the name of the font you want. If the value is left blank, the "Fira Code" font will be used automatically.

 

wordBreak (Default: "auto")

Can be used to configure the word wrap behaviour during highlighting

Possible values:

auto = Automatic word wrap if necessary.

none = Suppress the addition of extra line breaks.

word = Line breaks allowed only after words.

all = Line breaks allowed unconditionally.

 

lineNumbers (Default: "true")

If this value is set to "true", line numbers are added before the code.

 

lineHeight (Default: "12px")

Used to set the line height. You can use any of the following units:

px = Pixels

cm = Centimeters

mm = Millimetres

in = Inches

pt = Points

pc = Pica

 

relevance (Default: "90")

The syntax highlighter evaluates the degree of reliability with which it recognizes a language with a value ranging from 0 to 1000 points. This value determines the reliability level starting from which it should highlight syntax for a recognized language. The higher the value, the more closely the content found must match the criteria.

 

language (Default: "")

Used to select a specific language for syntax highlighter recognition. You can select one of the languages listed for the "available" parameter. If you do not set this value, the system will attempt to automatically select an appropriate language from the list of available languages.

 

available (Default: "")

Can be used to specify the languages to which the syntax highlighted should be limited. You can enter multiple languages by separating them with a comma ("java,cpp"). If you do not specify a value, all the languages listed below will be recognized.

You can select any of the following languages:

abnf = Augmented Backus-Naur form

 accesslog = Apache/Nginx Access Logs

 actionscript = ActionScript

 ada = Ada

 angelscript = AngelScript
 apache = Apache configuration language

 applescript = AppleScript

 arcade = ArcGIS Arcade

 arduino = Arduino

 armasm = ARM Assembly

 asciidoc = AsciiDoc

 aspectj = AspectJ

 autohotkey = AutoHotkey

 autoit = AutoIt

 avrasm = AVR Assembler

 awk = Awk

 axapta = Axapta

 bash = Bash

 basic = Basic

 bnf = Backus-Naur Form

 brainfuck = Brainfuck

 cal = C/AL

 capnproto = Cap'n Proto

 ceylon = Ceylon

 clean = Clean

 clojure-repl = Clojure REPL

 clojure = Clojure

 cmake = CMake

 coffeescript = CoffeeScript

 coq = Coq

 cos = Caché Object Script

 cpp = C++

 crmsh = crmsh

 crystal = Crystal

 cs = C#

 csp = CSP

 css = CSS

 d = D

 dart = Dart

 delphi = Delphi

 diff = Diff

 django = Django

 dns = DNS Zone file

 dockerfile = Dockerfile

 dos = DOS .bat

 dsconfig = dsconfig

 dts = Device Tree

 dust = Dust

 ebnf = Extended Backus-Naur Form

 elixir = Elixir

 elm = Elm

 erb = Embedded Ruby

 erlang-repl = Erlang REPL

 erlang = Erlang

 excel = Excel

 fix = FIX

 flix = FLIX

 fortran = Fortran

 fsharp = F#

 gams = GAMS

 gauss = GAUSS

 gcode = G-code

 gherkin = Gherkin

 glsl = GLSL

 gml = GML

 go = Go

 golo = Golo

 gradle = Gradle

 groovy = Groovy

 haml = Haml

 arduino = Arduino

 handlebars = Handlebars

 haskell = Haskell

 haxe = Haxe

 hsp = HSP

 htmlbars = HTMLBars

 http = HTTP

 hy = Hy

 inform7 = Inform 7

 arduino = Ini, TOML

 irpf90 = IRPF90

 isbl = ISBL

 java = Java

 javascript = Javascript

 jboss-cli = jboss-cli

 json = JSON

 julia-repl = Julia REPL

 julia = Julia

 kotlin = Kotlin

 lasso = Lasso

 ldif = LDIF

 leaf = Leaf

 less = Less

 lisp = Lisp

 livecodeserver = LiveCode

 livescript = LiveScript

 llvm = LLVM IR

 lsl = Linden Scripting Language

 lua = Lua

 makefile = Makefile

 markdown = Markdown

 mathematica = Mathematica

 matlab = Matlab

 maxima = Maxima

 mel = MEL

 mercury = Mercury

 mipsasm = MIPS Assembly

 mizar = Mizar

 mojolicious = Mojolicious

 monkey = Monkey

 moonscript = MoonScript

 n1ql = N1QL

 nginx = Nginx

 nimrod = Nimrod

 nix = Nix

 nsis = NSIS

 objectivec = Objective-C

 ocaml = OCaml

 openscad = OpenSCAD

 oxygene = Oxygene

 parser3 = Parser3

 perl = Perl

 pf = pf

 pgsql = PostgreSQL

 php = PHP

 plaintext = plaintext

 pony = Pony

 powershell = PowerShell

 processing = Processing

 profile = Python profile

 prolog = Prolog

 properties = Properties

 protobuf = Protocol Buffers

 puppet = Puppet

 purebasic = PureBASIC

 python = Python

 q = Q

 qml = QML

 r = R

 reasonml = ReasonML

 rib = RenderMan RIB

 roboconf = Roboconf

 routeros = Microtik RouterOS Script

 rsl = RenderMan RSL

 ruby = Ruby

 ruleslanguage = Oracle Rules Language

 rust = Rust

 sas = SAS

 scala = Scala

 scheme = Scheme

 scilab = Scilab

 scss = SCSS

 shell = Shell Session

 smali = Smali

 smalltalk = Smalltalk

 sml = SML

 sqf = SQF

 sql = SQL

 stan = Stan

 stata = Stata

 step21 = Step Part 21

 stylus = Stylus
 subunit = SubUnit

 swift = Swift

 taggerscript = Tagger Script

 tap = Test Anything Protocol

 tcl = Tcl

 tex = TeX

 thrift = Thrift

 tp = TP

 twig = Twig

 typescript = TypeScript

 vala = Vala

 vbnet = VB.NET

 vbscript-html = VBScript in HTML

 vbscript = VBScript

 verilog = Verilog

 vhdl = VHDL

 vim = Vim Script

 x86asm = Intel x86 Assembly

 xl = XL

 xml = XML

 xquery = XQuery

 yaml = YAML

 zephir = Zephir

 

 

textHighlighter element

 

This element is used to configure the display of contents for which the syntax highlighter was unable to identify a known language.

 

<syntaxHighlighter fontSize="12px"

                  fontOrigin="system"

                  fontFamily="Arial"

                  wordBreak="word"

                  lineNumbers="true"

                  lineHeight="12px"

                  color="#FFFFFF"/>

"text":{
    "fontSize":"12px",
    "fontOrigin":"system",

     "fontFamily":"Arial",

     "wordBreak":"word",

     "lineNumbers":true,

     "lineHeight":"12px",

     "color":"#FFFFFF"
   }

 

fontSize (Default: "10px")

Used to set the font size for the text to the specified value.

You can use any of the following units:

px = Pixels

cm = Centimeters

mm = Millimetres

in = Inches

pt = Points

pc = Pica

 

fontOrigin (Default: "system")

Used to specify whether the selected font should be obtained from your operating system or from the "templates/fonts" folder (in your webPDF installation path).

Possible values:

system = It will be possible to select from the fonts available system-wide.

folder =It will be possible to select from the fonts in "templates/fonts".

 

fontFamily (Default: "")

Specifies the font to use for the text. If you select "folder" for the "fontOrigin" parameter, the font here needs to be specified with the filename for the file. Otherwise, use the name of the font you want. If the value is left blank, the "SourceHanSans" font will be used automatically.

 

wordBreak (Default: "auto")

Can be used to configure the word wrap behaviour during highlighting

Possible values:

auto = Automatic word wrap if necessary.

none = Suppress the addition of extra line breaks.

word = Line breaks allowed only after words.

all = Line breaks allowed unconditionally.

 

lineNumbers (Default: "true")

If this value is set to "true", line numbers are added before the code.

 

lineHeight (Default: "12px")

Used to set the line height. You can use any of the following units:

px = Pixels

cm = Centimeters

mm = Millimetres

in = Inches

pt = Points

pc = Pica

 

color (Default: "#000000")

Sets the font color for the text to the given value. The colour needs to be specified as a hexadecimal RGB value with a number sign before it.