I have a customer getting this error:
CloseFileEx: FlushPages() and CloseFileEx() cannot be combined. Use OpenOutputFileEncrypted()
I don’t use FlushPages()
The CloseFileEX code hasn’t changed for years, although the plugin versions have.
The code is:
dim flags as integer
dim szThePassword as string = thePassword
if bWantsReadOnly then
flags = BitwiseOr(flags, pdf.krsModify) // forbid modifying
end if
if bNoCopying then
flags = BitwiseOr(flags, pdf.krsCopyObj) // forbid copying content
end if
Call pdf.CloseFileEx("", szThePassword, pdf.kkl128bit, flags)
Well, if you use FlushPages, the stuff is written out to disk and removed from memory.
Maybe you could leave away FlushPages, which was really more to thing for 32-bit systems. where RAM is precious.
Well, if you use FlushPages,
This is my question. I don’t use FlushPages.
So the error makes no sense to me.
Because the PDF is already an open file, I do not see how I could pivot to OpenOutputFileEncrypted either, as that seems to want a folderitem parameter.
Maybe you can reproduce it in a sample project?
So CloseFileEx raises error EENCRYPT_FLUSHED_PAGES.
Not sure what function you called before to trigger the state it complains about.
It seems that if pdf.optimise() is called before CloseFileEX, I get this problem.
Yes, a couple of things don’t work for Optimize.
For Optimize, it is often better to save PDF and import it again.