Defect #283
After compress a pdf, original file is blocked
0%
Description
I downloaded pdf_pro_plugin (thank you SCOTT BUTLER for writing it and HARJO for suggesting it) and it does a nice job of compressing PDFs.
After it has created the compressed copy of the pdf, I want to delete the original pdf and rename the compressed version to the original name. But the .deleteFile() function is failing (returns false). It seems like pdf_pro isn't letting go of the original file after compressing it. Using Process Explorer I see that servoy.exe still has the original PDF file open right after the .compress() has happened.
Here is the code I used
@var fileUnCompressed = plugins.file.showFileOpenDialog();
var originalFileName = fileUnCompressed.getName()
var compressedFileName = plugins.servoyguy_pdf_pro.compress(fileUnCompressed);
var fileCompressed = plugins.file.convertToJSFile(compressedFileName);
if (fileUnCompressed.exists()){
if(!fileUnCompressed.deleteFile()){
globals.dialogError('Error: Can not delete the original pdf') <------code always ends up here
}
}
if(!fileCompressed.renameTo(originalFileName)){
globals.dialogError('Error: Can not rename compressed pdf')
}
@
History
Updated by Imre Tokai about 14 years ago
- Status changed from New to In Progress
- Assignee set to Imre Tokai
Hello David,
Test latest version of the plugin uploaded today to the Files section, please.
Does the issue still persists?
Regards
Updated by David Martinez almost 14 years ago
Hi Imre!
it works.
Thanks and sorry for the delay I have been away!
David M.
Updated by jos janssen over 13 years ago
Hi Imre,
I'm using the Merge function to merge two PDF file's.
Now I have a similar problem, it seems the merged file is locked by the plug-in.
Could this be the same problem?
(I used the latest download (1.5) from the download page)
Updated by Imre Tokai over 13 years ago
- Status changed from In Progress to Resolved
- Client type set to Any
- In developer? set to No
- Servoy version set to 5
- OS version set to Win
- Java version set to 1.6
Hello Jos,
Test latest version of the plugin uploaded today to the Files section, please.
Regards
Updated by Harjo Kompagnie over 13 years ago
Hi Imre,
why is this build so large? and why is there a pdfbox.jar inside of 4,5MB :-)
Maybe you can elloborate a bit more.....
Updated by Imre Tokai over 13 years ago
Hi Harjo,
Formerly iText and Multivalent libs caused improper merge of input pdfs or incorrect result file release, so I searched for better approach and found org.apache.pdfbox.util.PDFMergerUtility class; new class is from mentioned lib.
Regards