View Single Post
 
Old 11-27-2016, 10:53 AM
Kugelfang's Avatar
Kugelfang Kugelfang is offline
Member
 
Join Date: Feb 2009
Location: Silver Spring, MD, USA
Posts: 280
Total Downloaded: 37.97 MB
Quote:
... so I suppose your solution used some extension or simulated pages with layers....
Yes. I have a layer which I use as a template for letter sized pages which shows a 7x10 print area. On this layer is a matrix of objects named 'page1','page2', etc.

The following shell script iteratively opens Inkscape, selects page# object, sets the viewport canvas to the page#, saves the file, closes the file, exits Inkscape. Next the script calls Inkscape (without opening the GUI) and exports the veiw port to a page#.pdf file.

Once all the pages have been exported, the script uses the program pdftk to combine the separate pages into a multi-page pdf and then deletes the individual pages.

It's kludgey and slow, but it keeps me from making stupid mistakes exporting the pages by hand.

Here's the Linux bash script if anyone is interested in implementing it on their computer (I imagine it would look quite similar in a Windows bat file):

Code:
#!/bin/bash
# Extract PDF pages from large Inkscape file

#change to reflect file to be saved as pdf
in_file="*1122.svg"
out_file='LZ-17_20161122b.pdf'
page_count=15

number=1
file_list=''

echo "*** Starting PDF export of $in_file to $out_file ($page_count pages) ***"

while [ $number -le $page_count ]; do

  #these verb commands only work with the Inkscape GUI open
  ( inkscape $in_file --select=page$number --verb=ZoomSelection --verb=FitCanvasToSelection --verb=FileSave --verb=FileClose --verb=FileQuit ) 

  #export command only works with Inkscape GUI closed -- it exports the canvas area which is selected above
  ( inkscape $in_file --export-pdf page$number.pdf )

  file_list+=" page$number.pdf"
  echo "    File page$number.pdf created"

  number=$((number + 1))
done

echo "    Concatenating pages to a single PDF file."
(pdftk $file_list cat output $out_file)
echo "    Removing individual page files."
(rm $file_list)
echo "*** Done ***"
Reply With Quote