Hi, I have a problem with a method of the DynaPdf MBS library, in particular with the “OpenOutputFile” method. in practice, this method in most cases works correctly but, occasionally, it does not give a positive result!
I believe a temporary file, each time with a different name. Despite everything, sometimes it returns False, as if it couldn’t open the file (I simulate the situation using a breakpoint, going to open the file from the outside, for example with a pdf reader… in this case the exception always throws it ).
Anyone have an idea? a bug?
(Xojo 2019 r3.1 version, DynaPdfMBS version 21.1, but I’m not sure about that… 50531KB)
No, I’m pretty sure the file is new (I use a timestamp to generate its name, eg: yyyymmaaHHMMSS.pdf)
If I understand correctly, I create the file right from a document in memory (I carry over a portion of the code)
if pdfDoc.HaveOpenDoc then
if f.IsWriteable then
if not pdfDoc.OpenOutputFile(f) then
app.logger.Logga("Impossibile scrivere il file PDF! [Utils_ScriviFile]", True)
MsgBox("Impossibile scrivere il file PDF! [Utils_ScriviFile]")
if myFlag then
call pdfDoc.CloseFileEx(pwdToApply, "XXXXXXXXX", 0, 0)
MsgBox("errore in [Utils_ScriviFile]: f.IsWriteable = False")
MsgBox("errore in [Utils_ScriviFile]: pdfDoc.HaveOpenDoc = False")
Are you creating new FolderItem instances? 2019 uses the older FolderItem system APIs where the reference is able to follow files you relocate. If you are not creating a new FolderItem instance, you may be accessing a file you aren’t expecting.
The framework has a function to help with this. Use GetTemporaryFolderItem to create a reference to a unique FolderItem in the temporary folder.
do you mean if the folder where the file will go already exists? yes, the folder exists, it’s just the file that is created inside it, each time with a different name. it’s a folder that I use specifically for these temporary pdfs. Before calling the procedure, I clean up the folder among other things, in order to avoid the accumulation of files.