[Ipe-discuss] Script to export all views from all pages of the Ipe drawing
Wojciech Zabolotny
wzab01 at gmail.com
Tue Jun 5 00:56:56 CEST 2018
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test1.ipe.gz
Type: application/gzip
Size: 1487 bytes
Desc: not available
URL: <https://mailman.science.uu.nl/pipermail/ipe-discuss/attachments/20180605/11c6d354/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: heapsort.ipe.gz
Type: application/gzip
Size: 5319 bytes
Desc: not available
URL: <https://mailman.science.uu.nl/pipermail/ipe-discuss/attachments/20180605/11c6d354/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: expallviews2.lua.gz
Type: application/gzip
Size: 908 bytes
Desc: not available
URL: <https://mailman.science.uu.nl/pipermail/ipe-discuss/attachments/20180605/11c6d354/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: expallviews1.lua.gz
Type: application/gzip
Size: 855 bytes
Desc: not available
URL: <https://mailman.science.uu.nl/pipermail/ipe-discuss/attachments/20180605/11c6d354/attachment-0007.bin>
More information about the Ipe-discuss
mailing list