Bug 445641 - PDF preview does not take CropBox into account
Summary: PDF preview does not take CropBox into account
Status: REPORTED
Alias: None
Product: dolphin
Classification: Applications
Component: panels: information (show other bugs)
Version: 21.08.3
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-17 10:39 UTC by geisserml
Modified: 2021-11-17 10:39 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
PDF with CropBox (43.11 KB, application/pdf)
2021-11-17 10:39 UTC, geisserml
Details

Note You need to log in before you can comment on or make changes to this bug.
Description geisserml 2021-11-17 10:39:06 UTC
Created attachment 143659 [details]
PDF with CropBox

SUMMARY
The preview for PDF documents on the information panel of Dolphin misses to take the /CropBox parameter of PDF documents into account. A CropBox can be used to cut off borders from a PDF page. It is widely used and part of the core PDF standard since the very beginning (cf. PDF RM 1.7, p. 77). While Okular and Gewnview correctly apply CropBox as view area, the Dolphin preview renderer does not.

STEPS TO REPRODUCE
1. Go to a folder that contains a PDF where the first page has a CropBox. (You might want to use the attached document.)
2. Focus the file so the first page appears in the preview
3. Open the file with Okular or Gwenview
4. Compare the images

OBSERVED RESULT
In Dolphin, the PDF is displayed with a border that is not shown in Okular/Gwenview.

EXPECTED RESULT
The PDF should look the same in Dolphin preview as it does in PDF viewers, i. e. the Dolphin preview should take CropBox into account.

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.23
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-40-generic (64-bit)
Graphics Platform: Wayland
Graphics Processor: Mesa DRI Intel® HD Graphics 4000

ADDITIONAL INFORMATION
Assuming you are using something Poppler-like to render the PDF, you might have to set a "use cropbox" parameter to true. For pdftoppm, this would be the `-cropbox` flag, for example.
I'm not sure how the PDF preview is currently implemented, but maybe you could just use a classical QImage like Gwenview does, instead of an external renderer. The Qt PDF Plugin seems to correctly take CropBox into account. This will require the `qt5-image-formats-plugin-pdf` package to be installed, though.