Download it now!
Bug 40163 - Export to PDF with size based on bounding box of selected objects
Summary: Export to PDF with size based on bounding box of selected objects
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:pdf
: 55317 73657 79262 101454 114729 (view as bug list)
Depends on:
Blocks: PDF-Import-Draw PDF-Export
  Show dependency treegraph
 
Reported: 2011-08-17 05:21 UTC by Tristan Miller
Modified: 2018-01-18 19:42 UTC (History)
13 users (show)

See Also:
Crash report or crash signature:


Attachments
sample document, see Comment 3 (9.49 KB, application/vnd.oasis.opendocument.graphics)
2011-09-04 22:46 UTC, Rainer Bielefeld Retired
Details
Sample document to be exported (10.40 KB, application/vnd.oasis.opendocument.graphics)
2015-09-25 07:30 UTC, Antonello
Details
Screenshot of the export dialog (96.92 KB, image/png)
2015-09-25 07:31 UTC, Antonello
Details
Exported pdf (the whole page instead of just the object) (9.29 KB, application/pdf)
2015-09-25 07:32 UTC, Antonello
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tristan Miller 2011-08-17 05:21:41 UTC
It is impossible to export a selection of a drawing to PDF.

Reproducibility: Always

Steps to reproduce:
1. Create a drawing
2. Select one or more objects
3. File->Export
4. Check the "Selection" checkbox
5. Select "PDF - Portable Document Format" from the "File type" list
6. Enter a filename
7. Save
8. Export
9. Open the PDF in a PDF viewer

Observed behaviour:
10. The PDF contains the entire page with the entire drawing

Expected behaviour:
11. The PDF should contain only the selected object(s), and the page size should exactly fit the objects

This problem makes it impossible to export drawings to PDF for use as graphics in other applications.

A workaround (which depends on third-party software) is to export instead to EPS, and then use the epstopdf command to convert the graphic to PDF.
Comment 1 Tristan Miller 2011-08-17 05:38:28 UTC
Upon further testing, this appears to be a problem with the PDF exporter in general.  When selecting objects in, for example, LibreOffice Impress, the PDF "selection" export saves the entire document as a PDF instead of just the selection.
Comment 2 Jeffrey 2011-08-20 19:08:39 UTC
Confirmed for LibreOffice 3.4  340m1(Build:103) on OpenSuse Linux. All images are exported, not just selection.
Comment 3 Rainer Bielefeld Retired 2011-09-04 22:44:46 UTC
NOT reproducible with "LibreOffice 3.4.3 RC2 - WIN7 Home Premium (64bit) German UI [OOO340m1 (Build:302)]" 

Using the LibO dialogs I can check the "only selection" checkbox, but when the PDF export dialog appears, radio buttons show "All", and I will have to select "Selection" again, what will work in a perfect way. So the only problem might be that the "Selection only" information will not be transferred to the PDF export dialog.

Same results using WIN dialog.

My steps trying to reproduce (Here sith LibO dialogs):

1. Open attached "sample.odg"
2. select first 2 elements rhomb + smiley on first slide using mouse
   Control points rectangle shows selection
3. Menu 'File -> Export ...'
   File dialog appears
4. Check "Selection" and browse for folder if necessary
5. Select document type PDF
6. <Export>
   PDF Export Dialog appears, unexpectedly range "All" radio button
7. select range "Selection" by radio button
   JPG, reduced, rest unchecked)
8. <Export>
   Export will be done
10. go to foder, open document
    expected: only first 2 elements rhomb + smiley on first slide 
    actual: as expected

So no problem. If PED in step 6 does not appear this one would be a DUP of Bug 36842 - PDF-Export shows no options

@Tristan Miller, @Jeffrey
Please contribute information concerning your 
- OS
- observation details starting with your step 6
- your observation using Menu 'File -> Export as PDF'
- your observations with WRITER, CALC
Comment 4 Rainer Bielefeld Retired 2011-09-04 22:46:29 UTC
Created attachment 50910 [details]
sample document, see Comment 3
Comment 5 Tristan Miller 2011-09-05 00:53:48 UTC
Rainer, I can confirm that your understanding is correct:  when using File->Export, I check the "Selection" checkbox, but when I click on "Save" a "PDF Options" dialog appears which has the "All" radio button preselected in the "Range" set.  If this button is left as-is, the entire drawing is exported.  It's necessary to change the radio button to "Selection" in order to exclude the non-selected parts of the drawing from the output.

