We’re in process of upgrading PDFNET.dll from 6.3.2 to 6.7.1. We were running Framework 2-3.5 of 6.3.2 and are upgrading due to this going out of support.
Existing code (unchanged during dll upgrade) is now erroring with the following error.
“{“Exception: \n\t Message: An error occurred during linearization: The requested operation cannot be performed on a file with a user-mapped section open: “c:\fostemp\Trn-14724-cd61cc03-7877-4634-b36f-c15ee83ab3cf”, “C:\1.pdf”\n\t Conditional expression: !exception_during_lin\n\t Filename : Linearization.cpp\n\t Function : trn::SDF::SDFLinarDoc::Save\n\t Linenumber : 2468\n”}
The code is simply the save of the document to its’ original source, namely:
_pdfdoc.Save(filename, SDFDoc.SaveOptions.e_linearized);
Where filename is the same as the file you have opened.
Note: You can recreate this error by changing the save format within the PDFNET sample: PDFViewSimpleTest.csproj
As mentioned earlier, this code did work with the 6.3.2 version. Only changing to 6.7.1 and changing no other source code will generate the error.
private void MenuFileSave_Click(object sender, EventArgs e)
{
if (_pdfview.GetDoc() != null)
//_pdfview.GetDoc().Save(filePath, SDFDoc.SaveOptions.e_remove_unused);
_pdfview.GetDoc().Save(filePath, SDFDoc.SaveOptions.e_linearized);
}
Through trial and error I have also discovered the following works with the file and the linearization no longer falls over:
_pdfdoc.Save(filename, SDFDoc.SaveOptions.e_remove_unused);
_pdfdoc.Save(filename, SDFDoc.SaveOptions.e_linearized);
Which seems unusual considering other posts answered that linearizartion removes unused objects as part of the process.
Can you confirm that adding the e_remove_unused save option as above does not adversely affect the subsequent save as e_linearized so that I can get my code working again.
Thanks in advance