How to add a ZUGFeRD invoice to a PDF document in Java using jPDFProcess

As of v2017R1.04, Qoppa’s Java PDF library jPDFProcess supports adding an electronic invoice in ZUGFeRD format to a PDF document as an XML file attachment or embedded file. Sample Java program showing how to attach an XML ZUGFeRD invoice to a PDF document using jPDFProcess: // Load the PDF document PDFDocument pdfDoc = new PDFDocument […]

Read More

Difference between PKCS11 and PKCS12

Though the names are very similar, PCKS11 and PKCS12 are actually defining 2 very different things and this can create some confusion. PKCS11 is a protocol used to access hardware encryption devices such as USB tokens, smart card or vaults (such as Azure Vault). Keystore API in Java allows to abstract access to the PKCS11 […]

Read More

OCR Languages Download Links

OCR Language Download Links Required Data File for All Languages      Orientation and script detection Common Languages      English – English      French – Français      German – Deutsch      Spanish – Español      Italian – Italiano      Chinese (Simplified)  – 中文简体中文      Chinese (Traditional)  – 中文繁體 All Other Languages – This file contains all the languages available (large file)      tessdata_fast.zip

Read More

Retrieving signature information from a signed PDF

This java sample program shows how to open a signed PDF and retrieve signature information from it such as signer’s name, sign reason, location, date, etc…. This sample uses Qoppa’s Java PDF Library jPDFSecure but can be easily changed to use jPDFProcess. // Load the signed document PDFSecure pdfDoc = new PDFSecure ("C:\\test\\output.pdf", null); if(pdfDoc.getSignatureFields() […]

Read More

Signing a PDF with a p12 file in Java

This is a sample java program showing how to sign a PDF document using a certificate loaded from a p12 file. The signature appearance is customized with an image, signer’s name and date. A signature field is added to the PDF document and then signed. This code uses jPDFSecure library but could very easily be adapted […]

Read More

Getting info for IRT Annotations: Reply to Annotations / Group Annotations

This sample code shows how to get property information about reply to or grouped annotations annotations added to a PDF document. This functionality was open in the public API in v2017R1.1 in jPDFProcess library. PDFPage p = pdfDoc.getPage(i); Vector annots = p.getAnnotations(); if(annots != null) { for(int count = 0; count < annots.size(); count++) { […]

Read More

Digital signatures and PDF/A compliance

Converting to PDF/A an existing Signed Document It is not possible to convert an existing PDF document that is already signed to PDF/A. This is because any changes that you make to a PDF even if it’s only adding PDF/A tags information in the metadata would invalidate the signature. If your PDF is already signed, […]

Read More

Setting Page Labels in a PDF document

With version v2017R1, jPDFProcess API has a new function to set page labels in a PDF documents. Look at the method called setPageLabels in the PDFDocument class. setPageLabels(int[] indices, String prefix, String style, int offset) throws PDFException Sets a page label to identify each page visually on the screen or in print. Consecutive pages create a labeling range using […]

Read More

Imposition of PDF pages using Java library jPDFProcess

This sample will open an existing PDF document, reorganize pages by putting 4 pages of any size onto one single page in letter format (8.5 x 11) and save them as a new PDF document. The pages are organized sequentially in 2 columns and 2 rows, called a sequential imposition layout. // Load document PDFDocument srcDoc = […]

Read More

Embed a font in a PDF and write text content with the new font

This little sample code shows how to add a font to a PDF document and than add some text content to the PDF using this newly embedded font, using Qoppa’s PDF library jPDFProcess. // Create a blank document and add a page PDFDocument pdf = new PDFDocument(); PDFPage newPage = pdf.appendNewPage(8.5 * 72, 11 * […]

Read More

Create, Merge and Convert PDF documents with Mule in an automated Worklow

Qoppa’s Java PDF libraries can be used within Mule ESB to automate PDF document processes within a workflow. PDF files can be transmitted as an input stream to any of our Java libraries. Follow the detailed steps showing how to integrate Qoppa’s PDF library jPDFProcess within a Mule flow. The following PDF functions available in […]

Read More

Invalid colors for CMYK images when cmykProfile.jar missing in classpath

Update: As of version v2019R1, cmykProfile.jar is now packaged inside Qoppa’s library jars and no longer requires to be added to the classpath. When rendering or optimizing images with a CMYK color space (DeviceCMYK), Qoppa’s PDF libraries and components need the cmykProfile.jar to be present in the classpath. If you forget to include this jar, […]

Read More

Clear and delete signature fields in a PDF document using Java

This is sample Java program showing how to clear and delete signature fields in a PDF using Qoppa’s PDF library jPDFProcess. The jPDFProcess’ public API does not give a direct access to deleting fields in a PDF, but when deleting widgets which are the annotation associated with a field on a PDF page, it will […]

Read More

Search Text and Add Text Highlights & Markups in a PDF document

This java sample shows how to search text in a PDF and add text highlights or text markup annotations (underline, strikeout, squiggly) on top of the text using Qoppa’s PDF library jPDFProcess. // Open the document PDFDocument inDoc = new PDFDocument ("c:/input.pdf", null);   // Loop through the pages, searching for text for (int pageIx […]

Read More

Filling field data in a PDF form programmatically with Java

To fill in the fields with data, you can use the getField() method to get a field by field name and then use the setValue() method to set the data. To set values in combo boxes and list fields, use values from the field’s export options and not the display options. To save the PDF […]

Read More

Search text in a PDF and add hyperlinks on top of the text found

This Java sample shows how to search text in a PDF document and add link annotations (that go to a specific URL) on top of the text occurrences found. This sample uses Qoppa’s PDF library jPDFProcess. // Load the document PDFDocument pdfDoc = new PDFDocument ("C:\\myfolder\\input.pdf", null);   // this is my search label that […]

Read More

Search Labels and Redact Text in a PDF

This Java sample shows how to search a text label within a PDF document and then remove the text following that label. This is done by adding a redaction annotation and burning it which remove any content below the redaction annotation. This sample is using Qoppa’s PDF library jPDProcess In the sample code below, we’re […]

Read More

Deleting all bookmarks from a PDF document

To delete all bookmarks in a PDF document, simply create a new empty root bookmark. With jPDFProcess, use PDFDocument.createRootBookmark(); With jPDFAssemble, use PDFAssemble.createRootBookmark(); With jPDFEditor, use PDFEditorBean.getDocument().createRootBookmark(); Here is sample code to do so: // Load the document PDFDocument pdfDoc = new PDFDocument ("input.pdf", null); // Get the root bookmark, create one if necessary Bookmark […]

Read More

Clear Password and Permissions in a PDF document

It is possible to clear permissions and passwords in a PDF document using several of Qoppa’s Java PDF libraries and components. With jPDFSecure, use PDFSecure.clearPasswordPermissions() With jPDFProcess, use PDFDocument.clearPasswordPermissions() With jPDFEditor, use PDFEditorBean.getDocument().clearPasswordPermissions() Calling PDFSecure.clearPasswordPermissions will clear all password permissions for this document: it will reset all password permissions to true. it will clear open/user […]

Read More

Changing PDF Document Permissions and Passwords

It is possible to set / update permissions and passwords in a PDF document using several of Qoppa’s Java PDF libraries and components. Call to change document permissions and passwords depending on which Qoppa library you use:   // with jPDFSecure PDFSecure.setPasswordPermissions(newPermPwd, newOpenPwd, permissions, currentPermPwd, encryptType);   // with jPDFProcess PDFDocument.setPasswordPermissions(newPermPwd, newOpenPwd, permissions, currentPermPwd, encryptType); […]

Read More