However, this is only a partial workaround:  the page size of the exported document is the entire page instead of the size of the selection.  So it's still impossible to export drawings to PDF for use as graphics in other applications.  This problem appears to be unique to the PDF export; when exporting as EPS or PNG, for example, the image size is the same as the selection size.

So for this bug to be fixed two changes must be made:

1. The value of the "Selection" checkbox in the "Export" dialog must propagate to the subsequent "PDF Options" dialog.

2. The page size of the exported PDF should match the size of the selection.
Comment 6 Rainer Bielefeld Retired 2011-09-05 02:37:51 UTC
@Tristan:
Thank you for your feedback. Currently we here will handle the "all radio buttons together" problem. For all other problems (I will decide when your information is complete) I will open separate bugs and set you to CC. To keep this report clear, please do not comment here concerning any other problems.

Still waiting for your information concerning
- Your Operating System (Version, language)
- Your LibO UI language
- Your observations using Menu 'File -> Export as PDF'
- Your observations with WRITER, CALC

Useful might be additional information concerning your selection in Menu 
'Tools -> Options -> -> LibO -> General -> Open/Save dialogs' and may be screenshots.
Comment 7 Tristan Miller 2011-09-05 03:30:05 UTC
Dear Rainer,

I respond to your points below:

> Your Operating System (Version, language)
> Your LibO UI language

I can reproduce the problem with the following two systems:

1) LibreOffice 3.4.2 OOO340m1 (Build:203) (installed from the tarballs on the LibreOffice website) using US English interface, running on Ubuntu 10.04 LTS for x86-64 with LANG=en_CA.utf8

2) LibreOffice 3.3.1 OOO330m19 (Build:8) tag libreoffice-3.3.1.2 (installed from openSUSE RPMs) using US English interface, running on openSUSE 11.3 for x86-64 with LANG=en_US.UTF-8

> Your observations using Menu 'File -> Export as PDF'

On my systems File->Export as PDF allows you to export the selection by selecting the "Selection" radio button from the "Range" set.  This works as expected (except that, as mentioned in my last comment, the page size is too large).

> Your observations with WRITER, CALC

The problem of the File->Export "Selection" checkbox value not being propagated to the "PDF Options" dialog occurs in Draw, Writer, Calc, and Impress.  It is necessary to select the "Selection" radio button from the "Range" set on the "PDF Options" dialog in order to have the selection exported.

> Useful might be additional information concerning your selection in Menu 
'Tools -> Options -> -> LibO -> General -> Open/Save dialogs'

On System 1, that section has a checkbox field for "Use LibreOffice dialogs".  The box is not checked.  On System 2, there is no section by that name.

> and may be screenshots.

If there's anything in particular you'd like screenshots of, let me know.
Comment 8 Björn Michaelsen 2011-12-23 12:31:46 UTC Comment hidden (obsolete)
Comment 9 sasha.libreoffice 2012-03-01 07:00:06 UTC
not reproduced problem in 3.3.4 and 3.5.0 on Fedora 64 bit
please, verify if problem still persist
Comment 10 Tristan Miller 2012-04-06 12:00:23 UTC
Problem still exists with LibreOffice 3.5.2.2.  With File->Export and File->Export as PDF, only the selection is exported, but the page size is still too large.
Comment 11 Tristan Miller 2012-08-15 18:59:09 UTC
Problem still exists with LibreOffice 3.6.0.4.  With File->Export and
File->Export as PDF, only the selection is exported, but the page size is still
too large.
Comment 12 dror_lev 2012-09-06 14:34:54 UTC
Confirmed in Writer of LibreOffice 3.5.4.2 Build ID: 350m1(Build:2), under Ubuntu 12.04.

Is there a plan to fix this?
Comment 13 sasha.libreoffice 2012-09-07 05:45:35 UTC
> Is there a plan to fix this?
No. Bug are fixed without plan.

This bug somehow resembles Bug 30944
Comment 14 dror_lev 2012-10-07 11:34:47 UTC
As discussed in this forum thread: http://libreofficeforum.org/node/4183 , 
this problem might be related to a bug in poppler: 
https://bugs.freedesktop.org/show_bug.cgi?id=30692

I think it's worth noting that this is a fundamental problem, reported for various applications of LibO: Writer, Calc, Draw. 

