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 […]
Category: jPDFProcess: Create/Manipulate PDFs
Developer library to create, print and manipulate PDF documents in Java. This library encompasses the functionality found in most of our other libraries.
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 […]
Determine if text search occurrences in a PDF are visible on the displayed page / within the cropbox
As of v2017R1, the text position objects returned when searching text through a PDF document using Qoppa PDF library jPDFProcess (using PDFPage.findText() method), are given in cropbox coordinates (i.e in view or display coordinates when the page is displayed on the screen). For most PDF documents, media box and crop box are the same. But […]
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
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() […]
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 […]
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, […]
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 […]
Add a PAdES signature to a PDF document using Java library jPDFSecure, jPDFProcess
PDF 2.0 defines a new filter (Adobe.PPKLite) and sub-filter (ETSI.CAdES.detached) for PAdES signatures, which are compliant with the European eIDAS regulation. Support for PAdES was added in v2017R1 of Qoppa’s Java PDF libraries. This sample shows how to add a PAdES signature to a PDF document using Qoppa’s Java PDF library jPDFSecure. It is easy […]
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 = […]
How to resize pages in a PDF document with Java library jPDFProcess
Starting with v2017R1, Qoppa Java PDF library jPDFProcess offers an API to easily resize or change page sizes in a PDF document. The resize options are as follow: Media Box – new media box for the PDF Page. Center – option to center the page contents in the new media box (off by default) Auto […]
Error handling versus exception thrown when rendering PDF pages in jPDFImages and jPDFPrint
When rendering pages in a PDF document, jPDFPrint and jPDFImages may run into errors. In this case, the libraries will render the page with a red X drawn across the page, together with a message explaining what failed, such as “Error Handling Page: Missing Font”. Customers can choose to throw an exception instead, if they […]
jai image jars are not loading on some J2EE servers (need to scan for plugins)
Q: Even after adding the jai_imageio.jar and jai_codec.jar in the classpath, I am still getting an error when trying to save as Tiff and getting the “No TIFF Writers Available” exception. Any idea? A: There are some J2EE servers (such as Websphere?) that do not find ImageIO plugins automatically. Try any of the 2 calls […]
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 * […]
Two ways to add a barcode to a PDF document in Java using jPDFProcess
You can add barcodes to PDF documents with jPDFProcess in a couple of ways: You can use a barcode font, a font whose characters look like the barcode, and then add text to the document using this font. When the document is displayed, it will show the barcode (drawn using the font), and will have […]
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 […]
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, […]
Create a PDF with a page and draw text and image on it using jPDFProcess
Sample program showing how to create a PDF using jPDFProcess. You first create a PDF, add a page to it then use the Graphics object form the page to draw onto it. On the page we draw text and an image. In this little snippet, the compression used for the image within the PDF document […]
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 […]
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 […]
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 […]
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 […]
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 […]
Setting / Editing PDF Document Properties & Metadata including Title, Subject, Author, Keywords
After creating or assembling a PDF document, it is a important to set or edit the meta data. Qoppa Java libraries jPDFAssemble and jPDFProcess can edit document properties and xml metadata such as title, author, subject and keywords. The sample java code below shows how to open a PDF, edit the document properties and then […]
Code Sample: Add Redaction Annotation to PDF, Export to XFDF, Import from XFDF
Here is a sample java program showing how to add a redaction annotation to a PDF document, export them as xfdf and then re-import them into another PDF document using Qoppa library jPDFProcess. // create a new PDF and append a page to it PDFDocument doc1 = new PDFDocument(); PDFPage page1 = doc1.appendNewPage(72 * 8.5, […]
Sample Java program to add layers to a PDF and add content onto the layers using jPDFProcess
Sample Java program showing how to add layers to a PDF document and to draw content on the new layers. jPDFProcess can draw onto new or existing layers, on new or existing documents / pages. // Create a new document PDFDocument pdf = new PDFDocument(); // Add a blank page to the document PDFPage […]
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 […]
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 […]
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); […]