darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.88k stars 1.15k forks source link

Export as pdf produces only white page #11846

Closed Jiyone closed 2 years ago

Jiyone commented 2 years ago

Did you buy darktable from an application store ? No

Apparently, exporting as pdf doesn't work :thinking: This produce a pdf file with the same number of pages as selected picture number but they are all white and contains no picture. I don't know if it needs additional lib for that. I have tried many settings and it's always the same.

How to reproduce

Darktable version : current 3.9 Os : Ubuntu 20.04

Jiyone commented 2 years ago

@gi-man updated

pehar1 commented 2 years ago

3.9.0+1551~g79adc8034 Ubuntu 20.04 OpenCL enabled/disabled : no difference Three 24 MP images selected in lighttable Export parameters as shown in screenshot

export-pdf

Not able to reproduce, all (three) images exported into one pdf file as expected, one image per page. Please provide as much information as possible (issue template!). How many images did you try to export? Any error messages if you start darktable from commandline in debug mode?

Jiyone commented 2 years ago

How many images did you try to export?

Any number, from 1 to n.

Any error messages if you start darktable from commandline in debug mode?

No error

Here is an example of what I get : _0011.pdf

pehar1 commented 2 years ago

Your pdf contains the empty boxes where your images should be shown (one box per page). What type of images did you try to export? Did you try with another image type? Can you work with this images in darkroom? Is it possible to export them if you processed them in darkroom? If you don't supply information what exactly you have done (step-by-step instruction, possibly providing an example image file), it is impossible to help! Please use the issue template and supply as much information as possible !!! If no one is able to reproduce, no one will help.

Jiyone commented 2 years ago

I don't know what I can tell more than "any picture I export to pdf does this". Any. jpg, NEF, CR2 ... edited or not, just any ... They export well in other format.

Did you buy darktable from an application store ? No

Describe the bug/issue

Exporting picture to pdf produce only white page.

To Reproduce

-In Lightable, select pictures and select PDF format in Export module -Click export. -Open the resulting PDF and see

Expected behavior

PDF should contain my picture.

Screenshots Capture d’écran de 2022-05-21 13-28-50

Which commit introduced the error I don't know.

Platform

Additional context Please provide any additional information you think may be useful, for example:

ptilopteri commented 2 years ago

I also get no visible photo in an exported pdf, a4b2766f openSUSE Tumbleweed nvidia GTS 450

ptilopteri commented 2 years ago

example: http://wahoo.no-ip.org/~paka/220517_212649_dsd_3877.pdf

pehar1 commented 2 years ago

@Jiyone, I picked up your export settings from the screenshot. One point is noticable: you have set an output ICC profile profile -> sRGB2014 AFAIK this profile is not integral part of the dt distribution, so I can not test with this profile (not available from the pulldown). Are you able to run a test with sRGB (web-safe) or Adobe RGB (compatible) instead of sRGB2014. I exported with your set of parameters and the mentioned output profiles (not sRGB2014) without any problem. I'm still not able to reproduce the issue.

Jiyone commented 2 years ago

It does that with any profile too. Is dt using a library to export to pdf ?

TurboGit commented 2 years ago

It does that with any profile too. Is dt using a library to export to pdf ?

No, it is using a simple hand coded PDF writer.

aurelienpierre commented 2 years ago

Reproduced here. Also, if you try to export with compression set to "uncompressed", dt crashes without backtrace.

aurelienpierre commented 2 years ago

It works if you export in 16 bits.

aurelienpierre commented 2 years ago

The culprit is 534e066d53fc9c3737667bfd11d052720aa8c6e4. Reverting it solves the white PDF problem and the crash in uncompressed mode.

TurboGit commented 2 years ago

@dtorop : Do you have an idea about this ? Was the issue critical on CUPS side ? You said a "warning", if there is no more than this we should certainly revert this for the 4.0 release. Of course a better fix would be great, but so close from the release maybe reverting to a "safe" code that has been there for long time is maybe the best choice. Please, let me know. TIA.

dtorop commented 2 years ago

Was the issue critical on CUPS side ?

No... As per https://github.com/darktable-org/darktable/pull/11429#issue-1185855260, warnings are logged ("file is damaged ... xref not found ... Attempting to reconstruct cross-reference table") but CUPS (or cups-filters?) is able to deal with it.

You said a "warning", if there is no more than this we should certainly revert this for the 4.0 release.

There should be no harm in doing this. Just more annoying/confusing log messages.

Of course a better fix would be great, but so close from the release maybe reverting to a "safe" code that has been there for long time is maybe the best choice.

I'll take a look and see if there's anything obvious to make this work (no warning and export to PDF works).

TurboGit commented 2 years ago

@dtorop : Thanks a lot, so I'll revert only at the very last time if no proper fix is found.

dtorop commented 2 years ago

Strange results when testing: The first time I export a PDF with the defaults (8-bit deflate), the image stream is very brief, resulting in a blank image. For example:

stream
x\0\0\0\0
endstream

If I switch to 16-bit (keeping deflate), I get good output. The same upon then switching to 16-bit and uncompressed.

And then, switching back to 8-bit and deflate produces a correct PDF.

If I initially set export parameters to an 8-bit uncompressed PDF, darktable crashes. Or if I export an 8-bit deflate PDF, then switch to 8-bit uncompressed, then I also see a crash.

One difference between the export and the print code is that export (unlike print) calls dt_pdf_add_icc_from_data(). Perhaps this is a clue?

I'll keep looking...