Bug 138487 - export hybrid PDF with partial document
Summary: export hybrid PDF with partial document
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
(earliest affected) release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Keywords: filter:pdf
Depends on:
Blocks: PDF-Export-Options-Dialog
  Show dependency treegraph
Reported: 2020-11-25 13:12 UTC by Lionel Elie Mamane
Modified: 2021-11-30 10:29 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2020-11-25 13:12:25 UTC
I would like to export a document as a Hybrid PDF so that it shows part of the document in a PDF viewer, but the whole ODF file is embedded.

This can e.g. be a Calc workbook with two sheets:
1. First sheet contains presentation of data to be shown.
2. Second sheet contains computation parameters not to be shown, such as currency exchange rates, litre-to-gallon conversion rate, kg-to-lb conversion rate, etc.

I want that a PDF reader shows only the first sheet. But obviously, opening the PDF in LibreOffice Calc for editing should yield both sheets. I'm aware this specific scenario can be emulated by hiding the sheet, but that is too subtle: and people opening the PDF in Calc have to "guess" that there is a hidden sheet and unhide it.

Another use case, in Writer, would be a book. The PDF shows only the book, but the editable version has an extra page at the beginning with stuff like the full text of the Creative Commons license that applies, instructions of stylistic nature to follow to make changes to the document (e.g. "please stick to British spelling" or "follow the AMS style guide" or "please submit changes to the original author in 'track changes' mode AND WITH AN EXPLICIT AUTHORISATION that your work is licensed under CC/variant/blahblah/unported), ...

Steps to Reproduce:
1. Menu File / Export as PDF...
2. check the "Hybrid PDF (embed ODF file) box

Actual Results:
The Range options are greyed out and unavailable.

Expected Results:
The Range options are available. They affect only the PDF, the same way they would affect a print. Still the whole ODF file is embedded, even the parts not included in the range.

Reproducible: Always

User Profile Reset: No

Additional Info:
Build ID: 00(Build:2)
CPU threads: 8; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.utf8); UI: en-GB
Debian package version: 1:7.0.2-4
Calc: threaded
Comment 1 V Stuart Foote 2020-11-25 15:59:27 UTC
So this would have to be handled from the PDF Export dialog. 

That is, the Range (pages | selection) would control the content parsed into PDF as now, but the dialog's 'Hybrid PDF' would need an additional check-box controlling the embedded ODF: match the Range value OR embed entire ODF.

Would need filter work to reduce content of the ODF to match the range being exported.

But seems a reasonable enhancement.
Comment 2 Lionel Elie Mamane 2020-11-25 17:33:21 UTC
(In reply to V Stuart Foote from comment #1)
> the dialog's 'Hybrid PDF' would need an additional check-box
> controlling the embedded ODF: match the Range value OR embed entire ODF.

I don't think it is reasonable to embed only part of the ODF stream in the PDF. I wouldn't add that checkbox. Always embed the whole ODF stream. Maybe change the label to make that more clear.

Instead of
 Hybrid PDF (embed ODF file)
change to
 Hybrid PDF (embed whole ODF file, not limited by Range)

and/or change the "Range" label to "PDF view range" or something like that.
Comment 3 V Stuart Foote 2020-11-25 18:07:12 UTC
Hmm, not sure that makes sense. Currently, for creating a Hybrid PDF, the range has no impact because the entire document is parsed and the entire ODF is included as a data stream in the PDF.

If we are going to modify the PDF export to honor range handling (selection | pages) we should include option to filter the ODF data stream as well--include ODF for the full document, or include ODF for just the defined range as rendered to PDF.

For privacy/security default should be for ODF data stream to match the rendered Range. And the *option* should be to include the entire document as ODF -- that matches the current defaults of no Range in Hybrid PDF, rendering the full ODF. Important the user knows exactly what they have rendered and embedded into the PDF.
Comment 4 Heiko Tietze 2020-12-04 09:23:22 UTC
If we duplicate the range options

Range (PDF)         Range (ODF) 
(o) All             (o) All
( ) Pages [     ]   ( ) Pages [     ]
( ) Selection       ( ) Selection

don't we run into trouble if PDF is set to page 1 and ODF to page 2, for example? Sounds like a lot of effort to make sure the overlap of PDF and ODF is 100% (not vice versa probably).

OTOH, if the ODF is always included entirely and the range defines what the PDF will show, this issue is gone. Lionel's use case in c0 is clear, do we find something where PDF should be larger than the ODF?
Comment 5 Heiko Tietze 2021-11-30 10:29:12 UTC
UX input given, removing the keyword.