[GTK4 C] Is it possible to replace multipage PDF output by SVG output?

Hello, I made a GTK 4 application that creates a multipage PDF using Cairo, and this PDF is targeted to be used as design to be cut/score/drawn with a cutting machine that accepts only svg paths. As parametrization of the cutting machine software must be done by hand, I need to combine all lines by job in order to have only one path to parametrize by job instead. For the moment I’m doing the needed changes by hand using Inkscape and a little node js code, and I’m wondering if instead of this PDF output I could make a SVG output (the multipage is now handled by Inkscape but I’m not sure if it is supported by Cairo just like it does for PDF. It’s the first time I’m making a GTK application, and also first time I’m using Cairo graphics library, so I’m not aware of it’s possibilities even if I tried to read docs. I not sure if there is a way to combine paths like I’m doing with node js using dom.
Here’s what I have

left : PDF created from my GTK4 Application using Cairo
right : PDF imported into Inkscape handling its pages and that can be saved as PDF or also as SVG.
My question is can I directly create such SVG from my GTK4 application ?

(optional question, I see that on the optional tags there’s no GTK4, do you recommend me to keep on using GTK4 or use GTK3 instead that has more documentation and examples ?)

Sure, Cairo could output SVG directly.

SVG Surfaces: Cairo: A Vector Graphics Library (cairographics.org)

It seems to be not that easy. He wants to create a multipage SVG document. Cairo SVG generates multiple pages in the SVG file, if the provided cairo_show_page() function is used, but I was not able to load that file with eog or firefox then. And Google said, that multi-page SVG may be deprecated in SVG version 2.0. So I gave up.

[EDIT] For details, see Google results like [poppler] pdftocairo SVG, dropping multi-page support

Thank you for the link. Inkscape has multipage since 1.2 (see Multipage - Inkscape Wiki). Last monday I imported a multipage pdf into Inkscape and save it. It kept the multipage properties, and I was able to use it into my cutting machine software (see capture). I’m going to add a svg export to my application and will see how it behaves with “cairo_show_page()”. Anyway, what’s most important for me on this is to be able to have an output where each paths are grouped by page (I mean one group by page) and lines of same kind (I use one color for each kind, red for cuts, green and brown for folds and black for prints) are combined into one path. I hope that cairo_push/pop_group() functions does this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.