New in PD4ML v4.1.0


In version PD4ML v4.1.0 the product has been improved in the following areas:

  • Security – AES-128 is used as the default encryption method
     
  • PDF Standards conformance – allows you to specify the required PDF standard compliance. See: Compliance with PDF standards
     
  • XML invoicing support – simplifies the creation of XML invoices that comply with the hybrid electronic invoicing standards. See: ZUGFeRD and Factur-X PDF Invoices generation
     
  • Error policies – You can now specify how errors are handled: either ignore them or throw an exception at the caller level. Four policies can be defined: RELAXED (default; ignore all errors where possible), NORMAL (throw an exception on error), PEDANTIC (treat potential PDF/A and PDF/UA incompatibility as an error and throw an exception), and STRICT (throw an exception even on warnings, such as if the specified font cannot display some text and a fallback font is required).
     

Compliance with PDF standards


PD4ML v4.1.0 introduces a new API method, pd4ml.writePDF(OutputStream, PdfSpec), which allows you to specify the required PDF standard compliance level.

Available options:

  • PDF1.4PdfSpec.PDF_1_4 – Acrobat 5
  • PDF1.5PdfSpec.PDF_1_5 – Acrobat 6
  • PDF1.6PdfSpec.PDF_1_6 – Acrobat 7
  • PDF1.7PdfSpec.PDF_1_7 – Acrobat 8 / ISO 3200-1
  • PDF1.7ext1PdfSpec.PDF_1_7_1
  • PDF1.7ext2PdfSpec.PDF_1_7_2
  • PDF1.7ext3PdfSpec.PDF_1_7_3 – Acrobat 9
  • PDF1.7ext4PdfSpec.PDF_1_7_4
  • PDF1.7ext5PdfSpec.PDF_1_7_5
  • PDF1.7ext6PdfSpec.PDF_1_7_6
  • PDF1.7ext7PdfSpec.PDF_1_7_7
  • PDF1.7ext8PdfSpec.PDF_1_7_8 – Acrobat X
  • PDF1.7ext9PdfSpec.PDF_1_7_9
  • PDF1.7ext10PdfSpec.PDF_1_7_10
  • PDF1.7ext11PdfSpec.PDF_1_7_11 – Acrobat XI
  • PDF2.0PdfSpec.PDF_2_0

The PdfSpec parameter can be combined with one of PDF/A modifiers

  • PDF/A-1a:2005PdfSpec.PDFA_1A
  • PDF/A-1b:2005PdfSpec.PDFA_1B
  • PDF/A-2aPdfSpec.PDFA_2A
  • PDF/A-2bPdfSpec.PDFA_2B
  • PDF/A-2uPdfSpec.PDFA_2U
  • PDF/A-3aPdfSpec.PDFA_3A
  • PDF/A-3bPdfSpec.PDFA_3B
  • PDF/A-3uPdfSpec.PDFA_3U
  • PDF/A-4PdfSpec.PDFA_4 – requires PDF2.0
  • PDF/A-4ePdfSpec.PDFA_4E – requires PDF2.0

The combining can be done as follows:

    pd4ml.writePDF(os, PdfSpec.PDFA_3B); // implicitly adds PDF1.7 conformance
    pd4ml.writePDF(os, PdfSpec.PDF_1_7_8.combine(PdfSpec.PDFA_3B));

And also PDF or PDF/A-a can be combined with PDF/UA

  • PDF/UA-1PdfSpec.PDFUA_1
  • PDF/UA-2PdfSpec.PDFUA_2 – requires PDF2.0

Examples:

    pd4ml.writePDF(os, PdfSpec.PDFUA_1); // implicitly adds PDF1.7 conformance
    pd4ml.writePDF(os, PdfSpec.PDF_1_7_8.combine(PdfSpec.PDFUA_1));
    pd4ml.writePDF(os, PdfSpec.PDF_1_7_11.combine(PdfSpec.PDFA_3A).combine(PdfSpec.PDFUA_1));

There are also several predefined constants that combine PDF standards as required by XML invoicing specs:

  • ZUGFeRDPdfSpec.ZUGFeRD, which is PdfSpec.PDF_1_7.combine(PdfSpec.PDFA_3B)
  • ZUGFeRD (tagged)PdfSpec.ZUGFeRD_a, which is PdfSpec.PDF_1_7.combine(PdfSpec.PDFA_3A)
  • Factur-XPdfSpec.FacturX, which is PdfSpec.PDF_1_7.combine(PdfSpec.PDFA_3B)
  • Factur-X (tagged)PdfSpec.FacturX_a, which is PdfSpec.PDF_1_7.combine(PdfSpec.PDFA_3A)

 

