This Java sample shows how to use jPDFPrint printable to implements your own Printable interface which can be useful when you need a finer control over the printing of PDF pages. In this sample, we’re changing the rotation of the page printouts by -180 degrees. package jPDFPrintSamples; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.print.PageFormat; import […]
Articles Tagged: Java Sample Code
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 […]
Add text content to a PDF document with Java
Here is a sample code to add text to a PDF document content using Qoppa’s Java PDF Library, jPDFProcess. import java.awt.Color; import java.awt.Font; import com.qoppa.pdfProcess.PDFDocument; import com.qoppa.pdfProcess.PDFGraphics; import com.qoppa.pdfProcess.PDFPage; public class AddText { public static void main (String [] args) { try { // load PDF document PDFDocument pdfDoc = new PDFDocument ("C:\\myfolder\\input.pdf", null); […]
Resizing or Scaling PDF Pages (Paper Size and Content) Programmatically in Vector Format
Q: Is there a way to resize a PDF in order to scale non-letter-size PDFs to 8.5 x 11 PDFs using Qoppa’s PDF library jPDFProcess? A: Yes, there is. Version v2017R1 and later jPDFProcess now has a direct API to resize pages in a PDF. Version v2016R1 and earlier In previous versions, it was possible […]