Print PDF version of a Sozi presentation

1,620 views
Skip to first unread message

Brunetto Ziosi

unread,
Sep 1, 2012, 9:54:00 AM9/1/12
to sozi-...@googlegroups.com
Hi all!
I know that it should already be asked somewhere, but is there a way to obtain a pdf version of a sozi presentation?
It's ok something like the screenshot of every "slide".
Sometime it could be useful to have a pdf "fallback" option or to give the presentation to be published or stored with other pdf presentation.
Thanks

brunetto 

Guillaume Savaton

unread,
Sep 1, 2012, 10:06:47 AM9/1/12
to sozi-...@googlegroups.com
2012/9/1 Brunetto Ziosi <brunett...@gmail.com>:
> I know that it should already be asked somewhere, but is there a way to
> obtain a pdf version of a sozi presentation?
> It's ok something like the screenshot of every "slide".

Exporting to PDF is still not supported.
It is not a technical issue: I believe someone will implement it, someday.

There are many feature requests pending, and not enough time to
implement them all.

Guillaume

Eduardo Mercovich

unread,
Sep 3, 2012, 8:55:43 AM9/3/12
to sozi-...@googlegroups.com
Hi.
While it's not automated, can't you do that directly from Inkscape?

--
e

brunetto

unread,
Sep 3, 2012, 9:04:19 AM9/3/12
to sozi-...@googlegroups.com
Yes but if I have for example 50 "sozi frame" (=resultin slides) it's a long and boring task!
 Is there a way to automate the "select and export" actions?

--
Brunetto Ziosi

PhD Student in Astronomy
homepage: http://www.brunettoziosi.eu
Department of Physics and Astronomy
University of Padova
Vicolo dell'Osservatorio 3
35122 Padova

André Lage

unread,
Sep 3, 2012, 3:28:39 PM9/3/12
to sozi-...@googlegroups.com
Maybe I'm saying something nonsense, but try to print PDFs by using a
browser in a 'bash for' for instance. Then merge them all into a
single PDF.

Something like this (that does NOT work, fix it!):

#!/bin/bash

FILE=/home/alage/my-presentation.svg

N_OF_FRAMES="10"

# generating a PDF for each frame
for FRAME in `seq N_OF_FRAMES`; do
firefox -print $FILE#$FRAME -printmode pdf -printfile $FILE#$FRAME.pdf;
done

# merging'em'all
pdftk *pdf cat output $FILE.pdf


If you manage to do so, please share :-)


André Lage.

Rufus Fraanje

