devxlogo

Obtain a Secure PDF from an FOP Processor

Obtain a Secure PDF from an FOP Processor

This tip shows you how to obtain a secure PDF from an FOP processor. This means the user can’t open the PDF without a user password and, once downloaded, cannot edit, print, or copy the PDF.

//get an org.apache.fop.apps.Driver objectDriver fop=new Driver();...//the output will be a PDF filefop.setRenderer(Driver.RENDER_PDF); //create a java.util.Mapjava.util.Map M=new java.util.HashMap();M.put("userPassword", "airwingscrush");M.put("allowCopyContent", "FALSE");M.put("allowEditContent", "FALSE");M.put("allowPrint", "FALSE");//set the constrainsfop.getRenderer().setOptions(M);...

devx-admin

Share the Post: