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

How to Resolve Error Rendering Page: Missing Font

When rendering a PDF document in the following Qoppa’s PDF library products: jPDFImages, jPDFPrint, jPDFProcess, jPDFViewer, jPDFNotes or jPDFEditor, you might encounter a blank page with an “Error Rendering Page” displayed in red on a page. This error happens when there is an issue with a font within the PDF document. There are 2 possible […]

Read More

Fill / Populate XFA Dynamic Form with Field Data in Java

Here is a sample Java program that can load a dynamic XFA form, fill in data from an XDP or XML file and then saved the filled form. This sample is using Qoppa’s PDF library jPDFFields. It could be simply adapted to use jPDFProcess library by replacing PDFFields with PDFDocument. import com.qoppa.pdfFields.PDFFields;   public class […]

Read More

Copying pages from one PDF to another PDF in Java

Here is a sample Java program that shows how to copy pages from one PDF document to another using Qoppa’s PDF library jPDFProcess. The sample can be adapted to work with Qoppa’s jPDFAssemble by simply replacing the class “PDFDocument” with “PDFAssemble”. In this sample, we’re copying the pages from an existing PDF to a new […]

Read More

Export PDF to PNG Image with Overprint Simulation

This Java sample below shows how to use Qoppa’s jPDFImages (or jPDFProcess) to load a PDF and export it to an image in PNG format with overprint simulation on. First, the image is rendered in CMYK profile, then converted to RGB using ColorConvertOp and finally saved as PNG (or JPEG). The resolution is set at […]

Read More

On using Java RenderingHints to smooth jagged edges on rotated images

Q: There seems to be some pixelation or resolution issue when rendering specific images in a PDF brochure. Is there anything that can be done to render these images more smoothly? A: Qoppa’s PDF libraries and components uses our own interpolation algorithm that works much better than the built-in Java algorithm well both when up-sampling […]

Read More

List of Supported JavaScript Actions in Qoppa PDF Components

Here is the list of supported actions in Qoppa’s PDF Library and Component Products. The table below lists the JavaScript actions, where they live in the PDF document and if they are supported or not.   Parent Dictionary Entry Supported/Unsupported Document Level: Names (in the Catalog dictionary) JavaScript Supported Catalog OpenAction Supported AA (additional actions […]

Read More

List of Supported JavaScript Objects / Methods / Properties in Qoppa PDF Components

Here is a list of all objects, methods and properties supported in Qoppa’s PDF Library and Component Products. This list was compiled for v2016R1. App Methods: alert beep openDoc popUpMenu popUpMenuEx response setTimeOut trustedFunction Properties: formsVersion viewerType viewerVersion Color Methods: equal Properties: black blue cyan dkGray gray green ltGray magenta red transparent white yellow Console […]

Read More

Extract Images from PDF Document using Java

Q: How can I export all the images contained in a PDF document? A: Here is a sample Java code to list all images embedded in a PDF document and save / export them using Qoppa’s jPDFProcess library. This example shows how to save the images in png format but it can simply be changed […]

Read More

List Resource Fonts in a PDF document

Q: How can I list all the resource fonts in a PDF document? A: Here is a sample Java code to list all fonts referenced in a PDF document using Qoppa’s jPDFProcess library. Some fonts may only be referenced by name and other fonts may be embedded in the document. In version v2016R1, a new […]

Read More

Rotate Pages in a PDF document using Java

This Java sample code will open a PDF and rotate each page of the document by a 180 degrees. It then prints and saved the rotated PDF document to a different file. This sample uses jPDFProcess, Qoppa’s Java PDF library to manipulate PDF documents. package jPDFProcessSamples;   import com.qoppa.pdf.PrintSettings; import com.qoppa.pdfProcess.PDFDocument; import com.qoppa.pdfProcess.PDFPage;   public […]

Read More

Create and add PDF annotations to a PDF document with jPDFProcess

Here is a sample Java program showing how to create and add annotations such as square, rubber stamp, typewriter, callout and free text to a PDF document using Qoppa’s PDF library jPDFProcess. The annotations are added to the first page of a PDF document. A first PDF is saved with all the annotations and a […]

Read More

Invalid CMAP name when rendering or printing a PDF page

Q: When opening a PDF file, I get the following error: A: You are missing cmaps.jar in your classpath which contains CMaps, used to read and display character encodings used with CJK (Chinese, Japanese, Korean) content. Download cmaps.jar   This error can happen when rendering PDF documents in Qoppa’s PDF components (jPDFViewer, jPDFNotes, jPDFEditor) or […]

Read More

Staple and Duplex options when printing PDF in Java

Q: Is it possible to specify staple & duplex options on a per-document basis with jPDFPrint? A: Yes, it is:  Java supports setting print job attributes for each print job, this is done through PrintRequestAttribute objects. jPDFPrint supports passing these attributes through. The attributes that you want to use are: javax.print.attribute.Finishings.STAPLEjavax.print.attribute.Finishings.STAPLE and javax.print.attribute.Sides.DUPLEXjavax.print.attribute.Sides.DUPLEX Here is a sample […]

Read More

Getting interactive field location information (bounds and page number)

To get PDF interactive form fields location information (including signature fields) such as dimension and page number, you will need to access the widget which is the visual representation of the field on the page. When using Qoppa’s PDF components (jPDFViewer, jPDFNotes, jPDFEditor), you can get information from the editing component. // get Acroform AcroForm […]

Read More

Adding custom properties to PDF digital signatures

Q: Is it possible to set custom properties to digital signatures using Qoppa’s PDF SDK? A: Yes, it is possible to do so using jPDFSecure, jPDFProcess or qPDF Toolkit. Adding custom property to the signature dictionary This method can be used to add additional custom properties to the signature dictionary. SigningInformation.setCustomProperty(key, value);SigningInformation.setCustomProperty(key, value); You can […]

Read More

How to hide the validation icon on signed digital signature fields

Q: Is there a way to turn off digital signature validity when rendering a PDF page in Qoppa’s PDF components and libraries? Our application will perform our own internal signature validation. A: Yes, it is possible by simply making a call to the following static method (before loading the signed PDF): PDFRenderHints.setRenderSignatureVerification(false);PDFRenderHints.setRenderSignatureVerification(false); This method sets […]

Read More