I know that I can extract a single view from a .ipe file with iperender -eps -view 3 a.ipe a3.eps.

I want to create a script that takes a .ipe file as argument, and extracts all views, independent on how many views the .ipe file has.

For that I need a function to count the views in the .ipe file. I could just try to extract view by view until it fails, but this seems like an unvaforable solution. Then, if iperender fails for a different reason, it would fail silently.

Is there any ipe-related tool that just prints the amount of views in a .ipe file?

1 Answer 1


The IPE file format is xml, therefore you can use general xml tools for this. For example the following IPE page that contains two views, one with a rectangle and another with two rectangles:

<layer name="alpha"/>
<layer name="beta"/>
<view layers="alpha" active="alpha"/>
<view layers="alpha beta" active="beta"/>
<path layer="alpha" stroke="orange">
16 832 m
16 800 l
48 800 l
48 832 l
<path layer="beta" stroke="orange">
64 784 m
64 816 l
32 816 l
32 784 l

You can see the two view tags at the start. With xmllint for example (there are many other possible tools) you can extract the number of tags (from https://stackoverflow.com/a/35576314/):

xmllint --xpath "count(//view)" myfile.ipe

Put this in a small bash script:

nrviews=`xmllint --xpath "count(//view)" $1`
fbase=`basename "$1"`
for VIEW in $(seq 1 $nrviews)
    iperender -eps -view $VIEW $1 $fname.$VIEW.eps

Example output: enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .