I need to generate PDF document using xelatex.exe.
.tex document is generated from the database and it contains thousands of pages and thousands of images displayed by \includegraphics.
Problem is that from certain place in document images are not displayed.
- square dimension exactly matches image size, just picture is missing and white space is instead of every image
- also other document contents is generated fully OK (including images description)
- generated PDF is invalid for some tools if some image is missing, PDF then can't be further converted/processed by some tools and can't be displayed by some PDF readers (Adobe Reader is OK)
- there is no error message in the log from Latex during .tex->.pdf conversion
- there is no particular error displayed by PDF browsers or converters, some of them just display some generic error like "invalid file" or "can't open x.pdf"
- repeated images are not affected - there are few images displayed multiple times and such images are correctly generated and displayed in the middle of the broken part
- image format change doesn't help (some image converters produce incompatible JPEGs, so I've tried to recompress all images by application with Latex-compatible output JPEGs)
- image size change doesn't help (tried to use extreme compression - 3 GB PDF file decreased to 65 MB PDF, so definitely there is no memory overflow)
- image resolution change doesn't help (tried to rescale all images to 10 %, so issue can't be caused by any hi-resolution picture)
- images order change doesn't help, issue happens at exact image number from begin of document
- position at page doesn't matter - images are lost even if first damaged image is both at the end of page or at the begin of page
- issue doesn't depend of section (additional section after eg. every 100 images doesn't help)
- issue doesn't depend of chapter (additional chapter after eg. every 100 images doesn't help)
Document summary:
Total images: 10397
Unique images: 10371
Position of first damaged image: 5004 (including repeated)
Position of first damaged image: 4987 (without repeated)
- this statistics is just approximate, I've filtered images with .jpg extension, but there are few images with .jpeg and .png extensions, so probably 5000 is the edge when images are getting lost
Current conclusion:
- approximately (or maybe exactly, see remark above) 5000 images are displayed correctly, then all further are lost (except repeated which were already displayed)
- issue is definitely caused by total count of (unique) images in whole document (repeated images don't affect the issue)
- issue has definitely nothing to do with images size, final document size (issue is the same for GB PDF size and few MB PDF size), images resolution or images format (JPEG structure, bit depth, etc.)
Unclear questions:
- unclear whether it's caused by some Latex limit/bug or some PDF limit/bug
- any suggestions how to break the images count limit?
xelatex --no-pdfto get a dvi (.xdv) file, then convert that to pdf with xdvipdfmx – David Carlisle Jan 07 '22 at 22:46