A Java servlet that reads a Word documents and serves a PDF document to the browser, on the fly using Qoppa’s java library jOfficeConvert (previously jWordConvert).
All posts by admin
Code Sample: Convert Word document to Tiff in Java
This Java program converts a Word document to a multi-page TIFF file using Qoppa’s library jOfficeConvert. import com.qoppa.pdf.TIFFOptions; import com.qoppa.office.WordDocument; public class WordToTIFF { public static void main (String [] args) { try { // Load the Word document WordDocument wd = new WordDocument ("input.doc"); // Save the document as a multi-page TIFF file wd.saveDocumentAsTIFF("output.tif", […]
Print method only called once in jPDFWriter
Q: When I am printing to a physical printer with Java, the print method in my Printable gets called several times. When I am printing using Qoppa’s library jPDFWriter to print directly to PDF from Java, the print method only gets called once. Why is this? A: When printing to a physical printer, the Java API can […]
jPDFWriter Java API
Q: Where can I find jPDFWriter javadoc API? A: You can find the API specification for the latest version of our library jPDFWriter on our website at this link. jPDFWriter is a java library to create PDF documents from Java.
How to set the blend mode to the PDFGraphics object
We have added a new method to our PDFGraphics object called setBlendMode() that takes a string as an argument (available in our beta build as of November 2011 and will be released in the next official version). The possible blend modes are defined in the PDFGraphics object as public final statics: BLEND_NORMAL, BLEND_MULTIPLY, BLEND_SCREEN, BLEND_OVERLAY, BLEND_DARKEN, BLEND_LIGHTEN, […]
How to set a font to the PDFGraphics object?
Q: How can I set a specific font to the pdf graphics in jPDFWriter? A: – There are three basic fonts that are supported by all PDF viewers that do not need to be embedded in the document, they are Helvetica, Courier and Times Roman. To use these fonts, you should use the pre-defined objects […]
Code Sample: Draw data table to PDF document
Java program to create a PDF document from a data table using Qoppa’s Free Java PDF library jPDFWriter. The program draws the data to the document in a table form, with an optional grid. /** * Qoppa Software – Source Code Sample */ package jPDFWriterSamples; import java.awt.Graphics; import java.awt.print.PageFormat; import java.awt.print.Printable; import java.awt.print.PrinterException; import […]
Code Sample: Create a PDF document in a servlet
Qoppa’s library jPDFWriter can be used from within a servlet. The sample creates a PDF document runtime and serves the document directly to the client browser, without using any temporary files on the server.
Code Sample: Convert a text file to PDF in Java
Java program to read a text file and converts it to a PDF document using Qoppa’s library jPDFWriter. This sample uses the PDFPrinterJob object to “print” the text to the PDF file.
What is jPDFViewer?
jPDFViewer is PDF Reader for Java. It is a Java Swing component to view PDF documents within a Java application or a web application. jPDFViewer is just the component but it can be run in different contexts, including in a standalone desktop application as well as inside an applet inside a standard web browser. We […]
Windows XP Display Issue
There is a very rare issue of compatibility between java and certain graphics cards on Windows XP. When this happens, the PDF will display scrambled, weirdly with some part that may repeat. We found a few forums that reported similar problems. Read this posting on Microsoft’s website. Here are a few things to try: Your best bet is to update the driver for […]
Solid Look & Feel Options for Java Swing
Q: What look and feel options do you recommend to use with Qoppa’s Swing PDF viewing components? Tested Look and Feels: We can recommend the following look and feels. They were made them available as options within our end-user PDF editor called PDF Studio which is based on our PDF components and libraries. PDF Studio is used […]
Print Settings (margins, rotation, centering,..) when printing PDF in Java
Q: When we print PDF documents using Qoppa’s library jPDFPrint or components (jPDFViewer, jPDFNotes or jPDFEditor), how can I adjust the print margins? I want the printed page to be exactly the same as when printing with Adobe® Reader®’s. A: We spend a lot of time making sure that our printouts match Adobe Reader / […]
Navigating Back and Forth – Previous Next View
We’ve added a new API to our PDF viewing component for back and forth navigation (go to previous and next view). It will be released in jPDFViewer, jPDFNotes, jPDFEditor 2013R2 release scheduled for August 2013. The com.qoppa.pdfViewer.history package contains the classes that provide access to the “browsing history” of a document. This sample for navigating […]
Localization – Languages – Translated Labels for Qoppa PDF Components
jPDFViewer Localization ViewerLabels.properties can be found inside the jPDFViewer.jar file and contains the English labels for jPDFViewer. Current Languages Supported Qoppa PDF Component jPDFViewer supports 5 languages: English, German, Italian, French, Spanish. jPDFViewer uses the default locale as reported by java: Locale.getDefault() to determine what language to use. In jPDFViewer.jar file are also packaged the files […]
jPDFViewer Java API
Q: Where can I find jPDFViewer javadoc API? A: You can find the API specification for the latest version of our library jPDFViewer on our website at this link. jPDFViewer is a java bean to display PDF documents in Java applications and applets.
Inverting colors
Q: Does your PDF viewer jPDFViewer have an invert color mode? A: Yes. To invert colors when displaying a PDF using our Java component jPDFViewer, jPDFNotes or jPDFEditor, call bean.setInvertColorsMode(true); where bean is either PDFViewerBean, PDFNotesBean or PDFEditorBean. For typical documents, the display will change from “Black on White” to “White on Black”. Inverting colors […]
Code Sample: Extract text from each page on a PDF document (in Java)
Java program that extracts the text for each page in a PDF document and writes it to a file using Qoppa’s library jPDFText. // Load the document PDFText pdfText = new PDFText ("input.pdf", null); // Loop through the pages for (int pageIx = 0; pageIx < pdfText.getPageCount(); ++pageIx) { // Get the text for […]
jPDFText Java API
Q: Where can I find jPDFText javadoc API? A: You can find the API specification for the latest version of our library jPDFText on our website at this link. jPDFText is a java library to extract text and words from PDF documents in Java.
Code Sample: Extract Words from a PDF document in Java
Java program that gets all the words in a PDF document and echoes them to the console using Qoppa’s library jPDFText. // Load the document PDFText pdfText = new PDFText ("input.pdf", null); // Get the words in the document Vector wordList = pdfText.getWords(); // Echo the words for (int wordIx = 0; wordIx < wordList.size(); […]
Code Sample: Extract Words and Position in a PDF document in Java
Java program to extract all the words in a PDF document with their bounding box (as a quadrilatral) and echoes this information to the console. The bounding box is a quadrilateral which gives information about the the location of the word on each page as well as the word’s length and height. // Load the […]
Code Sample: Extract text from a PDF document into a text file in Java
Simple Java program to extract the entire text from a PDF document as a single String, and then saving the text to a file using Qoppa’s library jPDFText.
Trust Windows Store Certificates
Q: Can I read from the Windows Certificate store to get digital IDs to use as trusted Certificate Authorities (CAs)? A: By default, our libraries jPDFSecure and jPDFProcess and components jPDFNotes and jPDFEditor use the Java trusted Certificate Authorities when verifying digital signatures in PDF documents. It is possible to customize the trusted authorities through the SignatureSettings static methods. To add the Windows trusted CAs, […]
Multiple digital signatures on a PDF document
Q: I am using your Java library jPDFSecure to add 2 digital signatures to a PDF document (sign, save, sign again and save) but only the last signature shows as valid, the first signature is showing as invalid. Am I doing anything wrong? This KB entry applies to the following Java libraries and components: jPDFProcess, […]
jPDFSecure Java API
Q: Where can I find jPDFSecure javadoc API? A: You can find the API specification for the latest version of our library jPDFSecure on our website at this link. jPDFSecure is a java library to set permissions and passwords, encrypt and digitally sign PDF documents.
Code Sample: Sign PDF Using Windows IDs
Windows maintains a certificate and digital ID store. Digital IDs in the store can come from certificate authorities, or can come from USB hardware tokens. Our Java libraries jPDFSecure, jPDFProcess and visual components jPDFNotes or jPDFEditor can apply a digital signature to a PDF document using a digital ID from the Windows certificate store. Here is sample java code showing how to retrieve […]
Code Sample: Set permissions on a PDF document in Java
This Java program encrypts a document and restricts permissions to only allow printing using Qoppa’s library jPDFSecure.
Code Sample: Get encryption and permission settings of a PDF file in Java
This Java program lists the encryption and permissions settings of a PDF document using Qoppa’s library jPDFSecure.
Code Sample: Clear Security and reset permissions in Java
This Java program clears the encryption and allows all permissions in a PDF document using Qoppa’s library jPDFSecure.
Code Sample: Apply digital signature to a PDF document in Java
Q: How can I add a digital signature to a document using Qoppa’s java library jPDFSecure? A: This Java program loads a document, then loads a digital ID from a PKCS#12 file, and then creates and signs a signature field on the first page of the document. // Load the document PDFSecure pdfDoc = new […]