unread,
Sep 25, 2012, 4:15:13 PM9/25/12
to sozi-...@googlegroups.com
I use the Pearl Crescent page-saver plugin (http://pearlcrescent.com/products/pagesaver/) to print a png file for each slide (use %u in the file name pattern to properly number each file).
Then, with a simple shell script as listed below one can collect all the png files into one pdf file:

#!/bin/zsh
# collect_png2pdf filebasename number
#
# converts the set of png's:
#   filebasename1..number.png
# into one pdf file with the name filebasename.pdf

# first convert png to pdf:
for i in {1..$2}
do
    convert $1#$i.png $1_$i.pdf;
done

# collect all pdf's
cp $1_1.pdf $1.pdf

for i in {2..$2};
do
    pdftk $1.pdf $1_$i.pdf cat output $1_bak.pdf;
    mv $1_bak.pdf $1.pdf;
done;

# clean up pdf's
for i in {1..$2};
do
    rm -f $1_$i.pdf
done;

Though it might not be the best and easiest, this solution does the job. Better solutions are welcome!

Guillaume Savaton

unread,
Sep 25, 2012, 4:45:52 PM9/25/12
to sozi-...@googlegroups.com
Hi,

An experimental tool to convert Sozi presentations to PDF is available
in the development version.
https://github.com/senshu/Sozi/tree/dev/tools

Run "sozi2pdf.py --help" for a list of options.

Sozi2PDF is written in Python and Javascript and makes use of
PhantomJS for playing the presentation.
It also uses PDFJam for joining all frames into a single PDF document.
PDFJam is based on PDFLatex, so maybe another solution would be
preferable to avoid adding another dependency to Sozi.

I see several benefits to using Python and PhantomJS:
- PDF export can/will be implemented as an Inkscape extension
- PhantomJS generates PDF natively, preserving the text from your SVG document
- PhantomJS runs on Linux and Windows
- The same technique can/will be used to export Sozi presentation as
videos (see https://github.com/senshu/Sozi/issues/15 for a discussion
about this)

What is your opinion on this?

Guillaume

André Lage

unread,
Sep 26, 2012, 4:33:45 PM9/26/12
to sozi-...@googlegroups.com
Hi Guillaume,

It is much more better than my workaround.

BTW, I've just tried to use it and I got the following problem:

http://pastebin.com/BsrVbUqN

Any clue?

Thanks,


André.

Guillaume Savaton

unread,
Sep 27, 2012, 2:42:12 AM9/27/12
to sozi-...@googlegroups.com
Hi André,

2012/9/26 André Lage <lage...@gmail.com>:
> BTW, I've just tried to use it and I got the following problem:
>
> http://pastebin.com/BsrVbUqN
>
> Any clue?

Have you upgraded your document to Sozi 12.09?
I think PDF export will not work for earlier versions.

Guillaume

Rufus Fraanje

unread,
Sep 27, 2012, 2:46:16 PM9/27/12
to sozi-...@googlegroups.com


Dear Guillaume,

Great tool! I needed to convert some utf-8 symbols like • and θ to paths, but that's not a problem. In my final presentation anyway I convert text to paths to have nicer text.

Thanks, I'm gonna use it.

Rufus
 

André Lage

unread,
Sep 27, 2012, 4:51:42 PM9/27/12
to sozi-...@googlegroups.com
Hi,

I upgraded my Sozi 12.05 to 12.09 but no way :-(

Now it complains about the java script:

http://pastebin.com/gH9CikY1

I'm sending attached the presentation I created by using Sozi 12.09.

Thanks,

André.
test-sozi2pdf.svg

Guillaume Savaton

unread,
Sep 28, 2012, 1:51:59 AM9/28/12
to sozi-...@googlegroups.com
2012/9/27 André Lage <lage...@gmail.com>:
> I upgraded my Sozi 12.05 to 12.09 but no way :-(
> Now it complains about the java script:

Which version of phantomjs are you using?

It worked correctly for me (see attached file).

Guillaume
test-sozi2pdf.pdf

André Lage

unread,
Sep 28, 2012, 2:25:05 PM9/28/12
to sozi-...@googlegroups.com
$ phantomjs --version
1.4.0

André.

Guillaume Savaton

unread,
Sep 29, 2012, 12:36:07 PM9/29/12
to sozi-...@googlegroups.com
2012/9/28 André Lage <lage...@gmail.com>:
> $ phantomjs --version
> 1.4.0

Can you try with a more recent version?
I'm using phantomjs 1.6.1?

Guillaume

André Lage

unread,
Oct 24, 2012, 6:04:23 PM10/24/12
to sozi-...@googlegroups.com
Hi Guillaume,

It worked! I used:

$ phantomjs --version
1.7.0

Just to let you know that it printed some erros (even though it
managed to generate the PDF file successfully):

http://pastebin.com/gUk5bujh

Many thanks!


André.

Brunetto Ziosi

unread,
Nov 24, 2012, 12:26:44 PM11/24/12
to sozi-...@googlegroups.com
I'm sorry if a resurrect this old post but I tried sozi2pdf.py+sozi2pdf.js (downloaded from the repo)
 with both phantomjs 1.4 (ubuntu default) and 1.7 (downloaded from the site).
I obtain no error but no pdfs!

What can I do? Any suggestions?

I'm using sozi 12.09 from the PPA

thanks

brunetto

brunetto

unread,
Nov 24, 2012, 12:08:44 PM11/24/12
to sozi-...@googlegroups.com
I am using Sozi 12.09 from the PPA..

On 24 November 2012 15:46, brunetto <brunett...@gmail.com> wrote:
I'm sorry if a resurrect this old post but I tried sozi2pdf.py+sozi2pdf.js (downloaded from the repo) with both phantomjs 1.4 (ubuntu default) and 1.7 (downloaded from the site).
I obtain no error but no pdfs!

What can I do? Any suggestions?

thanks

brunetto

brunetto

unread,
Nov 24, 2012, 9:46:28 AM11/24/12
to sozi-...@googlegroups.com

Guillaume Savaton

unread,
Nov 28, 2012, 3:20:10 AM11/28/12
to sozi-...@googlegroups.com
Hi, Brunetto

On 24 November 2012 15:46, brunetto <brunett...@gmail.com> wrote:
>> I obtain no error but no pdfs!
>> What can I do? Any suggestions?

sozi2pdf runs in two steps:
1. it generates individual PDF files for all frames of your presentation
2. it merges all these files into a single PDF document.

The first step uses sozi2pdf.js with PhantomJS. Its output goes to a
temporary folder in /tmp.
The second step uses pdfjoin (provided in package texlive-extra-utils).

You can check that temporary files are generated correctly in /tmp.
The name of the subfolder for Sozi frames is chosen randomly and is
different each time.

The temporary folder is deleted when sozi2pdf completes.
You can prevent this by commenting the last line of sozi2pdf.py:

# shutil.rmtree(tmp_dir, ignore_errors=True)

If you get correct PDF files for all your frames, then you can try to
run pdfjoin manually and see the result.
In the temporary folder :

pdfjoin --output test.pdf `ls [0-9]*.pdf`

Guillaume

Brunetto Ziosi

unread,
Nov 28, 2012, 4:05:01 AM11/28/12
to sozi-...@googlegroups.com
On Wednesday, 28 November 2012 09:20:10 UTC+1, senshu wrote:

sozi2pdf runs in two steps:
1. it generates individual PDF files for all frames of your presentation
2. it merges all these files into a single PDF document. [..]

Hi Guillaume!
In the end, I'm not so sure how, I was able to run the script and obtain the pdfs!
Anyway, thank you for your help, now it works and it's great!!

Thank you

brunetto 

Charles Santana

unread,
Mar 6, 2014, 10:03:22 AM3/6/14
to sozi-...@googlegroups.com
Hi folks!

First of all: Congratulations for this amazing tool and this great sozi-community! Thank you for everything!

Sorry if I resurrect again this discussion, but I didn't find anything about the problem I am facing now with sozi2pdf.

I have phantomjs 1.9, pdfjam , and pdflatex 3.1415926-2.5-1.40.14 installed in a Debian testing linux machine. I did a presentation using Sozi 12.05 and inkscape 0.48.4-2. It worked fine but when I tried to convert it to pdf I got the following output and no pdf files:

charles@macrocosmus: ./sozi2pdf.py talk_05MAR2014.svg -W 1366 -H 768 -o talk.pdf
sozi2pdf.js> Exporting frame: 1
sozi2pdf.js> Exporting frame: 2
sozi2pdf.js> Exporting frame: 3
sozi2pdf.js> Exporting frame: 4
sozi2pdf.js> Exporting frame: 5
sozi2pdf.js> Exporting frame: 6
sozi2pdf.js> Exporting frame: 7
sozi2pdf.js> Exporting frame: 8
sozi2pdf.js> Exporting frame: 9
sozi2pdf.js> Exporting frame: 10
sozi2pdf.js> Exporting frame: 11
sozi2pdf.js> Exporting frame: 12
sozi2pdf.js> Exporting frame: 13
sozi2pdf.js> Exporting frame: 14
sozi2pdf.js> Exporting frame: 15
sozi2pdf.js> Exporting frame: 16
sozi2pdf.js> Exporting frame: 17
sozi2pdf.js> Exporting frame: 18
sozi2pdf.js> Exporting frame: 19
Writing PDF to: talk.pdf
          ----
  pdfjam: This is pdfjam version 2.08.
  pdfjam: Reading any site-wide or user-specific defaults...
          (none found)
  pdfjam: Effective call for this run of pdfjam:
          /usr/bin/pdfjam --fitpaper 'true' --rotateoversize 'true' --suffix joined --outfile talk.pdf -- /tmp/tmpN8RrxZ/01.pdf 1 /tmp/tmpN8RrxZ/02.pdf 1 /tmp/tmpN8RrxZ/03.pdf 1 /tmp/tmpN8RrxZ/04.pdf 1 /tmp/tmpN8RrxZ/05.pdf 1 /tmp/tmpN8RrxZ/06.pdf 1 /tmp/tmpN8RrxZ/07.pdf 1 /tmp/tmpN8RrxZ/08.pdf 1 /tmp/tmpN8RrxZ/09.pdf 1 /tmp/tmpN8RrxZ/10.pdf 1 /tmp/tmpN8RrxZ/11.pdf 1 /tmp/tmpN8RrxZ/12.pdf 1 /tmp/tmpN8RrxZ/13.pdf 1 /tmp/tmpN8RrxZ/14.pdf 1 /tmp/tmpN8RrxZ/15.pdf 1 /tmp/tmpN8RrxZ/16.pdf 1 /tmp/tmpN8RrxZ/17.pdf 1 /tmp/tmpN8RrxZ/18.pdf 1 /tmp/tmpN8RrxZ/19.pdf 1
  pdfjam: Calling pdflatex...
  pdfjam: FAILED.
          The call to 'pdflatex' resulted in an error.
          If '--no-tidy' was used, you can examine the
          log file at
                  /tmp/pdfjam-C1Itoo/a.log
          to try to diagnose the problem.
  pdfjam ERROR: Output file not written

Unfortunately, the  /tmp/pdfjam-C1Itoo/a.log file was empty... Any idea about it?

Thanks in advance!

Best,

Charles

Charles Santana

unread,
Mar 6, 2014, 10:04:42 AM3/6/14
to sozi-...@googlegroups.com
Sorry, I forgot to mention the version of pdfjam:

pdfjam 2013.20140215-2

Thanks,

Charles

Charles Santana

unread,
Mar 6, 2014, 10:07:58 AM3/6/14
to sozi-...@googlegroups.com
Sorry again, I also forgot to mention that the svg presentation has 3 video files, in ogv format. I imagine that sozi2pdf will not reproduce the video in the pdf file, but I was wondering if it could generate pdf files with a "static picture" instead of the animations. Am I too optimistic about it?

Thanks,

Charles
Reply all
Reply to author
Forward
0 new messages