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

When using the command line export tool the page index, and page range arguments have unexpected behaviour

Open casperlamboo opened this issue 4 years ago • 5 comments

Preflight Checklist

  • [x] I agree to follow the Code of Conduct that this project adheres to.
  • [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Describe the bug I'm using the command line tool to export specific pages from my draw.io document. According to draw.io --help this can be achieved by using the page (-p) argument.

  -p, --page-index <pageIndex>       selects a specific page, if not specified
                                     and the format is an image, the first page
                                     is selected

However when I do this for lets say page 2, all pages from page 2 and up are exported (I only expected page 2 to be exported).

The range index -g argument seems to do nothing at all.

  -g, --page-range <from>..<to>      selects a page range (for PDF format only)

To Reproduce Steps to reproduce the behavior:

  1. Download pages.drawio.zip
  2. In your command line navigate to the file and execute $ draw.io -x ./pages.drawio -f pdf -p 2 -o ./page_index.pdf. For good measure also execute $ draw.io -x ./pages.drawio -f pdf -g 2..2 -o ./page_range.pdf

Expected behavior For files page_index.pdf and page_range.pdf only page 2 is exported. While in reality all pages are exported for page_range.pdf and pages 2 and up are exported for page_index.pdf.

Screenshots Not applicable

draw.io version (In the Help->About menu of the draw.io editor):

$ draw.io -V
14.6.13

Desktop (please complete the following information): Desktop, MacOS V10.15.7

Smartphone (please complete the following information): Not applicable

Additional context Not applicable

casperlamboo avatar Jun 16 '21 09:06 casperlamboo

I have the same problem on Windows 10, using draw.io version 18.0.0. My workaround is to only have one page per document.

romankarlstetter avatar May 05 '22 08:05 romankarlstetter

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. See the FAQ for more information.

stale[bot] avatar Mar 25 '23 15:03 stale[bot]

Same bug with version 21.1.2 running in linux. Curiously, if the generated multi-page PDF is included in Latex as a figure, only the first page is shown, while opening the .pdf file in a pdf viewer shows all pages.

@casperlamboo while waiting for the fix, I just use pdftk to cut the first page:

find . -name '*.drawio' -print0 |
  sed 's/.drawio//g' |
  xargs --no-run-if-empty --verbose --null --replace='{}' \
  drawio '{}.drawio' --transparent --crop --export --output '{}.allpages.pdf'

find . -name '*.allpages.pdf' -print0 |
  sed 's/.allpages.pdf//g' |
  xargs --no-run-if-empty --verbose --null --replace='{}' \
  pdftk '{}.allpages.pdf' cat 1 output '{}.pdf'

find . -name '*.allpages.pdf' -print -delete

baldassarreFe avatar Mar 31 '23 15:03 baldassarreFe