fschutt / printpdf

A fully-featured PDF library for Rust, WASM-ready
https://fschutt.github.io/printpdf/
MIT License
829 stars 98 forks source link

Can't print image in pdf #166

Closed huand closed 8 months ago

huand commented 9 months ago

Using the example image_alpha seems to work just fine as I can open the pdf and see the image for example in chrome

ChromeOk

However when I try to open with AcrobatReader (version 23.008.20470), there is an error:

AcrobatError

And when trying to physically print, the page is just blank

PrintBlank

Did someone manage to print an image this way? how did you manage? where is the issue coming from?

Thx!

qarmin commented 9 months ago

Also qpdf found some problems

cargo run --example image_alpha --features="embedded_images" --release
qpdf --check test_image.pdf
checking test_image.pdf
PDF Version: 1.3
File is not encrypted
File is not linearized
WARNING: test_image.pdf (object 7 0, offset 807): unknown token while reading object; treating as string
WARNING: test_image.pdf (object 7 0, offset 814): unknown token while reading object; treating as string
WARNING: test_image.pdf (object 7 0, offset 1115): unknown token while reading object; treating as string
WARNING: test_image.pdf (object 7 0, offset 1117): treating unexpected brace token as null
WARNING: test_image.pdf (object 7 0, offset 1118): unknown token while reading object; treating as string
WARNING: test_image.pdf (object 7 0, offset 1183): unknown token while reading object; treating as string
WARNING: test_image.pdf (object 7 0, offset 1183): too many errors; giving up on reading object
WARNING: test_image.pdf (object 7 0, offset 1195): expected endobj
qpdf: operation succeeded with warnings