Building a Digital Portfolio with Inkscape – Part One

hero banner

It has been a long time since I have posted something on this blog, of course no one noticed it, that's fair; but as a matter of fact I have been pretty busy divided by the work and the family. And it is for this lacking of time that I am going to share this mini series on how building a Digital Portfolio with Inkscape.

Usually I do this kind of task with Scribus but with the very few time I have available using Scribus, unfortunately it is a pain, I spend all my time dealing with all the Scribus quirks: undo(s) that don't work properly, infinite rendering time, styles complicated to setup, gigantic PDF documents and all the other glitches. Generally I don't mind about those issues, because are part of the game, but with the very few time available, because of them, I can't focus on the content and my time goes away without accomplish anything.

Hence which are all the other feasible alternatives? LibreOffice Writer or LibreOffice Draw? Now way, those aren't really suited to anything particularly complicated in terms of layout and with those it is very complicated having full control of any object. What else? Inkscape!

Inkscape is the last resource I have available and it is also the software where I am faster. However Inkscape doesn't handle multi pages document by default. You can export layers as separate SVG files but having all the pages stacked one on top of each other is uncomfortable and prone to create a lot of issue when you are in an advanced phase. The best way might be having the pages organized outside the page area and using the page area to handle some template elements. But I will explore this in a following article.

The layoutThis is the test layout I used for this proof of concept, M stands for Master.

It is clear that, without a procedure to export automatically all the pages I need in a final PDF, all this idea is unworthy.

Thus this was the first challenge.

Proof of concept

It took me a couple of days to scrape all the online documentation about Inkscape that is: scarce, mostly outdated and fragmented. However I was able to connect all the dots and I found a viable proof of concept.

Inkscape by default can export areas or elements outside of the page only as PNG image; there was an option to export external page areas as EPS but it was ditched for some technical reason. EPS exporting has also a limitation, doesn't handle transparency while PDF exporting can. The latter can export the page area or the entire drawing area, but I don't need to export all the entire drawing area, as a matter of fact it is the exact opposite. I need to export several external areas separately — the pages in short — it means I need a way to make each page the area page and then export any page as PDF. That makes sense for me!

On my test.svg file for each page I assigned an ID so page 01 has assigned as id page01; the other pages follow the same numerical progression. In this test I have only four pages (refer to the picture above).

Inkscape can handle many CLI commands through shell without invoking the GUI, however when you use the action verb you need the GUI. You can check the commands and action available for Inkscape through this commands:

inkscape --help
inkscape --verb-list

What I need to do with Inkscape is to select the square 1, convert into a page, save it as SVG and convert as PDF. Unfortunately I can not export as SVG if not only as plain-svg that means that I have to create a copy of my file before.

Thus to recap:

  1. Copy test.svg to test-page01.svg
  2. Moving the page area from M to 1
  3. Saving and closing the test-page01.svg
  4. Convert to PDF
  5. Delete test-page01.svg

And these are the commands from point 1 to point 3:

cp test.svg test-page01.svg
inkscape --select=page01 --verb FitCanvasToSelection --verb FileSave --verb FileClose --verb FileQuit test-page01.svg

The first command is easy to understand, the second command is enough trivial when you learn the basic syntax:

And this is the result:

Page01You can recognize by the shadow the page was moved from “M” to “1”, cool!

The page was moved properly hence I can continue to export as PDF now:

inkscape -f test-page01.svg -A test-page01.pdf
rm test-page01.svg

And those are the last two points left. This last part is quite self-descriptive -f selects your SVG file and -A stands for --export-pdf=. There are also some tuning for the PDF and I am going to explore those in another time as well.

Now I want see my PDF:

The PDFActually it worked but I had a small issue.

This is the result expected but it seems that page03 was overlapping page01 and part of page03 has been incorporated in the PDF, that means I must be very precise to avoid this situation for the future. And I should also looking if I can create a clipping mask on the fly during the process, but for my proof of concept this is more than enough. Let me just recap all the commands once again:

cp test.svg test-page01.svg
inkscape --select=page01 --verb FitCanvasToSelection --verb FileSave --verb FileClose --verb FileQuit test-page01.svg
inkscape -f test-page01.svg -A test-page01.pdf
rm test-page01.svg

Now I can start creating the portfolio, how I can reiterate all the process as script is something that I will address once the portfolio is finished. Unfortunately for the moment I don't have idea how to share the file test.svg with this platform but I will figure out something. Anyway it is nothing special.

On the second part I will focus on how I will create this portfolio and third and last past on how I will automatize all the procedure. As usual thanks for reading!

#Inkscape #LinuxDesktop #OpenSource #pdf #svg #graphic #design #Linux #FreeSoftware #GNU #portfolio #CLI #bash #shell #DigitalPortfolio #eps #commandline

if you want comment this article add me on Diaspora, Friendica or Mastodon: