Project

General

Profile

Defect #283

After compress a pdf, original file is blocked

Added by David Martinez about 13 years ago. Updated over 12 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Start date:
04/26/2011
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

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

#1

Updated by Imre Tokai about 13 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

#2

Updated by David Martinez about 13 years ago

Hi Imre!

it works.

Thanks and sorry for the delay I have been away!

David M.

#3

Updated by jos janssen over 12 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)

#4

Updated by Imre Tokai over 12 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

#5

Updated by jos janssen over 12 years ago

Hi Imre,

Thanks, it works fine now.

#6

Updated by Harjo Kompagnie over 12 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.....

#7

Updated by Imre Tokai over 12 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

Also available in: Atom PDF