Page 1 of 1

Can't overwrite file after OCR

Posted: Wed Apr 14, 2021 3:12 pm
by TheRealFentonius
Hi there, I'm very new to PDFTools and am trying to add an OCR layer to existing PDF files, so I don't want to rename the files in any way. When I run the tool I get an error message at the end saying "The process cannot access the file because it is being used by another process". I've attached a screenshot so you can see what I mean.
Any clue what I'm doing wrong?
Thanks... Peter
image.png

Re: Can't overwrite file after OCR

Posted: Wed Apr 14, 2021 3:32 pm
by Paul - Tracker Supp
Hi TheRealFentonius,

thanks for the post. There are tools available that we can use to determine exactly what has a handle on that file keeping it open. Before we go there I would ask you to check that you do not have Windows Explorer open to that target folder, and that the file in question is not being previewed in the Windows Explorer Preview Pane. That has the potential to cause this.

If you are absolutely certain that noting is using that file other than PDDF-Tools you can download a copy of "process Explorer" from Microsoft and we can walk you through using it to determine what is locking those files. https://docs.microsoft.com/en-us/sysint ... s-explorer

I am keen first however to know if the Windows file explorer is previewing that file.

regards

Re: Can't overwrite file after OCR

Posted: Wed Apr 14, 2021 3:39 pm
by Willy Van Nuffel
Hi all,

For me, it seems like the problem comes from the "Batch Processing Mode" that is not activated.

Please turn in ON and try again.

Best regards.

Re: Can't overwrite file after OCR

Posted: Wed Apr 14, 2021 4:54 pm
by TheRealFentonius
Great, turning on batch processing worked - thanks for the assist...
Peter

Re: Can't overwrite file after OCR

Posted: Wed Apr 14, 2021 4:59 pm
by TheRealFentonius
Sorry, I spoke too soon.
I created a new tool which OCRed and then converted to PDF/A, called unoriginally "OCR & PDF/A". When I run this tool with both Batch Processing and Multi-Threaded Processing turned on, then I get the same error message when trying to save. Again, here's a screenshot...
image.png

Re: Can't overwrite file after OCR

Posted: Wed Apr 14, 2021 6:21 pm
by TheRealFentonius
Obviously (!) the last try was with all Windows Explorer windows shut. I've downloaded Process Explorer - what now?
Here's a shot of the Process Explorer window.
image.png

Re: Can't overwrite file after OCR

Posted: Wed Apr 14, 2021 8:50 pm
by Willy Van Nuffel
I did run a few tests and the problem comes from the "Convert to PDF/A" action.
When you run it separately, saving to the original file, you get the same error message.

I do not know if it is normal or not that - when using this action - the existing file cannot be overwritten by PDF-XChange Tools.
PDF-XChange Editor has no problem with that.
@Tracker Support : do you have an explanation for this different behavior ?

A work-around would be to save the PDF/A files with another name, like shown by default => %[FileName]_(PDFA)

Re: Can't overwrite file after OCR

Posted: Wed Apr 14, 2021 10:39 pm
by Paul - Tracker Supp
Thanks for that Willy,

TheRealFentonius, I asked the devs about this and it seems we need to reproduce this to investigate, it does seem like PDF-Tools may be blocking that.

May I ask you to export the Tool you created and send it to us at support@pdf-xchange.com please?

regards

Re: Can't overwrite file after OCR

Posted: Thu Apr 15, 2021 10:37 am
by TheRealFentonius
Thanks Willy & Paul, I've sent the exported tool to the support email, so I guess we'll see what they come back with. Out of interest I tried to change the order of operation within the created tool and it made absolutely no difference!

Re: Can't overwrite file after OCR

Posted: Thu Apr 15, 2021 5:38 pm
by Paul - Tracker Supp
Hi again TheRealFentonius,

I tested your tool here and every time it saves without issue. Can you reproduce this on any other devices or is it specific to this one PC?

If we cannot reproduce the issue we would need to do a remote debug session on your machine to determine what is happening. It was pointed out to me that while Process Explorer MAY help, it is entirely possible that the lock(s) on the files may be temporary and gone by the time you look with Process Explorer.

So please do let us know if the issue can be reproduced and if so please provide steps how to do it as I was unable to do so.

regards

Re: Can't overwrite file after OCR

Posted: Thu Apr 15, 2021 5:48 pm
by Willy Van Nuffel
Hi Paul,

Thanks for being prepared to further investigate this problem.

I would like to make clear that you should be able to reproduce the problem when you save the file to the same location AND with the same filename. This means that the resulting PDF must overwrite the original file. See screenshot with error message.

I think that PDF-Tools does not close the original document (or does not wait until it is closed) before writing the new PDF.

Best regards.

Re: Can't overwrite file after OCR

Posted: Tue Apr 20, 2021 8:56 pm
by Vasyl-Tracker Dev Team
Hi Willy.

Please try the latest 353 build. Thanks.

Cheers.

Re: Can't overwrite file after OCR

Posted: Thu May 13, 2021 2:17 pm
by Paul - Tracker Supp
For the benefit of those reading this, the issue was further investigated with the discussion via email.
"The process cannot access the file because it is being used by another process" issue, the devs found the cause and have made a fix. which will be available in our next build (9.0.355.0).

As a work around you may try to use:

MultiThreaded=OFF and BatchProcessing=ON

OR

MultiThreaded=ON and BatchProcessing=OFF

but NOT the combination:

MultiThreaded=ON and BatchProcessing=ON
I hope that helps.

Re: Can't overwrite file after OCR

Posted: Wed Jun 30, 2021 10:09 am
by Eymann
Hello Everybody

I was able to locate the problem in batch processing mode. Because we had the same problem at our company.

When the Batch Processing Mode is turned on, each tool action will process every input object (files, scanned images, etc.) before moving on to the following action.
Of course, this can lead to obstructions during one or more sequences of processes that are running at the same time.
Thus the processes can interfere with each other, which leads to the message "The process cannot access the file because it is being used by another process".
Especially when you have several documents that you want to process, an error occurs.

My recommendation is to turn off the "Batch processing Mode"

Thus, each process is completed in turn until it moves to the next process.

Batch Processing Mode.png
Info.png

Another option would be not to overwrite the document and save as a new document created with a different name.

Re: Can't overwrite file after OCR

Posted: Wed Jun 30, 2021 12:16 pm
by Tracker Supp-Stefan
Hello Eymann,

Many thanks for the post and suggestion!

@TheRealFentonius - please let us know if that resolves the problem for you?

Kind regards,
Stefan

Re: Can't overwrite file after OCR

Posted: Fri Jul 16, 2021 12:38 am
by Vasyl-Tracker Dev Team
Hello All.

Since 355 build this trouble is solved and you don't need to disable the BatchProcessing option anymore, as workaround.
Please try latest build and let us know if something is wrong...

Cheers.