Clear Password and Permissions in a PDF document

It is possible to clear permissions and passwords in a PDF document using several of Qoppa’s Java PDF libraries and components. With jPDFSecure, use PDFSecure.clearPasswordPermissions() With jPDFProcess, use PDFDocument.clearPasswordPermissions() With jPDFEditor, use PDFEditorBean.getDocument().clearPasswordPermissions() Calling PDFSecure.clearPasswordPermissions will clear all password permissions for this document: it will reset all password permissions to true. it will clear open/user […]

Read More

Changing PDF Document Permissions and Passwords

It is possible to set / update permissions and passwords in a PDF document using several of Qoppa’s Java PDF libraries and components. Call to change document permissions and passwords depending on which Qoppa library you use:   // with jPDFSecure PDFSecure.setPasswordPermissions(newPermPwd, newOpenPwd, permissions, currentPermPwd, encryptType);   // with jPDFProcess PDFDocument.setPasswordPermissions(newPermPwd, newOpenPwd, permissions, currentPermPwd, encryptType); […]

Read More

Authentic Vector PDF to HTML5 / SVG Conversion

Qoppa Software’s PDF to HTML conversion, which is available in the form of a Java library (jPDFWeb) as well as an HTML PDF Viewer and Markup Module, offers “real” PDF to HTML5 conversion in the sense that it converts all the objects contained in the PDF documents: Text Objects Image Objects PDF Path Objects & […]

Read More

How to Resolve Error Rendering Page: Missing Font

When rendering a PDF document in the following Qoppa’s PDF library products: jPDFImages, jPDFPrint, jPDFProcess, jPDFViewer, jPDFNotes or jPDFEditor, you might encounter a blank page with an “Error Rendering Page” displayed in red on a page. This error happens when there is an issue with a font within the PDF document. There are 2 possible […]

Read More

Fill / Populate XFA Dynamic Form with Field Data in Java

Here is a sample Java program that can load a dynamic XFA form, fill in data from an XDP or XML file and then saved the filled form. This sample is using Qoppa’s PDF library jPDFFields. It could be simply adapted to use jPDFProcess library by replacing PDFFields with PDFDocument. import com.qoppa.pdfFields.PDFFields;   public class […]

Read More

Copying pages from one PDF to another PDF in Java

Here is a sample Java program that shows how to copy pages from one PDF document to another using Qoppa’s PDF library jPDFProcess. The sample can be adapted to work with Qoppa’s jPDFAssemble by simply replacing the class “PDFDocument” with “PDFAssemble”. In this sample, we’re copying the pages from an existing PDF to a new […]

Read More

Export PDF to PNG Image with Overprint Simulation

This Java sample below shows how to use Qoppa’s jPDFImages (or jPDFProcess) to load a PDF and export it to an image in PNG format with overprint simulation on. First, the image is rendered in CMYK profile, then converted to RGB using ColorConvertOp and finally saved as PNG (or JPEG). The resolution is set at […]

Read More

Loading a PDF file from RandomAccessFile or an InputStream

Q: How do you suggest we open PDF files from a USB key or removable device? When Qoppa’s PDF Android toolkit opens a PDF file, by default it uses a RandomAccessFile object and reads parts of the PDF file on-demand. The reason to do this is to preserve memory which is limited on Android. You […]

Read More

jWordConvert v2016R2 Build Notes

Here are the build notes for jWordConvert, Qoppa Java Word to PDF Conversion Library, for version v2016R2. v2016R2.06 – March 29 2017 JWOR-351 – Document Specific: JPEG image reading error: Numbers of source Raster bands and source color space components do not match v2016R2.05 – February 17 2017 JWOR-350 – Document Specific conversion error reads: […]

Read More

On using Java RenderingHints to smooth jagged edges on rotated images

Q: There seems to be some pixelation or resolution issue when rendering specific images in a PDF brochure. Is there anything that can be done to render these images more smoothly? A: Qoppa’s PDF libraries and components uses our own interpolation algorithm that works much better than the built-in Java algorithm well both when up-sampling […]

Read More

Convert a PDF document to a single HTML page

Q: Is it possible with jPDFWeb to convert a whole PDF document to single HTML output file? A: Yes, Qoppa’s Java PDF library, jPDFWeb, can export each page of a PDF document as an SVG element. It is then simple to add HTML header and tags around all the SVG elements to make it a […]

Read More

Java OutputStreamWriter is returning “UTF8” instead of “UTF-8”

We found some inconsistencies and lack of documentation in the way OutputStreamWriter getEncoding() method is formatting the returned encoding names. See below, sample programs and output that illustrate the issue. UTF-8 Encoding FileOutputStream stream1 = new FileOutputStream("C:\\test\\out.svg"); OutputStreamWriter writer1 = new OutputStreamWriter(stream1 , "UTF-8"); System.out.println(writer1.getEncoding()); writer1.close();   FileOutputStream stream2 = new FileOutputStream("C:\\test\\out.svg"); OutputStreamWriter writer2 = […]

Read More

Draw digital signature validation status when converting PDF to HTML

