Code Sample: Print a PDF document in Java using jPDFProcess

A simple Java program that prints a PDF document using Qoppa’s PDF library jPDFProcess. // Load document PDFDocument pdfDoc = new PDFDocument ("input.pdf", null);   // Print the document pdfDoc.print("my printer", null);// Load document PDFDocument pdfDoc = new PDFDocument ("input.pdf", null); // Print the document pdfDoc.print("my printer", null); Download Full Java Sample to Print PDF in […]

Read More

Code Sample: Getting links from a PDF

Links are saved as part of the annotations in a PDF document even though they are not really considered annotations. Links in a PDF document do not specifically have a destination.  Instead, they are more general, they hold a list of actions that can really be anything. We define actions that we support in the com.qoppa.android.pdfViewer.actions […]

Read More

Code Sample: Flatten PDF Interactive Form Fields in Java

This Java program “flattens” field data into the PDF content layer using Qoppa’s PDF library jPDFProcess. This means that the field contents will become part of the PDF content and so the document will not be editable anymore. Click here to view java code. jPDFProcess supports many PDF functions to work with PDF documents within Java. […]

Read More

Code Sample: Create PDF with embedded files

This java program create a single page PDF document and adds 3 embedded files within the PDF document as file attachments usinghttp://www.qoppa.com/files/pdfprocess. http://www.qoppa.com/pdfprocess/guide/sourcesamples/FileAttachments.java

Read More

Code Sample: Convert PDF to Tiff in Java

This Java program converts a PDF file to a multi-page TIFF file using Qoppa’s library jPDFProcess. package jPDFProcessSamples; import java.io.FileOutputStream; import com.qoppa.pdf.TIFFOptions; import com.qoppa.pdfProcess.PDFDocument; public class PDFToTIFF { public static void main (String [] args) { try { PDFDocument pdfDoc = new PDFDocument ("input.pdf", null); TIFFOptions options = new TIFFOptions (150, TIFFOptions.TIFF_PACKBITS); FileOutputStream outStream = […]

Read More

Code Sample: Add watermark to PDF document in Java

This Java program adds a semi-transparent watermark to a PDF document using Qoppa’s library jPDFProcess. You can change the watermark string, the font and size, the color, the location (x, y) and the rotation. // Load PDF document PDFDocument pdfDoc = new PDFDocument ("input.pdf", null);   // Font is Helvetica 64 Font wmFont = PDFGraphics.HELVETICA.deriveFont(64f);   […]

Read More

Code Sample: Add a bookmark for every page of a PDF document with java

This Java programs adds a bookmark for every page in a PDF document using Qoppa’s library jPDFProcess. // Load the document PDFDocument pdfDoc = new PDFDocument ("input.pdf", null);   // Get the root bookmark, create one if necessary Bookmark rootBK = pdfDoc.getRootBookmark(); if (rootBK == null) { rootBK = pdfDoc.createRootBookmark (); }   // Add a […]

Read More

Code Sample: Add PDF Bookmarks

Working with Bookmarks jPDFAssemble and jPDFProcess allow to create new bookmarks or manipulate existing bookmarks in PDF documents. Here is an example on how to add bookmarks for each page of a PDF document: // Get current bookmark root Bookmark rootBK = pdfDoc.getRootBookmark();   // Create a root bookmark if it’s null if(rootBK == null) { rootBK = […]

Read More

Java PDF OCR library sdk

Qoppa offers a PDF OCR solution for Java which supports most languages, including English, German, French, and Spanish as well as Chinese, Japanese and Korean. It is available for Windows®, Mac OS X® and Linux®, in 32 and 64 bit. This is a clean, production-level Java integration of the well-known Tesseract engine with Qoppa’s own advanced […]

Read More

Running in non-GUI / non windowing servers

Q: I am getting the following error when running your library jPDFPrint in our SunOS environment. How can I fix it? Exception in thread "main" java.lang.InternalError: Can’t connect to X11 window server using ‘localhost:0.0’ as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62) at sun.awt.motif.MToolkit.<clinit>(MToolkit.java:81) […]

Read More

JavaScript Support in Java PDF Libraries and Components

Q: Does Qoppa’s PDF library products support JavaScript? A: Yes, Qoppa’s Java PDF SDK API has support JavaScript. How is JavaScript used in PDF documents? Mostly, JavaScript is used in interactive PDF forms in field actions to calculate the value of fields, validate field data to prevent invalid entry and format special fields such as dates, […]

Read More