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 […]
All posts by admin
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); […]
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 & […]
PDF to HTML5 / SVG Conversion with Transparency, Gradient & Masks Support
As of version v2016R2.04, Qoppa Software has improved support for transparency in Qoppa’s PDF Conversion from PDF to HTML5 / SVG. There are many sophisticated features defined in the PDF format specifications. Qoppa has been working on its PDF parsing and rendering engine for over 15 years to develop some of the most advanced PDF […]
File browsing or saving on device when an Android app is targeting SDK 23 or higher
They way apps get permissions has changed as of API 23. If the device is running Android 6.0 or higher, and your app’s target SDK is 23 or higher: The app has to list the permissions in the manifest, and it must request each dangerous permission it needs while the app is running. The user […]
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 […]
Extracting page images (jpg, png, tiff) from a PDF document using jPDFViewer
Here is a Java sample code showing how to export images of pages in a PDF document (in jpg, png or tiff format) using jPDFViewer. jPDFViewer is a Java Swing component that can display PDF documents and also allows to get page images from a PDF document as BufferedImage objects which can then be saved […]
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 […]
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 […]
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 […]
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 […]
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: […]
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 […]
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 […]
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 = […]
Rest API Convert PDF to HTML5 SVG
Download the PDF as html/svg GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/content Accept: text/html
Rest API Convert PDF to TIFF
Download the PDF as a tiff GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/content?dpi=300 Accept: image/tiff
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 […]
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 […]
Terminate the PDF preflight verification / conversion process depending on the problem(s) found
This sample Java code using jPDFPreflight shows how to cancel the verification process once a failure of verification is found. The com.qoppa.pdfPreflight.PDFPreflight interface gives access to a class called ResultRecord that contains a lot of information about the issue found. So it is possible to adapt this sample to cancel the verification or conversion process […]
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” } }
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” } }
Rest API Convert / Export PDF to JPEG, PNG, .. Images
Download a single page as an image GET http://{host}:{port}/qoppapdf/v1/documents/mydir/mydoc.pdf/pages/0/content?dpi=300&quality=.5 Accept: image/jpeg
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, […]
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 }
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 } }
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
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” } }
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”: […]
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 […]