"Error: [Pdf Structure Library]: End Of Data reached" when recompressing images  SOLVED

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
User avatar
David.P
User
Posts: 1521
Joined: Thu Feb 28, 2008 8:16 pm

"Error: [Pdf Structure Library]: End Of Data reached" when recompressing images  SOLVED

Post by David.P »

Hi Forum & Tracker Support Team,

just for reference, and in order to find this solution again if needed in the future:

I got a very large PDF file with almost 5000 pages whose file size I wanted to reduce by converting and recompressing all images in the file using the new feature "Recompress Images".

However, I always got the error message "Error: [Pdf Structure Library]: End Of Data reached" during the recompression process. This error could not be resolved despite trying to optimize and re-saving the PDF file in several different ways.

The error kept occurring at the same point during the recompression, however I could not identify the problematic image by its number as displayed in the "Recompressing" dialog. Obviously that one image was corrupt.

What finally helped was to do a "Save as Optimized" first, with all images compressed to ZIP (except for Color images, which I left unchanged):

Image

After this optimization of the file, the subsequent recompression of all 6370 images in the file went through without problems.

Thanks by the way for this fantastic new feature of v9, another function unique to PDF-XChange Editor.

Keep up the great work
Best regards
David
David.P
PDF-XChange Pro
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by Lzcat - Tracker Supp »

Hi, David.P

If you still have original file it will be very helpful for us to take a look on it.

Kind regards,
Lzcat - Tracker Supp
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
User avatar
David.P
User
Posts: 1521
Joined: Thu Feb 28, 2008 8:16 pm

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by David.P »

Hello Lzcat,

unfortunately I can't provide you with the entire file for confidentiality reasons. However, I can see that the error occurs at approximately image number 2280 out of 7589 images that are contained in the file.

Is there any way for me to determine on which page of the PDF the image with this number is located? If so, I could possibly provide you with the problematic page from the PDF for analysis.

Kind regards,
David

Edit: I actually narrowed the 5000 pages down to the actual problem page by simply deleting either the upper or lower half of the document a couple of times in a row, while doing the Recompression and gauging in which half of the document the problematic image would occur. Talk about the power of exponential numbers!

I attach the page below. Note that the page appears empty, and only contains one 1bit image (which seems to use way to much memory).

Last edited by David.P on Mon Feb 01, 2021 10:57 am, edited 1 time in total.
David.P
PDF-XChange Pro
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by Sasha - Tracker Dev Team »

Thanks, David,

Forwarded that to LzCat for investigation.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
David.P
User
Posts: 1521
Joined: Thu Feb 28, 2008 8:16 pm

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by David.P »

Thanks very much Sasha.

In the meantime, I also found that page in its original state (it is from a PDF/A-1b document). I shall send you the document via email. What is also strange that all other (1-bit) bitmap images in the defective version of this file had become tinted red for some reason.

Best regards
David
David.P
PDF-XChange Pro
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by Sasha - Tracker Dev Team »

Hello David.P,

Thanks, got it - will forward it to the responsible developer for detailed investigation.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by Lzcat - Tracker Supp »

Hi, David.P

Which is relation between files sent us by email? As I can see both of them was not created by our software.
File "... original ....pdf" have noted this in document properties.
File "... defective copy ....pdf" declare that it is created by our software, however it is bloated by layers information, what we do not do. So this file was modified by some other software before last edit in Editor.
Regarding to red color - that image is indexed (palette based), and in original image palette is correct, while in copy it is damaged (too many incorrect values). So question is how did you get second file from original, and which software broke palette.

Kind regards,
Lzcat - Tracker Supp
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
User avatar
David.P
User
Posts: 1521
Joined: Thu Feb 28, 2008 8:16 pm

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by David.P »

Hello Victor,

thank you for your fast investigation of the file.

The original file comes from a German government authority. The defective copy probably was edited in some older copy of Adobe Acrobat. I shall send you another, intermediate copy of the edited file (before it got broken), from which you might be able to take additional properties.

