Feat Req: Export into 1 pdf file

Bug #450213 reported by spaetz on 2009-10-13
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
JessyInk
Wishlist
Unassigned

Bug Description

Sorry for posting a feature request via the bug tracker:

The printing and pdf request have been "solved", however you currently create one .pdf file per slide and effect. Would it be possible to create 1 pdf file with multiple pages instead? That would allow for easy printing as well as easier sharing of presentations with others (my students, for example).

p.s. Otherwise, I do love jessyink, it is a great tool and I will make good use of it.

I agree, it would be nice to create just one pdf file containing multiple pages. Actually, this was the original idea when I set out to write the export filter. However, it turned out that creating multi-page pdfs is not quite as easy as I though. I did quite some investigation and I tried several different libraries and tools, but so far I have not been able to find a way to create good quality multi-page pdf in a cross-platform way.

Another thing I wanted to look into is printing from the browser. It might be possible to get acceptable output by applying a style sheet and use the print function of Firefox or another browser.

If you have any other suggestions, please let me know.

For the time being, I can offer you to try and help you find a suitable tool to combine pdfs for your operating system. I can then use this information to start compiling a page with tips on how to combine single-page pdfs.

Cheers,
Hannes

Changed in jessyink:
importance: Undecided → Wishlist
status: New → Triaged
spaetz (spaetz) wrote :

Thanks for the quick feedback. As for printing, I agree. I tried firefox and it would print whatever is currently shown on the screen (which is sometimes good). I wonder if there is a way to include a style sheet in the SVG that uses "page-break-before" to put each slide on a page of it's own. (see http://www.w3schools.com/Css/pr_print_pagebb.asp)

As for creating multi-page PDF documents, here is a JavaScript library (http://code.google.com/p/jspdf/) see blog post here: http://blog.rubypdf.com/2009/07/14/jspdf-generates-pdf-documents-using-pure-javascript/

The demo link shows an extremly simple way to create a 2 page PDF document. Perhaps that helps?

Wow, thanks, that sounds like a really cool library. I will check it out and see, if I can integrate it into JessyInk. PDF creation was a major concern in the past, as many people like to use PDFs for presentation and distribution. Thanks a lot for the hint!

Cheers,
Hannes

Raphaël Pinson (raphink) wrote :

Hi there :-)

Another solution for multi-pages PDF is to assemble the various PDF files you currently create. This can be done with psbook for example (kind of a hack, but it's doable at least). Here is an example of a simple bash script that does that:

#!/bin/bash

file=$1
filebase=$(basename $file .pdf)
pdftops $file output.ps
psbook output.ps tmp.ps
pstops "4:0L@.7(21cm,0)+1L@.7(21cm,14.85cm),2R@.7(0,29.7cm)+3R@.7(0,14.85cm)" tmp.ps > ${filebase}-booklet.ps
rm -f output.ps tmp.ps
echo "Converting back to pdf (Should be ${filebase}-booklet.pdf) ..."
ps2pdf ${filebase}-booklet.ps
rm -f ${filebase}-booklet.ps

Hi Raphaël,

I have had a quick look at the JavaScript library you pointed out. The problem is that I don't see a to import SVG images with this library. From what I read, it should be possible to embed the SVG directly into a PDF, but in my tests the resulting PDF would not display in the document viewer on Ubuntu (it should work with Adobe products).

As for your script, it looks like a nice alternative. One problem I see with it, is that the PDFs are converted to postscript (which I believe lacks some features PDF supports). Similar things you can do with ghostscript and there are even one or two python libraries I tried that would produce multi-page PDFs.

However, with all these alternatives I always ran into one of two problems: either the method was platform dependent (e.g. shell scripts work fine on Unix, but are inconvenient for Windows users), or the output was sub-par (meaning it did not look good in one or more of the most common viewers).

I suppose one possibility would be to create several different programs for the different platforms to combine PDFs and distribute them with JessyInk (however, not as an Inkscape extension, but as independent programs). Problem is, that I currently don't have a test system for Windows and neither for the OSX. Also, the maintenance effort would be quite high with such a solution.

I still want to explore the "printing from the browser" alternative. This, to me, seems to be a very promising option, if the quality of the output is acceptable.

Cheers,
Hannes

Jan (janozaurus+ubuntu) wrote :

Hi Hannes and friends,

you can merges pdfs with pdftk. The following worked on Debian lenny with pdftk 1.41-3:

pdftk slide*.pdf cat output slides.pdf

Hi Jan:

Thanks for the hint. I find "pdftk" really handy and I use it for merging my pdfs after export. Sadly, I don't think I can distribute it with JessyInk. Hence, people will still have to install it separately and merge the pdfs in an additional step after the export. I would really have liked to find a way to let people export the whole presentation in only one pdf file directly out of Inkscape, but so far, I have not been able to find a good way that would work across different platforms.

In any event, I will put your suggestion in the documentation, so that other people can benefit from it as well.

Cheers,
Hannes

I do that with Cairo and librsvg. The attached <100 lines Python script open the SVG, and render slide by slide the presentation into a single PDF. Master slides and auto-text are kinda supported.

On the - side, views, effects, animated gifs, videos are not supported. And it is lame slow.

Hi Neil:

Sorry for the late reply. Thanks a lot for sharing your script! I am sure you are noticed how important the pdf export is to many users. That's why contributions like your script are most appreciated. I had a quick look at the script and it looks really neat. I would not worry too much about the features that are not yet supported. Actually, the only important feature an export script needs is to show one slide after the other, since to do it right everything else needs to be done in the browser by the way of a two-stage export. As far as speed is concerned, well faster is better, but I would guess that in typical usage, exports are fairly infrequent operations, so speed is not the biggest concern.

The questions that popped into my head were: Does the script run on any platform? And does the user need to install any additional programs/packages apart from Inkscape?

Cheers,
Hannes

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers