Below are the release notes for the v2021R1 fix branch / minor releases for Qoppa’s Free PDF Library jPDFWriter. Java PDF Library: jPDFWriter v2021R1.00 – January 28 2021 JPDF-1746 – NullPointerException in jPDFWriter due to calling setPaint(null) when drawing jfree chart of type area
Category: FREE jPDFWriter: Write / Create PDFs
Free Java PDF library to create PDF documents.
Create, Convert and Manipulate PDFs using jRuby and Java PDF Library
Here is a jRuby script sample showing how to use Qoppa’s PDF library jPDFProcess to add text to an existing PDF document and write “Hello World” on the document. Using the flexible Java PDF library jPDProcess, any of the following functions could be performed: Add text and images to a PDF, print a PDF, convert […]
Preserving text as selectable characters when creating PDF from RTF
Q: We use com.qoppa.pdfWriter.PDFPrinterJob class in Qoppa’s jPDFWriter library to convert an RTF document to PDF. The converted PDF does not seem to contain standard text content. The size of the output PDF (220 KB) is larger than the original RTF (40KB). Is there any way to convert to real text that can be selected […]
GradientPaint and TexturePaint supported when creating PDFs with jPDFWriter
Qoppa PDF Library jPDFWriter defines a PDFGraphics class which extends Java Graphics2D. Many of the Graphics2D functions are supported (though not all), allowing users to get a graphics object from a PDF page (calling page.createGraphics()) and then drawing onto the page in the same way you would draw to Graphics2D. Graphics2D has a setPaint() method […]
Create a PDF with text and image using Free Java jPDFWriter library
This sample java program uses jPDFWriter to create a new PDF file, add a page to it and draw an image and text on the page. // create document PDFDocument pdfDoc = new PDFDocument (); // create a PageFormat of standard letter size // with no margins Paper p = new Paper (); p.setSize(8.5 […]
Paint / print a panel and other Swing components to a PDF document
You can use the free library jPDFWriter to print or paint a JPanel and other Swing components to a PDF document. Here is sample java code to do so: public class PrintPanelToPDF implements Printable { public static void main (String [] args) { try { // create a PDF Printer Job PDFPrinterJob printer = (PDFPrinterJob)PDFPrinterJob.getPrinterJob […]
Convert a Text File to PDF using Free jPDFWriter with word wrapping and pagination
This sample java program uses jPDFWriter to open a text file and create a PDF file from the text contained in the text file. It takes care of wrapping text into lines and of creating new pages as needed (pagination). // Page dimensions and margins, in inches float pageWidth = 8.5f; float pageHeight = 11f; […]
v2016R1 jPDFWriter Build Notes
Below are the release notes for the v2016R1 fix branch / minor releases for Qoppa’s Free PDF Library jPDFWriter. Java PDF Library: jPDFWriter v2016R1.03 – January 04 2016 JPDF-934 – Missing content on last row in HTML to PDF Conversion due to location offset issue when creating new pages v2016R1.02 – December 14 2016 JPDF-926 […]
How to fix “Invalid xref table entry” in TeX document for PDFs generated with jPDFWriter
A user had the following issue with jPDFWriter: After generating a PDF document with jPDFWriter, he noticed that the PDF would fail when the PDF was added as a figure in a TeX document with the following error message: ** WARNING ** Invalid xref table entry [0]. PDF file is corrupted . The issue is […]
Is there a way to get support for jPDFWriter?
Q: Do you offer support for jPDFWriter? A: There is no way to subscribe to a support contract for jPDFWriter. Since Qoppa Software team is interested in providing a good collection of Java sample programs that demonstrates the capabilities of jPDFWriter, we try our best to answer questions regarding the free library in this context. […]
How to create a PDF page with no margin in jPDFWriter using PageFormat format
This example shows you how to change the page format to have no margins, allowing to write at the top and bottom of the PDF page. To change the page format, you have to use the Paper and PageFormat classes: Paper p = new Paper (); // this is standard letter size p.setSize(8.5 * 72, […]
Is jPDFWriter open source?
Q: Is jPDFWriter open source? A: jPDFWriter’s source code is not open but the license to use the PDF library is free (including for commercial use).
Code Sample: Create your first PDF document “Hello Word” in Java
Java Program to creates a simple PDF document with the text “Hello World” on it using Qoppa’s Free Java PDF library jPDFWriter. /** * Qoppa Software – Source Code Sample */ package jPDFWriterSamples; import java.awt.Graphics2D; import java.awt.print.PageFormat; import com.qoppa.pdfWriter.PDFDocument; import com.qoppa.pdfWriter.PDFGraphics; import com.qoppa.pdfWriter.PDFPage; public class HelloWorld { public static void main (String [] […]
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.
How to convert RTF documents to PDF using jPDFWriter
Q: Can jPDFWriter be used to print RTF documents to PDF? A: Yes, you can use jPDFWriter to do this. Take a look at the loadRTF document method in the PDFDocument class. jPDFWriter does not do the actual rendering of the RTF files. The library uses standard Java classes to load and render rtf documents: […]
Convert HTML to PDF in Java using Free jPDFWriter
Q: Do you have any sample code that takes an HTML page and outputs it as a PDF file using jPDFWriter? A: We provide a static method to load an HTML document in Qoppa’s Free Java PDF library jPDFWriter. The support for HTML is limited to the support offered by Java classes to load and […]
What is the PDF format for PDF documents created with jPDFWriter?
Q: In what PDF format does jPDFWriter save PDF files? A: jPDFWriter saves PDF files in PDF 1.3 format to make sure the documents created can be viewed in any PDF viewer compatible with PDF 1.3 or above.
Code Sample: Create a PDF from a Text File
This sample program reads a text file and converts it to a PDF document. using Qoppa’s free Java PDF library jPDFWriter. This sample uses the PDFPrinterJob object to “print” the text to the PDF file. /** * 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.PrinterJob; […]