Changes in behaviour PDFNET 6.3.2 to 6.71

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

Thank you for the detailed report.

One quick question, are you upgrading to 6.7.1 for .Net 2-3.5, or 6.7.1 for .Net 4+?

This has been fixed, and you can get a patched build here from the latest stable nightly.
http://www.pdftron.com/nightly/?p=stable/

We’re switching to Framework 4+. Thanks Ryan.

Hi Ryan, I can oly see the .Net 2-3.5 version here. CAn you point me at the Framework 4+ version?

It is there now (and normally always there)
http://www.pdftron.com/nightly/?p=stable/2017-05-10/

http://nightly.pdftron.com.s3.amazonaws.com/stable/2017-05-10/PDFNetDotNet4_2017-05-10_stable_rev60002.zip