Page 1 of 1

Can I merge a path into an envelope via an extension by way of the Inkscape command line?

Posted: Wed Jan 03, 2018 8:18 am
by wyatt121
Hi,

Can I merge a path into an envelope via an extension by way of the Inkscape command line?

I'm trying to write a script to generate hundreds of unique graphic files each with different text within. This is typically done with mail merge, but I need to be able to merge the text into a bezier shape, and I need to do it within a php script.

I'm hoping to use this extension: https://github.com/shlomif/Bezier-Envelope-for-Inkscape https://www.youtube.com/watch?v=ldbdhVWaT20

Can I run this extension as a verb on the command line to squish my database text into a shape?

Any help is much appreciated.

Wyatt

Re: Can I merge a path into an envelope via an extension by way of the Inkscape command line?

Posted: Wed Jan 03, 2018 9:22 am
by brynn
I can't answer your question directly. But just in case the command line reference can help: https://inkscape.org/en/doc/inkscape-man.html Hopefully someone else who knows the answer, will be along shortly.

Re: Can I merge a path into an envelope via an extension by way of the Inkscape command line?

Posted: Thu Jan 04, 2018 11:33 am
by Moini
You should be able to.

Steps to do it:
1. print out all verbs, and (if on Linux) search for the correct option by adding a "| grep envelope" at the end (else you may need to browse the list, or search it in some other way):
inkscape --verb-list

I find it as 'de.gerrit_karius.envelope'.

2. when you have the verb, there is a .noprefs option listed. Use this in your script, if the other option doesn't work. Of course, you need to selected the two objects by their id first. And you need to have them in your file before that, or add them to it using another extension or an xml library... Text cannot be added directly via command line, it takes no arguments at all other than the ones indicated on the man page.

3. Hint: this will most probably still use the GUI, and will probably not work when you suppress it using the -z option.

4. Hint: for modifying multiple files, it's usually faster to use the interactive Inkscape command line.

5. The man page (or this: https://inkscape.org/doc/inkscape-man.html) has more info about the specifics.

Re: Can I merge a path into an envelope via an extension by way of the Inkscape command line?

Posted: Fri Jan 05, 2018 4:08 pm
by wyatt121
Yippee Ki Yay! I have been working for this solution on/off for almost 6 months. Thank you so much for your response. Your response put all the pieces together for me.

Here is how it is done:

cp template.svg new.svg && inkscape new.svg --select=text187 --verb=SelectionCombine --verb=SelectionUnGroup --select=path3399 --verb=de.gerrit_karius.envelope.noprefs --select=path3399 --verb=EditDelete --verb=FileSave --verb=FileQuit

This command line copies the functionality displayed within this video:
https://www.youtube.com/watch?v=ldbdhVWaT20

This all works very well.

As you stated I canno't change/edit the text via the command line. This makes my process dirtier as I have to create a temporary "template.svg" in my php code for each database text record within my database before running the command above... but it works! I just wish there was a better way. Anyone have a better idea?

Thanks for all your help!

Re: Can I merge a path into an envelope via an extension by way of the Inkscape command line?

Posted: Sat Jan 06, 2018 10:28 am
by Moini
There's an extension called 'generator', see http://wiki.inkscape.org/wiki/index.php ... #Generator for more info. Examples are given in the linked example file set. Not sure if that's useful though, as it basically does what you do with php, just in bash and with UI and via CSV file (so three times not what you need ;-) ).

Re: Can I merge a path into an envelope via an extension by way of the Inkscape command line?

Posted: Sun Jan 07, 2018 9:27 am
by wyatt121
My process above required GUI to be launched because of the -z tag not supporting inkscape verbs. This was extremely annoying and forced me to run my scripts through a GUI. This slows down the process considerably. I stumbled upon a workaround that works great! Instead of using a full GUI, I launch a dummy GUI within the terminal. It is about 4x faster.

Here is more info:
https://corpocrat.com/2008/08/19/how-to ... ux-server/

Re: Can I merge a path into an envelope via an extension by way of the Inkscape command line?

Posted: Sun Jan 07, 2018 1:25 pm
by Moini
Yes, I just had a very dim flash of recognition - I think at one time, someone else mentioned that as a solution for running Inkscape on a headless server... Definitely need to remember xfvb next time!