Regarding the bloated information layers in the defective file: could you tell me a way how one could get rid of these layers -- in order to be able to repair such document corruption in the future?

Can I also send you the other file with some more defective pages as mentioned in my other thread of today?

"PDF-XChange Editor files sometimes not readable by Adobe Acrobat/Reader"
https://forum.pdf-xchange.com/viewtopic.php?f=62&t=35720

Best regards
David
David.P
PDF-XChange Pro
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by Lzcat - Tracker Supp »

Hi, David.P
Last file is also correct, but how to broke it that way you did? I need to know to be sure that our software work with such files correctly.
David.P wrote: Mon Feb 01, 2021 4:39 pm Regarding the bloated information layers in the defective file: could you tell me a way how one could get rid of these layers -- in order to be able to repair such document corruption in the future?
Well, layers information and broken palette is two separate problems, I don't think that they are related. Regarding to remove layers - Flatten All Optional Content should help (avail in Layers pane).
image.png
image.png (23.66 KiB) Viewed 2462 times
Current version have some issues and does not remove all not needed information, this will be fixed in one of upcoming builds. However removing layers information will not fix palette issues, so we still need to find what operation with file corrupt images palette.
David.P wrote: Mon Feb 01, 2021 4:39 pm Can I also send you the other file with some more defective pages as mentioned in my other thread of today?

"PDF-XChange Editor files sometimes not readable by Adobe Acrobat/Reader"
viewtopic.php?f=62&t=35720
You may, but lets move to that thread, not sure that issues are related at all. Anyway for investigation I'll need correct files and step-by-step instructions how to get them broken using our software only.

Kind regards,
Lzcat - Tracker Supp
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
User avatar
David.P
User
Posts: 1521
Joined: Thu Feb 28, 2008 8:16 pm

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by David.P »

Hello Victor,
Lzcat - Tracker Supp wrote: Tue Feb 02, 2021 8:19 am
David.P wrote: Mon Feb 01, 2021 4:39 pm Regarding the bloated information layers in the defective file: could you tell me a way how one could get rid of these layers -- in order to be able to repair such document corruption in the future?
Well, layers information and broken palette is two separate problems, I don't think that they are related. Regarding to remove layers - Flatten All Optional Content should help (avail in Layers pane).
Image
Thank you, I will try and do so if a similar file corruption should happen again.
Lzcat - Tracker Supp wrote: Tue Feb 02, 2021 8:19 am Last file is also correct, but how to broke it that way you did? I need to know to be sure that our software work with such files correctly.
I could track the broken file down now! It has been produced in Feb. 2019 by a MSG-to-PDF converter, most probably by this one:
https://www.bitrecover.com/msg-to-pdf/

The PDF producer as noted in the file properties is "iTextSharp 5.0.5 (c) 1T3XT BVBA"

So I believe that we can conclude that this file corruption was not caused by PDF-XChange Editor.

I shall send you that other file with respect to the other thread, and we can discuss it over there:
"PDF-XChange Editor files sometimes not readable by Adobe Acrobat/Reader"
https://forum.pdf-xchange.com/viewtopic.php?f=62&t=35720

Thank you again for your investigation,

Best regards
David
David.P
PDF-XChange Pro
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17939
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by Tracker Supp-Stefan »

Hello David.P,

This topic has been marked as solved, and I just 'answered' your other one with a smiley face. Are the two related - and can we consider this one also truly solved, or do you need us to look into this further?

Kind regards,
Stefan
User avatar
David.P
User
Posts: 1521
Joined: Thu Feb 28, 2008 8:16 pm

Re: "Error: [Pdf Structure Library]: End Of Data reached" when recompressing images

Post by David.P »

Hello Stefan,

this issue is solved as well, since the present problem could be traced back to that exotic PDF producer mentioned further above.

Thank you
David
:)
David.P
PDF-XChange Pro
Post Reply