Bug 81118 - Add "Fit page size to drawing" functionality (e.g. to Page Properties dialog)
Summary: Add "Fit page size to drawing" functionality (e.g. to Page Properties dialog)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: high enhancement
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
: 67952 98786 123853 128416 156702 158911 (view as bug list)
Depends on:
Blocks: Draw-UX Page
  Show dependency treegraph
 
Reported: 2014-07-09 16:28 UTC by Callegar
Modified: 2024-01-02 18:29 UTC (History)
18 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Callegar 2014-07-09 16:28:22 UTC
Problem description:

When creating drawings for publications, one typically needs a page size as large as the drawing itself.

Currently, this result is hard to achieve. One needs to work on a standard page size larger than the drawing (e.g. A4). Then the drawing is exported to PDF and finally the PDF is cropped with the pdfcrop utility from the command line.

It would be nice if Libreoffice draw knew how to automatically adjust th page size to the actual elements that are drawn on the page.

Inkscape has a similar functionality that is in fact quite useful. In inkscape this is accessed by Document properties -> Page size -> Resize page to content.

Would be nice if LibO drawing program could get a similar functionality in its Format->Page window.  

Steps to reproduce:
1. ....
2. ....
3. ....

Current behavior:

Expected behavior:

              
Operating System: All
Version: 4.3.0.2 rc
Comment 1 tommy27 2014-07-09 18:56:09 UTC
enhancement request. status NEW. version changed to "inherited from OOo"
Comment 2 QA Administrators 2015-07-18 17:43:47 UTC Comment hidden (obsolete)
Comment 3 Callegar 2015-07-20 08:44:07 UTC
Still valid as of 5.0.0.3
Comment 4 tommy27 2015-07-20 08:59:54 UTC
@Jay
one of you?
Comment 5 Yousuf Philips (jay) (retired) 2015-07-22 16:20:26 UTC
Think this is a useful enhancement and think the command should also be accessible in the Format or Modify menu.
Comment 6 Heiko Tietze 2016-06-15 13:09:50 UTC
(In reply to sergio.callegari from comment #0)
> When creating drawings for publications, one typically needs a page size as
> large as the drawing itself.

You can change the page size to, for instance, A0 and zoom in/out. And you may also scale the complete drawing per Tools > Options > LibO Draw > General > Scale > Drawing Scale to achieve the same result without zooming. What is missing?

(In reply to sergio.callegari from comment #0)
> It would be nice if Libreoffice draw knew how to automatically adjust th
> page size to the actual elements that are drawn on the page.

When you select a couple of objects and export them using the option "selection" the output will have the size of what you have selected. Resizing a page makes not much sense to me.
Comment 7 Callegar 2016-06-15 13:28:01 UTC
>> When creating drawings for publications, one typically needs a page size as
>> large as the drawing itself.

> You can change the page size to, for instance, A0 and zoom in/out. And you may
> also scale the complete drawing per Tools > Options > LibO Draw > General >
> Scale > Drawing Scale to achieve the same result without zooming. What is 
> missing?

Thanks for looking into it, but zoom and drawing scale are a very different thing from what is being asked.

Zoom has to do with the Libreoffice UI, namely the way in which a drawing is visualized. Scale has to do with the way in which LibO interprets distances on the drawing.

What is being asked has to do with the drawing page size, as follows.

Suppose that I make a drawing containing elements that fit in a box that is 10cm by 5cm. Now, what I am looking for is a function assuring that once invoked the drawing page size is made exactly 10cm by 5cm. Namely I would like to get a function that sets the page size to exactly contain the drawing elements *with no margin*. With this, after I export to PDF, I get a document that also contains the drawing without margins. This is indispensable for many real world publication flows (e.g. those for scientific papers. I can detail these if needed).

> When you select a couple of objects and export them using the option
> "selection" the output will have the size of what you have selected. Resizing
> a page makes not much sense to me.

Have you actually tried? Unfortunately, it does not, at least not as far as export to PDF is concerned on LibO 5.1.4.1. If you have a drawing on say an A4 page, and select some objects then export the selection to PDF, you get an A4 page with those objects. Furthermore, flows exist which manage images directly in ODF format and also for them (which involve no "export") the page size needs to be set correctly.
Comment 8 V Stuart Foote 2016-06-15 15:45:54 UTC
(In reply to sergio.callegari from comment #7)

>> Resizing  a page makes not much sense to me.
> 

@Heiko, when using Draw for illustrations, starting with "canvas" at one of the default page sizes (or first setting a custom size)--as the drawing is being finalized it is common to need to adjust the size of the "canvas" to fit the drawing elements. It is also common to need to remove the margins (set to zero), early in the session.

> > When you select a couple of objects and export them using the option
> > "selection" the output will have the size of what you have selected. 
...
> Have you actually tried? Unfortunately, it does not, at least not as far as
> export to PDF is concerned on LibO 5.1.4.1. If you have a drawing on say an
> A4 page, and select some objects then export the selection to PDF, you get
> an A4 page with those objects. Furthermore, flows exist which manage images
> directly in ODF format and also for them (which involve no "export") the
> page size needs to be set correctly.

Heiko is correct, the export of selection happens with raster and vector export formats sizing to a bounding box of the selected Draw objects--regardless of the background page--which can simply not be selected. Although there is a loss of background set on the page, significant in composition when using transparency within the selected objects, but that is another issue.

Unfortunately the export filter for PDF is more restrictive. The Page size of the document as set is used by the filter (and Draw objects extending beyond page margins are clipped)--the exported PDF receives that page size. And so the page must be resized prior to the export. Ability to easily resize the page "canvas" to all existing Draw objects, or even to just the selected objects would be a useful enhancement.

And as noted--OLE work flows that make use of the ODG, or export to other ODF formats are better served with an ability to adjust to Draw document page size as illustrations are being finalized.
Comment 9 Heiko Tietze 2016-06-30 14:01:43 UTC
From duplicate bug 67952:

Owen Genat (retired) 2013-12-21 11:09:49 UTC
Related AskLO thread:
http://ask.libreoffice.org/en/question/18185/how-to-adjust-page-size-to-fit-an-object/

I agree this would be a good feature to have. Confirmed. Status set to NEW. Component set to Drawing. Version set to Inherited From OOo as this has never been possible in LO.
Comment 10 Heiko Tietze 2016-06-30 14:02:37 UTC
*** Bug 67952 has been marked as a duplicate of this bug. ***
Comment 11 Marcel Partap 2017-08-09 17:34:10 UTC
Actually, this would be very useful as well for spreadsheets, i.e. for PDF-exporting each sheet onto a sufficiently large page.
Comment 12 Joel Greenyer 2018-01-27 14:32:51 UTC
This feature is very useful in InkScape and I miss it in LibreOffice since YEARS. I always wanted to write a feature request for this, but always secretly hoped that such a simple feature MUST be coming soon---I've yet waited in vain.


I would like to have button in the Page Properties view, Page Format section, to select "Fit page size to contents". When pressed, it should calculate the width and height of the contents of the current page and write the result into the width and height text fields of that dialog. An extra action in the Format menu to reformat the page based on its contents with one click would be nice as well.

However, keep in mind one tricky detail, namely that this feature must properly consider the BORDER THICKNESS of objects as well:
Suppose your page contents is a single rectangle of width X and height Y, and it has a border thickness T, then the overall visible rectangle has width X+T and height Y+T, and this is the page format that should, in my opinion, be calculated by new feature.
Comment 13 l0f4r0 2019-03-14 07:31:11 UTC
*** Bug 123853 has been marked as a duplicate of this bug. ***
Comment 14 V Stuart Foote 2019-10-27 17:41:58 UTC
*** Bug 128416 has been marked as a duplicate of this bug. ***
Comment 15 Heiko Tietze 2020-01-20 09:09:34 UTC
Let's have an option to _automatically_ enlarge the page (bug 98786) and another command to _manually_ fit the page size to drawings.

Interestingly this request seems to be of more interest than the enlargement.
Comment 16 Philippe Morin 2021-03-24 13:22:34 UTC
Similar feature is available in Visio and I LOVE it! Very useful for tech trees or things like that (family trees)
Comment 17 Heiko Tietze 2021-03-24 15:39:20 UTC
Either we have to allow individual page sizes first, see bug 49787, or have to take the largest drawing on all pages as basis.
Comment 18 Callegar 2021-03-24 15:51:41 UTC
Maybe a further alternative could be to gray out the option for multipage docs, since this would be mainly meant for single images.
Comment 19 Philippe Morin 2021-03-24 15:56:24 UTC
(In reply to Heiko Tietze from comment #17)
> Either we have to allow individual page sizes first, see bug 49787, or have
> to take the largest drawing on all pages as basis.

Oh. Indeed. On Visio, the feature works on each pages. This is what I'm expecting. :P Thanks for the reference to the other bug!
Comment 20 Heiko Tietze 2023-08-15 14:37:48 UTC
*** Bug 156702 has been marked as a duplicate of this bug. ***
Comment 21 Eyal Rozenberg 2023-08-16 16:47:20 UTC Comment hidden (obsolete)
Comment 22 Eyal Rozenberg 2023-08-16 16:52:47 UTC
So, in the dupe bug  156702, I specifically argued that this should be placed in:

1. The Page menu, as a "Crop to contents" entry, a "Crop to Selection" entry, or both (in or without a submenu).
2. The context menu of a selection, with a "Crop page to Selection" item.

and perhaps also in:

3. The context menu for the back surface of a document with a "Crop page to Contents" entry.

The Page Properties dialog might be a good option in itself, but it's certainly not the only option, and I actually believe this should be added in more than one place (although maybe not 4 places).
Comment 23 Stéphane Guillou (stragu) 2023-12-28 17:31:05 UTC
*** Bug 158911 has been marked as a duplicate of this bug. ***
Comment 24 Heiko Tietze 2024-01-02 09:58:21 UTC
(In reply to Stéphane Guillou (stragu) from bug 98786 comment 11)
> In my opinion, this should be marked as duplicate of bug 81118.
> 
> If implemented, it would be straight forward to have both options in the
> Page Properties dialog.
> - a button to fit the page size to existing objects, whenever the user wants
> to;
> - a tick box to automatically do that any time the move of an object changes
> the size of the rectangle that includes all objects.
Comment 25 Heiko Tietze 2024-01-02 09:58:32 UTC
*** Bug 98786 has been marked as a duplicate of this bug. ***