Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2007



Tip: Looking for answers? Try searching our database.

iText: setting ownerPassword for PdfReader

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Racine - 18 Sep 2007 00:22 GMT
Can't seem to find a straight forward answer for this. I'm using  iText to open
an existing form, that has a owner password and then populate it, and save out
the results. Everything works if I Don't have a owner password.

So the Question is how to I define the owerPassword when opening the pdf?

Attached is a bit of my code. The error happens on the "reader =
createObject...." line.

pdfFile=expandPath("#inputPDF#");    //define the name of my output file
newFile=expandPath("#DestFile#");    //create the output file
ownerPassword = "xxx888";
fileIO=createObject("java","java.io.FileOutputStream").init(newFile);         //load
the template PDF with the iText PDF reader
writeoutput("<BR>Processing fileIO");
reader =
createObject("java","com.lowagie.text.pdf.PdfReader").init(pdfFile);    // <------
This is Where the code dies without a password, as the pdfFile has one defined
writeoutput("<BR>Processing reader");
pdfStamper =
createObject("java","com.lowagie.text.pdf.PdfStamper").init(reader,
fileIO);    //create a form object to reference
writeoutput("<BR>Processing pdfStamper");
pdfForm = pdfStamper.getAcroFields();   
.....etc etc...
Racine - 18 Sep 2007 03:21 GMT
i guess i answered my own question, by dev server must be running a differetn version of iText, opens fine on my production box with no password specified. Odd but ok i guess.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.