drawio-batch icon indicating copy to clipboard operation
drawio-batch copied to clipboard

add crop option for PDF format

Open WorkingDevel opened this issue 5 years ago • 3 comments

Added an option '-c' to add the ability to export a cropped version of PDF instead of the paginated. So it is now possible to export the draw as a whole one page PDF.

It's a little hack by setting negativ height that leads to skip pagination for PDF format in export3.html (line 231):

// Handles PDF output where the output should match the page format if the page is visible
if (data.format == 'pdf' && xmlDoc.documentElement.getAttribute('page') == '1' && data.w == 0 && data.h == 0)

WorkingDevel avatar Mar 29 '19 14:03 WorkingDevel

Thanks for the PR!

Is this intended to crop a one-page document to the boundaries of the drawing? In case you want that, you can uncheck the "page view" option in the document and the PDF is automatically generated to be only the drawing.

languitar avatar Mar 29 '19 16:03 languitar

Actually it is intended to crop any drawing to its boundaries so I get a one-page PDF even the drawing spreads about multiple pages. Is unchecking the "page view" option doing the same? I need to check...

WorkingDevel avatar Mar 31 '19 13:03 WorkingDevel

I haven't used multi-page documents much, but for a single page this effectively crops to the drawing.

languitar avatar Mar 31 '19 13:03 languitar