IvyTools

General Category => Bug Reports => Topic started by: yial2 on July 24, 2019, 04:08:38 PM

Title: Open PDF with Error: The given key was not present in the dictionary
Post by: yial2 on July 24, 2019, 04:08:38 PM
When using IvyTemplateEditor, I get "Error: The given key was not present in the dictionary"

Code: [Select]
//scan.pdf is just my file name
//Same error happen in the code when using
PdfParser p = new PdfParser(IvyDocumentReader.ReadPdf("scan.pdf"));

Working PDF link:
https://drive.google.com/file/d/13ogL6pzKOoNFP0A2vR_Jf62D0A7y5MIk/view?usp=sharing (https://drive.google.com/file/d/13ogL6pzKOoNFP0A2vR_Jf62D0A7y5MIk/view?usp=sharing)

PDFs with error:
https://drive.google.com/file/d/1kdd03w5U2hc1kJYroN5gtRm_RRdV6pz-/view?usp=sharing (https://drive.google.com/file/d/1kdd03w5U2hc1kJYroN5gtRm_RRdV6pz-/view?usp=sharing)
https://drive.google.com/file/d/12dfCd4DkOIcQBe21_fj9nu1D7ja9Qcjr/view?usp=sharing (https://drive.google.com/file/d/12dfCd4DkOIcQBe21_fj9nu1D7ja9Qcjr/view?usp=sharing)


I am using latest version 1.49
Title: Re: Open PDF with Error: The given key was not present in the dictionary
Post by: admin on July 24, 2019, 11:41:35 PM
Hi, thank you for the error report. Please try the latest beta version from here:

http://ivytools.net/beta/IvyPdf_1.50_beta_20190722.zip

Thank you,
Andrew
Title: Re: Open PDF with Error: The given key was not present in the dictionary
Post by: yial2 on July 25, 2019, 11:56:12 PM
Hi, thank you so much for the prompt reply.

The 1.50 beta did address the error "Error: The given key was not present in the dictionary" but it did also create some discrepancy between 1.49 and 1.50.

Let take this file for example,
https://drive.google.com/file/d/1OSbz3JV4KVqhuJd_28IhfqrglOp5Ru-e/view?usp=sharing (https://drive.google.com/file/d/1OSbz3JV4KVqhuJd_28IhfqrglOp5Ru-e/view?usp=sharing)

When 1.49 parse the file above, page 66 did have the table border properly preserved. Please see
https://drive.google.com/file/d/1rWuvaruphJQHRDJu15yMH3vEwAw5PIwh/view?usp=sharing (https://drive.google.com/file/d/1rWuvaruphJQHRDJu15yMH3vEwAw5PIwh/view?usp=sharing)

When 1.50 beta, same file, the lines(borders) on page 66 are stripped away
https://drive.google.com/file/d/1-PR4M0jUjPs7izLkyRUnv3cQg9g4dSmb/view?usp=sharing (https://drive.google.com/file/d/1-PR4M0jUjPs7izLkyRUnv3cQg9g4dSmb/view?usp=sharing)

In this scenario, I think 1.49 has more accurate result - this somehow affect the "EnclosedArea()" logic in my code.

Thank You - for the amazing library!
Title: Re: Open PDF with Error: The given key was not present in the dictionary
Post by: admin on July 26, 2019, 01:06:49 PM
Hi,

Thank you for the sample files! It turned out there was a change in version 1.50 related to processing sub-streams in PDF documents, which caused this problem.
It should be fixed now. Please try this version:

http://ivytools.net/beta/IvyPdf_1.50_beta_20190726.zip

Please let me know if you notice any other issues!

Thank you,
Andrew