[opensuse-artwork] Business cards as SVG or glabels (was: Business Cards)
On Friday 26 February 2010 16:27:39 S.Kemter wrote:
I have added my business card proposal to that page. It's a classic design with few colours and no background so that it's cheaper to print.
I u have added 3 proposals, wow. Thy looking simple, decent and business like. Great job.
Indeed, they're excellent.
As a general note, it would be a lot more practical to have the business cards
as SVG and/or glabels [1][2] templates
The nice trick with SVG is that it's an XML file, and you can easily use
placeholders for first name, last name, etc... (e.g. @@FIRSTNAME@@,
@@LASTNAME@@, ...) and then use sed and rview-convert to render them in a
batch (to PNG, PDF, ...). That's how the release countdown is done [3] :)
The cleaner solution would be an XSL transformation (e.g. using xsltproc) but
in this case it's really simple enough to use sed (or perl or whatever).
Such a script could be like this, just to give you an idea:
---8<-------------------------------------------------------------------
#!/bin/bash
# Usage: script <Firstname> <Lastname> <Email>
# e.g.: script John Doe john.doe@opensuse.org
set -e # exit on error
TEMPLATE=bcard.svg
FIRSTNAME="$1"
LASTNAME="$2"
EMAIL="$3"
WIDTH=400
HEIGHT=300
# create a unique, temporary working directory, and delete it
# when exiting the script (either on success or error, or signal)
WORKDIR=""
function on_exit { [ -n "$WORKDIR" ] && /bin/rm -rf "$WORKDIR"; }
trap on_exit EXIT
WORKDIR="$(mktemp -d /tmp/bcard-XXXXXXXX)"
# replace the placeholders with the parameters that were passed
# to the script:
cat "$TEMPLATE" | sed "
s|@@FIRSTNAME@@|$FIRSTNAME|g;
s|@@LASTNAME@@|$LASTNAME|g;
s|@@EMAIL@@|$EMAIL|g;
" > "$WORKDIR/bcard.svg"
# and now convert the working file into a PDF:
rsvg-convert --width="$WIDTH" --height="$HEIGHT" \
--keep-aspect-ratio --background-color=white --format=pdf \
--output=./bcard.pdf "$WORKDIR/bcard.svg"
---8<-------------------------------------------------------------------
Of course, something like that could also be available as a CGI, something
like
http://bcard.opensuse.org/?firstname=John&lastname=Doe&email=john.doe@opensuse.org
and it would give back the PDF.
As a matter of fact, glabel supports images in SVG format, so another idea
could be to do the whole template with Inkscape, as SVG, except for the name
and email address and such, and import that into glabels. That way it would
work with both.
[1]http://glabels.sourceforge.net/screenshots/
[2]ships in OSS (11.0->Factory) as well as the latest version in GNOME:Apps
[3]http://counter.opensuse.org
cheers
--
-o) Pascal Bleser
participants (1)
-
Pascal Bleser