2012年12月3日月曜日

embedding SVG in a PDF file

With the new Adobe Reader one can view PDF files which contain SVG. 
I found a little Perl script on Kevin Lindsey's site which embedds an SVG file in a PDF file.
Due to my preference of python I translated the script.
That means Kevin did all the work I just translated it.

So, if you like python scripts download embeddSVG.zip.

embeddSVG.py is free and provided under the terms of the GPL.

If you should prefer perl scripts then go to Kevin Lindsey's site. Or download both. :)
 
embeddSVG.zip

image raw data or svg into pdf?!

Hi!
Is there any idea to add GD2 raw data or SVG into a PDF File? I have a
customer that want's to get this problem realized.
If any of you guys are able to to help me further according this
problem, I would thank you kindly.

with kind regards


=>
Hi Tamer,
FPDF supports PNG and JPEG formats, that are on the local file system.
If you want to use an image from a different source such as raw GD data
you will need to output the pdf to a temp file, and then reference that
temp file in the the FPDF image method.

For PNG images the alpha channel is not supported (transparency).

Example
1.
<?php
2.
require("fpdf/fpdf.php"); // Load the fpdf library
3.

4.
$pdf=new FPDF(); // Create a new
instance of the fpdf object
5.
$pdf->AddPage(); // Add Page 1
6.

7.
$pdf->Image("php.png", 40, 40); // Place the file
php.png 40 mm across, and 40 mm down the page
8.
$pdf->Output(); // Output the PDF
9.
?>

More information and examples for FPDF is available from:
http://www.fpdf.org
http://www.phpmaniac.net/wiki/index.php/Create_PDF

I'll try to get an example up on how to add content to an existing PDF
in the next couple of days, but you probably want look at fpdi which I
have used with excellent results.

http://www.setasign.de/products/pdf-php-solutions/fpdi/

--
Hope this helps, Cheers