I am upgrading to ColdFusion 2018. iText routines that I use to convert and rotate PDFs, the pdfReader puts locks on the file that do not release when the page is done.
I have tried adding a close() method to my code. (It was not needed on the pdfReader in Release 11.)
<cfscript>
reader = createObject("java", "com.lowagie.text.pdf.PdfReader").init( "test.pdf" );
reader.close();
inStream = createObject("java", "java.io.FileReader").init("test2.pdf");
inStream.close();
</cfscript>
I would expect to be able to rename or delete both files when the supplied script is ran, but only the inStream file (test2.pdf) can be. The reader file (test.pdf) is locked by the system.
Using the suggestions above, I think the following solution will work.
<cfscript>
fkeys = createObject("java", "java.io.FileInputStream");
lKeyStoreFileStream = createObject("java", "java.io.BufferedInputStream").init(fkeys.init("test.pdf"));
reader = createObject("java", "com.lowagie.text.pdf.PdfReader").init( lKeyStoreFileStream );
lKeyStoreFileStream.close();
fkeys.close();
reader.close();
</cfscript>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With