JeffY Posted May 26, 2011 Posted May 26, 2011 I am hoping to get some assistance in modifying Matt Petrowsky's example file that combines pdf's and add one more step to password protect the combined pdf. I would include the file but it is for subscribers only. http://www.filemakermagazine.com/videos/combining-pdfs-the-blazing-fast-method.html There is example code to do this at: http://itextpdf.com/examples/iia.php?id=219 I have zero knowledge on how to modify this to work with Matt's sample file. Any help would be appreciated. If someone wants to provide an estimate to do this please contact me at: [email protected] Thanks Jeff
john renfrew Posted May 26, 2011 Posted May 26, 2011 You also need to load the Bcprov-jdk15-146.jar which is part of the iText Extra files download Then create another SM function with the code and once you have a completed PDF send it to the function (no error checking etc) ...) // UserPass ( fm_file ; fm_fileOut ; userPassword ) // 11_05_26 JR // v1 // snippet of code to add userPassword to file // takes fm_file and stamps it to fm_fileOut // userPassword is pretty much that import java.io.FileOutputStream import com.itextpdf.text.* import com.itextpdf.text.pdf.* USER = userPassword.getBytes() OWNER = "yourPassword".getBytes() reader = new PdfReader(fm_file) stamper = new PdfStamper(reader, new FileOutputStream(fm_fileOut)) stamper.setEncryption(USER, OWNER, PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128 | PdfWriter.DO_NOT_ENCRYPT_METADATA) stamper.close() return true
Recommended Posts
This topic is 4941 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now