[Ipe-discuss] Script to export all views from all pages of the Ipe drawing

Wojciech Zabolotny wzab01 at gmail.com
Tue Jun 5 14:29:41 CEST 2018


I have finally found the right solution. I have forgotten, that
iperender may export
in PDF format. (In my debian/testing system "man iperender" does not inform
about the "-pdf" option).

The right solution is to replace the:

 do
    fout=fbase .. "-p-" .. p .. "-v-" .. v
    feps=fout .. ".eps"
    fpdf=fout .. ".pdf"
    os.execute("iperender -eps -page " .. p .. " -view " .. v .. " "
.. fname .. " " .. feps)
    os.execute("epstopdf ".. feps .. " " .. fpdf)
    os.execute("rm " .. feps)
  end

section with:

  do
    fout=fbase .. "-p-" .. p .. "-v-" .. v .. ".pdf"
    --print("exporting to: " .. fout)
    os.execute("iperender -pdf -page " .. p .. " -view " .. v .. " "
.. fname .. " " .. fout)
  end

Now the created PDFs are really small, and all have the same BoundingBox.

Regards,
Wojtek

2018-06-05 1:19 GMT+02:00 Wojciech Zabolotny <wzab01 at gmail.com>:
> Hi,
> Well, i have found that the new approach with independent export via
> iperender has significant disadvantage. The bounding box is calculated
> for each view independently, so the final efect in beamer "animation"
> is unacceptable.
> So the question how to efficiently export all views from complex Ipe
> file (like my heapsort.ipe) is still valid...
> Regards,
> Wojtek
>
> 2018-06-05 0:56 GMT+02:00 Wojciech Zabolotny <wzab01 at gmail.com>:
>> i,
>>
>> It seems, that the problem is not related to representation of Ipe objects.
>> I have prepared two demos: heapsort1.ipe (it was the file I was working
>> with, when I discovered the problem) and test1.ipe (very simple file).
>> I send two scripts exporting all views.
>> expallviews1.lua uses ipelib and exports via doc:exportView.
>> expallviews2.lud calls external programs (iperender and epstopdf) to
>> export to PDF.
>> Please note, that the first one creates huge PDFs hor heapsort1.ipe,
>> while the second one creates much smaller PDFs.
>> The huge PDFs however compress very good with gzip.
>> For test1.ipe, the first script creates smaller PDFs.
>> I'd really like to understand the issue and to create a good method
>> to efficiently export all views without calling external programs.
>>
>> Regards,
>> Wojtek
>>
>> 2018-06-04 12:57 GMT+02:00 Nathaniel Cunningham
>> <nathaniel.cunningham at gmail.com>:
>>> Wojtek,
>>> Don't forget that Ipe stores its own extra data in PDF files, in order that
>>> they can be opened again by Ipe. From the manual at
>>> http://ipe.otfried.org/manual/manual_2.html:
>>> "[PDF] files created by Ipe contain a special hidden stream that describes
>>> the Ipe objects. (So if you edit your Ipe-generated PDF file in a different
>>> program such as Adobe Acrobat, Ipe will not be able to read the file again
>>> afterwards.)"
>>>
>>> I don't know if that accounts for all the size difference you're seeing, but
>>> you can test it by opening and saving the PDF with some other program. If
>>> that takes care of the size difference, maybe you could add a step in your
>>> script where some other program reads and saves the PDF?
>>>
>>> -- Nathaniel
>>>
>>>
>>> On Mon, Jun 4, 2018 at 12:41 PM, Wojciech Zabolotny via Ipe-discuss
>>> <ipe-discuss at lists.science.uu.nl> wrote:
>>>>
>>>> I have noticed, that my script exports huge PDF files. I can get much
>>>> smaller PDFs, when I use GUI and:
>>>> 1. Set the desired View
>>>> 2. Export it to EPS
>>>> 3. Run "epstopdf" to convert EPS to PDF.
>>>>
>>>> Unfortunately, exportView does not support "eps" format. It is
>>>> obvious, because the source code contains:
>>>>
>>>> bool Document::exportView(const char *fname, TFormat format, uint flags,
>>>>                           int pno, int vno) const
>>>> {
>>>>   if (format != EPdf)
>>>>     return false;
>>>>
>>>> GUI does something different:
>>>>
>>>> function MODEL:action_export_eps()
>>>> [...]
>>>>     self.ui:renderPage(self.doc, self.pno, self.vno,
>>>>                        "eps", s, 1.0, false, false)
>>>>
>>>> Unfortunately, the ui and its renderPage method seems to be not
>>>> available for ipelets...
>>>> Is it possible to efficiently export views from ipelet?
>>>>
>>>> TIA & Regards,
>>>> Wojtek
>>>>
>>>> 2018-05-13 22:42 GMT+02:00 Wojciech Zabolotny <wzab01 at gmail.com>:
>>>> > The first version of my script does not properly export LaTeX objects.
>>>> > It is necessary to add doc:runLatex right after loading of the IPE
>>>> > drawing:
>>>> >
>>>> > doc = ipe.Document(fname)
>>>> > doc:runLatex()
>>>> >
>>>> > After that modification, LaTeX equations and texts are rendered
>>>> > correctly.
>>>> > --
>>>> > Regards,
>>>> > Wojtek
>>>>
>>>>
>>>>
>>>> --
>>>> Wojciech M. Zabołotny
>>>> My GPG/PGP keys:
>>>> standard: 8192R/FE58A848 (0720 9430 85DB 7CCD F4C5  5F1E 5107 91FB FE58
>>>> A848)
>>>> confidential: 16384R/C76D2FB0 (C4E7 9597 CF22 7B5D 28BF  4656 FED7
>>>> A63F C76D 2FB0)
>>>> _______________________________________________
>>>> Ipe-discuss mailing list
>>>> Ipe-discuss at lists.science.uu.nl
>>>> https://mailman.science.uu.nl/mailman/listinfo/ipe-discuss
>>>
>>>
>>
>>
>>
>> --
>> Wojciech M. Zabołotny
>> My GPG/PGP keys:
>> standard: 8192R/FE58A848 (0720 9430 85DB 7CCD F4C5  5F1E 5107 91FB FE58 A848)
>> confidential: 16384R/C76D2FB0 (C4E7 9597 CF22 7B5D 28BF  4656 FED7
>> A63F C76D 2FB0)
>
>
>
> --
> Wojciech M. Zabołotny
> My GPG/PGP keys:
> standard: 8192R/FE58A848 (0720 9430 85DB 7CCD F4C5  5F1E 5107 91FB FE58 A848)
> confidential: 16384R/C76D2FB0 (C4E7 9597 CF22 7B5D 28BF  4656 FED7
> A63F C76D 2FB0)



-- 
Wojciech M. Zabołotny
My GPG/PGP keys:
standard: 8192R/FE58A848 (0720 9430 85DB 7CCD F4C5  5F1E 5107 91FB FE58 A848)
confidential: 16384R/C76D2FB0 (C4E7 9597 CF22 7B5D 28BF  4656 FED7
A63F C76D 2FB0)


More information about the Ipe-discuss mailing list