NOTE: Not all the standards can be combined with each other. PdfSpec.combine() throws PdfSpecViolationException and PdfSpecUnsupportedException in incompatibility cases.

ZUGFeRD and Factur-X PDF Invoices generation support


Starting with version v4.1.0, PD4ML DMS and PD4ML UA support PDF/A-3b format and embedding XML invoices into PDF files.

Now, it’s possible to combine both the document’s visual human-readable presentation and its ZUGFeRD/Factur-X XML machine-readable data in a single HTML template. The HTML template can either be completely generated on the fly by the host applicaion, or a static pre-prepared template marked with placeholders can be populated with dynamic data using PD4ML.

Read more: ZUGFeRD and Factur-X PDF Invoices generation

Creating DOCX Files


v4.0.19 introduces support for creating OOXML (DOCX) files from HTML.

It is already functionally superior to the long-standing PD4ML HTML to RTF converter. It allows you to define text and paragraph styles, nested tables, ordered and unordered lists, headers and footers, table of contents, hyperlinks, bookmarks, borders, backgrounds, and embed images.

To force DOCX output you only need to trigger pd4ml.writeDOCX() API method instead of pd4ml.writePDF() in usual conversion scenarios.

The converter is available under the PD4ML DMS or PD4ML UA license.

Read more: https://pd4ml.com/creation-of-ooxml-docx-documents/

PD4ML Fonts Tool


To simplify the creation of font mapping files, PD4ML v4.0.16 introduces a handy tool. The tool is implemented as an utility of the interactive PD4ML Converter

How to use it

Run the converter, as described by the link /support-topics/pd4ml-v4-programmers-manual/ and click the [Fonts Tool] button on the status bar of the application window.

It will prompt you for the location of the font directory. Select a directory. We can start with system fonts like C:\Windows\Fonts

Because the system font directory contains an excessive number of fonts that your application doesn’t really need, you can filter them out by entering a comma-separated list of font name patterns in the input field next to the “Filter by Font File Name” button. Apply the filter by pressing the button. The resulting list will include only those fonts whose filenames case-insensitively match the given patterns.

The generated list is editable, so you can manually refine it.

At this point you have four options:

  • Close – is obvious: close the tool and lose the current font mapping configuration
  • Use – use the font configuration only in the current session of the PD4ML Converter, without saving it.
  • Save Mapping File – creates a pd4fonts.properties file that can later be referenced from your application with pd4ml.useTTF() API call. If the chosen mapping file location is different from the original font directory (which is a good idea if you are using the system font directory), pd4fonts.properties will include a link to the font dir, allowing PD4ML to find the actual font files.
  • Save as JAR – packages the listed fonts and the corresponding pd4fonts.properties into a JAR file. Fonts are stored in the “pdffonts” JAR subdirectory by default, so once the JAR is deployed with a PD4ML-enabled application, the font configuration can be referenced with pd4ml.useTTF("java:pdffonts") API call. The subdirectory name can be customized by uncommenting and setting the jar.folder=pdffonts property.

Apache Batik SVG plugin control


PD4ML implements its own basic SVG renderer, and also allows you to use third-party libraries for the task. If it finds Apache Batik SVG Toolkit among the available libraries, it will automatically switch to it.

Batik tries to implement most of the features of SVG. But, unfortunately, it is very sensitive to even minor file format errors, and there is no way to change its error policy: it always throws exceptions, and there is no switch to turn them into warnings, for example.

In such cases, the best workaround would be to disable Batik and let the built-in SVG engine do the rendering.

Java code to disable Batik:

com.pd4ml.plugins.BatikSvgCustomTag.disable = true;

Disable in pd4browser.properties:

svg.batik=false

CSS Flexible Box Layout support added


PD4ML v4.0.6 introduces flexbox layout support.

Children of a flex container can “flex” their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent. Both horizontal and vertical alignment of the children is supported.

Automatic Font Kerning Support


PD4ML v4.0.4 introduces optional font kerning support. Kerning is an addition or reduction of space between two characters (glyphs) of a proportional font. As a rule a rendered text is visually much more pleasing when the kerning is applied.

PD4ML uses kerning pairs info from TTF/OTF fonts (if available). For the standard built-in Type1 fonts the kerning info is known and included to PD4ML product itself.

The feature is also implemented in our older development branch v3.11.0 due to its importance

RTF Output Performance


The recent PD4ML builds (both v3 and v4) refactor RTF output logic to improve conversion performance by bulky input HTML documents.

Now, even in extreme situations, the performance is comparable with PDF output and very often outperforms it.