When I use PrintToDisk to create a PDF file, I can't open or edit the resultant PDF until I exit the Xojo application. How can I make it close and release the file?
Yes, trying to open in Acrobat Reader, or even trying to rename the file is not allowed. The message from Acrobat is "There was an error opening this document. This file is already open or in use by another application." If I try to rename the PDF the resultant error message names the Xojo app as the one that has the file open. All of this goes away when I exit the Xojo app.
Saving the file on a shared volume, I can then see the file locked status which says it's locked for Write.
Doing some more testing I found that this only occurs in 64-bit Windows apps. 32-bit works fine.
The problem does not appear to be Xojo itself, as I can create a file and write to it with BinaryStream, but still access/rename/delete that file without exiting the Xojo app.
There will not be a fast fix for this issue - it is even not reproducible in the debug build.
As a workaround PrintToBuffer method should be used with saving to file using Xojo classes.
Ok, the PrintToBuffer method works fine. It doesn't take very much code to do it - I just called PrintToBuffer directly in a single BinaryStream.Write call.
There are no replies made for this post yet. However, you are not allowed to reply to this post.
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here. Register Here »