Is there anyone working on a fix for this bug?
Comment 15 QA Administrators 2015-01-05 17:50:58 UTC Comment hidden (obsolete)
Comment 16 Tristan Miller 2015-01-06 09:33:44 UTC
Problem is still reproducible, exactly as before, with LibreOffice 4.3.5.2.0+ on openSUSE 13.2.
Comment 17 Francesco Frassinelli 2015-06-10 17:25:27 UTC
Same bug on Writer, but images and html exports are affected too:
https://bugs.documentfoundation.org/show_bug.cgi?id=89077
Comment 18 Antonello 2015-09-25 07:29:47 UTC
This bug is still present in all lo programs, at least up to Libreoffice 4.2.8.2 in ubuntu: when you export to pdf a document while selecting an object, even if you specify the "selection" option in the "range" field of the export dialog, the whole page is exported and not just the selection.

I am attaching the following documents:
- very basic sample lo document
- screnshoot of the export dialog
- resulting pdf (the whole page and not just the selection)
Comment 19 Antonello 2015-09-25 07:30:24 UTC
Created attachment 119014 [details]
Sample document to be exported
Comment 20 Antonello 2015-09-25 07:31:24 UTC
Created attachment 119015 [details]
Screenshot of the export dialog
Comment 21 Antonello 2015-09-25 07:32:01 UTC
Created attachment 119016 [details]
Exported pdf (the whole page instead of just the object)
Comment 22 Tristan Miller 2015-09-25 08:48:21 UTC
Antonello, I don't think it's useful to confirm the bug is present in 4.2.8.2 when previous comments have already shown it to be reproducible in 3.4.2 through 4.3.5.2.

That said, I can confirm that the bug still exists in more recent versions (at least up to 5.0.2.2).
Comment 23 Buovjaga 2015-09-29 13:58:16 UTC
*** Bug 79262 has been marked as a duplicate of this bug. ***
Comment 24 Heiko Tietze 2016-05-10 08:37:09 UTC
Agree with Tristan (comment #5). See also the Bounding Box issue.
Comment 25 Cor Nouws 2016-05-10 08:54:54 UTC
So do I understand correct that the problem is that the 'Selection' option does not work for an object?
I would expect it does work for selected pages, but that does not work either.
How should I read " all 3 options selected together " ?
Comment 26 Heiko Tietze 2016-05-10 09:51:29 UTC
(In reply to Cor Nouws from comment #25)
> So do I understand correct that the problem is that the 'Selection' option
> does not work for an object?
> I would expect it does work for selected pages, but that does not work
> either.
> How should I read " all 3 options selected together " ?

Exporting the selection keeps the page size leading to, for instance, an A4 page with a small shape on it that has been selected for export. Other programs like Inkscape or Gimp show a dialog how to deal with the selection where the bounding box comes into play, IMHO.
Tristan's suggestion was also to check export to selection automatically when parts of the drawing are selected. This is quite common and makes sense.
Comment 27 Heiko Tietze 2016-05-10 09:55:26 UTC
*** Bug 73657 has been marked as a duplicate of this bug. ***
Comment 28 V Stuart Foote 2016-08-11 23:59:05 UTC
*** Bug 101454 has been marked as a duplicate of this bug. ***
Comment 29 V Stuart Foote 2016-08-12 00:10:20 UTC
*** Bug 55317 has been marked as a duplicate of this bug. ***
Comment 30 V Stuart Foote 2016-08-12 00:18:06 UTC
Selection button behavior was not an issue. Only valid issue is of the size of the exported PDF not matching the bounding box of the selected objects. The size to selected objects behavior is correct for other export types--but is wrong for the PDF export filter handling.
Comment 31 Antonello 2016-08-16 12:57:16 UTC
I am updating the hardware configurations relative to this bug to "All cpu" / "All OS", as according to comment 3 in duplicated bug 101454 (https://bugs.documentfoundation.org/show_bug.cgi?id=101454#c3) the export to PDF filter does not adjust the page size to selected objects also in Windows and not just in Linux.
Comment 32 daviding 2017-07-23 17:00:39 UTC
PDF export with selection still exports as full page size, as compared with SVG export with ONLY the selection.

LibreOffice Draw
Version: 5.3.1.2
Build ID: 1:5.3.1-0ubuntu2
CPU Threads: 4; OS Version: Linux 4.10; UI Render: default; VCL: kde4; Layout Engine: new; 
Locale: en-CA (en_CA.UTF-8); Calc: group

This version of LO is installed with Kubuntu 17.04.

I've taken the workaround to use pdfcrop, as described at https://ask.libreoffice.org/en/question/46081/export-as-pdf-image-instead-of-pdf-page-in-draw/
Comment 33 V Stuart Foote 2018-01-18 19:39:27 UTC
*** Bug 114729 has been marked as a duplicate of this bug. ***