top_left top_right
bottom_left
Next Event: Unknown | Forum Rules | QGL Website | Event Registration
openFolder AusForums.com
iconwatfolderLineopenFolder LANs
iconwatfolderLineopenFolder QGL
iconwatfolderLineopenFolder QGL Forum
Author
Topic: SVG to PDF using PHP
Pinky
Posts: 1395
Location: Melbourne, Victoria

I have a report in SVG format (Inkscape) which I turned into an XSL document (by hand).

Now I have some HTML form output that has been saved as XML in PHP. Then also in PHP the XML file is transformed using the XSL document, so now I basically have my pretty SVG form filled with the HTML form data.

My question is, how can I turn this baby into a PDF from within PHP?

I tried ImageMagick but that was pretty much fail. It worked, but the resulting PDF was crap. Didn't take advantage of the SVG at all - it seems to rasterize the SVG.
system
--
trog
AGN Admin
Posts: 26674
Location: Brisbane, Queensland

I think we use HTMLDoc: http://www.htmldoc.org/

Have a crack at that.
Jim
Posts: 9602
Location: Brisbane, Queensland
there's also a pdflib-based extension but I've never tried it:
http://au.php.net/manual/en/book.pdf.php

user-comments on that page also suggest other libraries
Pinky
Posts: 1396
Location: Melbourne, Victoria

That HTMLDOC library is pretty interesting, have bookmarked but not exactly what I'm after.

I had a look at that pdf extension, that seems to be similar to what I have been using before: http://www.ros.co.nz/pdf/

To expand more on what I've done it's very similar to this, which I used as a guide: http://www.linuxjournal.com/article/9283

The bit where I'm stuck is at the bottom of that article they pipe Inkscape to lpr - I can't do that because my host doesn't have Inkscape and I can't install it on the server. They do have ImageMagick, but unfortunately that didn't work very well. I was so confident it would *sigh*

So I'm trying to look for an alternative to that. I think I might have pulled up short, because I have been searching for a solution for an hour. Time to move on I think.
$ack
Posts: 463
Location: Brisbane, Queensland
Paging Cerb
Jim
Posts: 9603
Location: Brisbane, Queensland
I read your first post as asking how to output something you have in php, to pdf from php, based on:
My question is, how can I turn this baby into a PDF from within PHP?

is that not the case?
Pinky
Posts: 1398
Location: Melbourne, Victoria

My bad, it's not very clear. This should be one sentence:
so now I basically have my pretty SVG form filled with the HTML form data.

My question is, how can I turn this baby into a PDF from within PHP?


What it means in proper English is that I have an SVG file, and I need to conver it to a proper PDF file (without rasterizing like ImageMagick)
jesu
Posts: 589
Location: Brisbane, Queensland
I use FPDF for converting data into PDF files at my work.

hope this helps
Pinky
Posts: 1405
Location: Melbourne, Victoria

That, my good sir, is a great lib. Bookmarked.

Still didn't solve my prob though - I think I'm just going to have to get over that I can't produce pretty PDFs directly from my web-app yet.
Jim
Posts: 9615
Location: Brisbane, Queensland
I've never worked with an SVG personally so can't offer anything off the top of my head
If I need a break from l4d I might have a crack at it later
simul
Posts: 505
Location: Brisbane, Queensland
Easiest way will probably be to convert the svg to swf, and then convert the swf to pdf via some form. I haven't tried it myself, but a decent svg > swf should keep all the vector information correctly, and same with swf > pdf.
Pinky
Posts: 1414
Location: Melbourne, Victoria

Hot tip simul, worth a shot. Will let you know if any success.
Farseeker
Posts: 1528
Location: Brisbane, Queensland
http://www.princexml.com/doc/6.0/php/ looks worth a try - they have an svg to pdf example in their samples.
Pinky
Posts: 1420
Location: Melbourne, Victoria

Sweet Mother of Lord, Farseeker. Awesome lib!!
system
--
Not a new post since your last visit.
New Post Since your last visit
Back To Forum
Advertise with Us | Privacy Policy | Contact Us
© Copyright 2001-2026 AusGamers Pty Ltd. ACN 093 772 242.
Hosted by Mammoth Networks - Australian VPS Hosting
Web development by Mammoth Media.