Q: Is it possible to certify a PDF document with Qoppa’s libraries and componentsA: As of version 2013R2, it is possible to add a certifying signature using our libraries jPDFProcess, jPDFSecure, jPDFNotes and jPDFEditor. What is a certifying signature? A certifying signature is a digital signature. A certifying signature has to be the first applied […]
All posts by admin
Apply Digital Signature on a PDF document using USB hardware token PKCS 11
Q: Can jPDFSecure apply digital signatures using a hardware token? A: Yes, our 2 java PDF libraries jPDFSecure and jPDFProcess can apply a digital signature to PDF documents using a hardware token through PKCS#11. Sample Code // Load token configuration file and register provider String configName = "pkcs11.cfg"; Provider p = new sun.security.pkcs11.SunPKCS11(configName); Security.addProvider(p); // Create key store […]
Apply / Verify PDF Digital Signature with Server Timestamp
What are Timestamped Digital Signatures? When creating a digital signature, it is possible to simply use the computer’s date and time. But this may not be valid in a lot of legal environments. Time-stamp servers, also called Time Stamp Authorities (TSA), can provide a legal timestamp and there is a protocol to access the servers […]
Code Sample: Merge 2 PDF files into one in Java using jPDFProcess
This Java program merges two PDF files into a single one using Qoppa’s PDF library jPDFProcess. // Load the two documents PDFDocument pdfDoc1 = new PDFDocument ("input1.pdf", null); PDFDocument pdfDoc2 = new PDFDocument ("input2.pdf", null); // Append the second document to the first one pdfDoc1.appendDocument(pdfDoc2); // Save the merged document pdfDoc1.saveDocument ("output.pdf");// Load the […]
How to add OCR to jPDFProcess
jPDFProcess, Qoppa’s java PDF creation and manipulation library, has an OCR module. Please contact us regarding licensing this additional feature. How to Activate / Implement OCR To get started, you can download the latest jPDFProcess version from here: https://www.qoppa.com/pdfprocess/demo/download And the JNI native bridge files from here: https://www.qoppa.com/files/pdfprocess/ocr/libtessjni411.zip The JNI zip file contains the […]
Linearizing existing PDF documents with Java
Q: Can Qoppa’s Java PDF library, jPDFProcess, create linearized PDF documents and save existing PDF documents as linearized? A: Yes, jPDFProcess can create linearize PDF documents. To linearize a PDF document with jPDFProcess, 2 simple lines of code do the trick: PDFDocument myPDF= new PDFDocument(“file.pdf”); myPDF.saveDocumentLinearized(new FileOutputStream(“linearizedfile.pdf”));PDFDocument myPDF= new PDFDocument(“file.pdf”); myPDF.saveDocumentLinearized(new FileOutputStream(“linearizedfile.pdf”)); What is PDF linearization and why […]
Saving PDF for Fast Web View Display when streaming
Q: Is there a way to save a PDF optimized for web reading in a way that the the 1st pages of a PDF can be displayed immediately to the user screen while the rest of the PDF continues loading? A: You can use our PDF library jPDFProcess to save PDF documents as “linearized”. Linearized documents contain […]
PDF overlay and imposition
Q: How can I generate a PDF document from overlaying one PDF document on another? We’re trying to overlay our company’s letterhead onto existing documents. A: Our Java PDF library jPDFProcess can overlay one document on top of another. The function to look at is called appendPageContent and is found at the PDFPage level. Note that the […]
jPDFProcess Java API
Q: Where can I find jPDFProcess javadoc API? A: You can find the API specification for the latest version of our library jPDFProcess on our website at this link. jPDFProcess is a java library to modify and manipulate PDF documents in Java.
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 […]
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 […]
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. […]
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
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 = […]
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); […]
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 […]
Add a Table of Content (TOC) to a PDF document with Java
This Java program creates a table of contents at the head of the document using Qoppa’s PDF library jPDFProcess. This sample adds a page at the top of the document and then adds a page title and a link to every page in the document. Click here to view the java code.
Print PDF documents to a specific printer on an IBM iSeries AS400
Q: On an IBM iSeries (AS400), how can I get jPDFPrint to use a certain printer to print PDF documents? When I query for printers with: PrinterJob().lookupPrintServicesPrinterJob().lookupPrintServices I get an empty array. So how do I specify a printer for jPDFPrint to use? A: There is a good technical note about using the Java Print Services APIs on […]
jPDFPrint Java API
Q: Where can I find jPDFPrint javadoc API? A: You can find the API specification for the latest version of our library jPDFPrint on our website at this link. jPDFPrint is a java library to print PDF documents in Java.
Sample Code: Print a PDF document with print request attributes
A Java program that prints a PDF document using some of the print request attributes available using Qoppa’s library jPDFPrint. // Load the PDF document PDFPrint pdfPrint = new PDFPrint("input.pdf", null); // Create attribute set to print to a file HashPrintRequestAttributeSet attrSet = new HashPrintRequestAttributeSet(); attrSet.add(PrintQuality.HIGH); attrSet.add(Chromaticity.MONOCHROME); // Send the PDF to the printer […]
Resolved: Random Windows Java javax.print.PrintException: Printer is not accepting job
This entry applies to all our libraries and components that can print PDF documents: jPDFPrint, jPDFProcess, jPDFViewer, jPDFNotes, jPDFEditor. Q: We have an issue when sending PDF documents to the printer using jPDFrint on a Windows Server. Every now then we do get either one of the following error message: “Printer is not accepting job”. […]
Print a PDF loaded in memory (byte array) without saving it as a file
Q: Is it possible to send a PDF in memory to a printer using jPDFPrint without saving it first? If so how? A: Yes it is possible. There are different constructors in the PDFPrint class to load documents, one of them takes a Java InputStream to read the PDF content from. If you have the […]
How is the PDF document sent to the printer using jPDFPrint?
Q: Does jPDFPrint convert the PDF document to images before printing or does it send the PDF document to the printer directly as a PDF? A: None of the above. jPDFPrint does NOT convert to images and does NOT send the PDF directly: jPDFPrint reads and interprets the PDF document and then sends drawing commands to […]
Code Sample: Silent print a PDF document in Java
A Java program that prints silently a PDF document to the default printer. package jPDFPrintSamples; import com.qoppa.pdfPrint.PDFPrint; public class SimplePrint { public static void main (String [] args) { try { PDFPrint pdfPrint = new PDFPrint("input.pdf", null); pdfPrint.printToDefaultPrinter(null); } catch (Throwable t) { t.printStackTrace(); } } }package jPDFPrintSamples; import com.qoppa.pdfPrint.PDFPrint; public class SimplePrint { public […]
Code Sample: Print PDF document with cover page in Java
A java program that uses jPDFPrint to print a cover page before printing the rest of the document using Qoppa’s library jPDFPrint.
Code Sample: Print multiple PDF files in a single print job in Java
A Java class that can print multiple PDF documents as a single print job. The class takes a list of PDF documents, creates a PrinterJob and then uses jPDFPrint to print the documents. This sample basically shows how to merge multiple documents as you are sending them to the printer so they all show under […]
Code Sample: Print a PDF document with DocPrintJob and PrintJobListener
A Java program that uses the javax.print.DocPrintJob related classes to print a PDF document using Qoppa’s library jPDFPrint. The class registers itself as a javax.print.event.PrintJobListener to receive events related to the progress of the print job.
Code Sample: Print a PDF document with a watermark in Java
A Java program that uses jPDFPrint to print a PDF document and adds a watermark on every page. We defined an interface called IWatermark that makes it easy for users to define and customize their own watermark, including text, font, color, location and orientation by simply using the well-known Graphics2D Java class. // Load PDF document PDFPrint […]
Code Sample: Print a PDF document to a given printer in Java
A Java program that prints silently a PDF document to a named printer using jPDFPrint. package jPDFPrintSamples; import com.qoppa.pdfPrint.PDFPrint; public class SimplePrintDefault { public static void main (String [] args) { try { PDFPrint pdfPrint = new PDFPrint("input.pdf", null); pdfPrint.print ("my printer", null); } catch (Throwable t) { t.printStackTrace(); } } }package jPDFPrintSamples; […]
Code Sample: Print a PDF document in Java using jPDFPrint
A simple Java program that prints a PDF document using Qoppa’s library jPDFPrint. PDFPrint pdfPrint = new PDFPrint("input.pdf", null); pdfPrint.print (null);PDFPrint pdfPrint = new PDFPrint("input.pdf", null); pdfPrint.print (null); Download full Java Program to Print PDF