I recently had the need to dynamically create PDF files based on Adobe Illustrator (*.ai) files created by a talented artist. The application allowed the user to embed his name on the resulting pdf file, and I had to make sure the quality of the drawing wasn’t lost, since it was going to be used for printing. Therefore I turned to SVG, a wonderful XML-based file format for vector images.
XML files are relatively easy to work with on the server, so by converting the AI file to SVG I was able to edit the drawing dynamically. But it turned out converting SVG to PDF on the fly wasn’t as straightforward as I thought. Fortunately a colleague at work found out a very nice way to do it by using an application called Inkscape. It was a bit hard to get the dependencies working on the RHEL server we had, but he finally managed to get it going.
If you’re using Ubuntu, there’s nothing to worry about, Inkscape is as easy to install as running the following on your command line:
sudo apt-get install inkscape
Inkscape has an option for using it as a command-line tool, this is what you must run in order to convert SVG to PDF:
inkscape -z --file=original.svg --export-pdf=converted.pdf
For it to work properly you have to make sure you have the latest Cairo libraries installed.
Here’s an example of the result:
tiger.svg tiger.pdf
This process also embeds the necessary fonts defined in the SVG into the PDF file.
Hope this is useful to someone.
Posted in
linux at November 9th, 2008.
No Comments.
Remuco is an application that lets you control your linux music player using your cellphone using either bluetooth or wifi, this is great for parties!
I’m a Rhythmbox user and I wanted to try this functionality with my Blackberry Pearl 8120, which fortunately has a wifi antenna. I followed the instructions on the Remuco’s website and everything installed like a charm on my Ubuntu Hardy, I then installed the client on the Blackberry using the OTA (over the air) method, but when I tried to connect to my Rhythmbox running on my machine through wifi, got a nice “Connection failed” message. It turned out to be that the Blackberry was using the BIS (BlackBerry Internet Service) connection instead of the wifi I had on.
I digged into the Remuco client’s Java code and found out the connection route wasn’t being specified in the StreamConnection.open() method, so I tweaked it to include “;interface=wifi”, and voila!, it worked!. Now the Blackberry knows it has to use the wifi connection when an IP is specified as a Remuco server host.
I recompiled the Remuco client and put it up, you can install it on your Blackberry pointing your browser here: http://tinyurl.com/remuco
I’ve also changed the application icon so it shows nicer on the Blackberry screen.
Enjoy!
Posted in
java at October 30th, 2008.
No Comments.
I recently had to convert a directory structure of files from Windows created ISO-8859-1 format to standard Unicode UTF-8.
I created a shell script that recursively creates a copy of the directory tree converting to Unicode each PHP file it finds.
find . -name "*.php" -exec iconv -f ISO-8859-1 -t UTF-8 {} -o ../newdir_utf8/{} \;
It was originaly made to be run inside the directory I wanted to convert, but it can be easily changed in order to run from anywhere.
Hope it’s useful to someone having this problem.
Posted in
linux at October 12th, 2008.
No Comments.