PDDocSave Doesn't save a doc with a PDSaveCopy flag enabled
Hi all ,i am new to this community ,
I am encountering an issue when attempting to save a PDF document using the PDDocSave function with the PDSaveCopy flag. The save operation fails with an "error opening the specified document" error for older PDFs (e.g., those beginning with %PDF-1.3), but works without issue for newer PDFs (e.g., %PDF-1.6).
Observations:
When I use other flags such as "PDSaveFull or PDSaveForceIncremental" operation on the problematic document using Adobe Acrobat Sdk, a new copy is created that works correctly with PDDocSave .This suggests that the "PDDocSave" process updates the document's internal structure to a newer version, effectively resolving the incompatibility.
The call causing the issue is: PDDocSave(doc, PDSaveCopy, asPath, ASGetDefaultFileSys(), NULL, NULL);
Core Question:
What is the recommended method to programmatically upgrade or adapt an opened document's internal PDF version to a more recent, compatible version before performing operations like PDDocSave with the PDSaveCopy flag?
Request:
I am looking for the best practice to ensure a document's compatibility before executing subsequent actions, thereby preventing these version-related errors.
ASPathName asPath = ASFileSysCreatePathFromCString(ASGetDefaultFileSys(), nfn);
if (!asPath)
throw 0;
PDDocSave(doc, PDSaveCopy, asPath, ASGetDefaultFileSys(), NULL, NULL);
PDDoc copyDoc = PDDocOpen(asPath, ASGetDefaultFileSys(), NULL, true);