As of v2016R2, Qoppa’s library jPDFWeb and the derived HTML PDF viewers built on top of jPDFWeb will display digital signatures validation status contained in the original PDF document in the output / rendered HTML files. The signature validation is done on the server side using the Java trusted certificate authorities or your own trusted […]

Read More

Export / Convert PDF Pages to Thumbnail Images with Java

Here is Java sample code to export PDF pages to images in various formats: PNG, JPG and TIFF using Qoppa’s PDF library jPDFImages. When opening the PDF document, the sample below read the document from a local file, the code can be simply changed to read the file from a file input stream instead. Export […]

Read More

Rest API Import Export Flatten Annotations from PDF Documents

Get annotations GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/annotations?pageIndex=0 Export annotations GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/annotations/content Accept: application/xfdf Import annotations POST http://{host}:{port}/qoppapdf/v1/documents/mydir/otherdoc.pdf/annotations Content-Type: application/xfdf (xfdf file in message body) Flatten annotations POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf (sample JSON in message body) { “FlattenAnnotationsAction”: { “paintNonPrintableAnnots”: true, “savePath”: “flatAnnots/mydoc.pdf” } }

Read More

Rest API Export Merge Flatten Form Fields in a PDF Document

Get form fields GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/fields Export form fields GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/fields/content?exportEmptyFields=true Accept: application/xfdf Import form fields POST http://{host}:{port}/qoppapdf/v1/documents/mydir/otherdoc.pdf/fields Content-Type: application/xfdf (xfdf file in message body) Flatten form fields POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf (sample JSON in message body) { “FlattenFieldsAction”: { “paintButtons”: true, “paintOnlyImageButtons”: true, “paintNonPrintableFields”: true, “savePath”: “flatFields/mydoc.pdf” } }

Read More

Rest API Sign PDF Documents

Add a signature field to the PDF PUT http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/fields/signature-fields/myfield (sample JSON in message body) { “widget”:[ { “pageIndex”:0, “rectangle”: { “x”:100, “y”:100, “width”:200, “height”:50 } } ] } Get all signature fields the PDF GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/fields/signature-fields Sign the PDF POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/fields/signature-fields/myfield/signature (pfx or p12 file as attachment) (sample JSON) { “keystorePassword”:”password”, “keyAlias”:”alias”, “keyPassword”:”password”, “certifyingSignature”:true, “certifyingPermissions”:3, […]

Read More

Rest API Encrypt and Set Permissions, Passwords on PDF documents

Get the current permissions GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/permissions Clear the usage rights DELETE http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/permissions/usage-rights Clear the password permissions DELETE http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/permissions/password-permissions Set password permissions PUT http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/permissions/password-permissions (sample JSON in message body) { “encryptType”:1, “openPassword”:”openPass”, “permissionsPassword”:”permsPass”, “changeDocumentAllowed”:false, “assembleDocumentAllowed”:false }

Read More

Rest API Add Watermarks Headers Footers to PDF Documents

Stamp the document with text POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/pages (sample JSON) { “TextStampAction”:{ “rotation”:15, “transparency”:50, “x”:100, “y”:100, “text”:”HelloWorld”, “color”:0, “fontSize”: 32, “fontName”: “Courier”, “fontStyle”: “Plain”, “pageIndex”:1 } } } Stamp the document with an image POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/pages (image file as attachment) (sample JSON) { “ImageStampAction”:{ “rotation”:15, “x”:100, “y”:100, “pageIndex”:1 } }

Read More

Rest API OCR PDF Documents

OCR a PDF POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/pages (sample JSON) { “OCRAction”: { “language”:”eng”, “dpi”:300 } } Extract the text from a PDF GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/pages/0/text

Read More

Rest API Linearize PDF Documents

Linearize a PDF POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf (sample JSON in message body) { “LinearizeAction”: { “savePath”: “linearized/mydoc.pdf” } }

Read More

Rest API Optimize PDF

Create a new optimization profile PUT http://{host}:{port}/qoppapdf/v1/optimize-profiles/myprofile (sample JSON in message body) { “discardAnnotations” : true, “discardUnusedResources” : true, “mergeDuplicateFonts” : true, “mergeDuplicateImages” : true, “compressObjectsIntoStreams” : true, “colorImageHandler”: { “colorSpace”: 1, “compression”: 1, “dpi”: 150, “jpegQuality”: 0.8 }, “grayImageHandler”: { “colorSpace”: 1, “compression”: 1, “dpi”: 150, “jpegQuality”: 0.7 }, “bwImageHandler”: { “colorSpace”: 2, “compression”: […]

Read More

Rest API PDF Document Assembly

Append two PDFs that are both already uploaded POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/pages { “InsertUploadedPagesAction”: { “appendFilePath”:”mydir/subdir/myotherdoc.pdf”, “appendPassword”:”password”, “pageRange”:1 } } Upload and append a PDF to an existing PDF POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/pages (PDF file as attachment) (sample JSON) { “InsertAttachedPagesAction”: { “pageIndex”:2, “pageRange”:”2-4″ } } Append an image to an existing PDF POST http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/pages (image file attached) (sample […]

Read More