Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorEvancool
    • CommentTimeMar 7th 2010
     
    Hello all.  I just started using mPDF and it's fantastic.  It is able to do everything I need it to and then some.  However, is there, or will there be, support to render an SVG file in a PDF?  I've tried the syntax from http://www.w3schools.com/svg/svg_inhtml.asp on putting in the $html variable before doing the $mPDF->WriteHtml($html); function.  None of the methods work and the SVG file does not show in the PDF.

    The purpose of this is that I am making a certificate and receipt template for my company website and I wanted to use a vector style logo instead of a raster image.  I have the logo in EPS and SVG formats but EPS will not render on browsers, but SVG will on most of them if placed in object, embed, or iframe tags.  I tried converting to WMF which does work as per Example 04, but the logo is rendered inverted, truncated, and upside down on the PDF.

    So, is there a way to put an SVG or EPS file on the PDF then output it?
    • CommentAuthorIanBack
    • CommentTimeMar 10th 2010
     
    At the moment - no. But I have been looking at adding support for SVG and am half way there. I will post any updates if/when I get it working fully.
    • CommentAuthorBurndog
    • CommentTimeJun 2nd 2010
     
    There is this capability in TCPDF. Can any of that be ported?
    Being as PDFs are usually printed having a logo in some vector based format would really help.

    Regards,

    Steve
    • CommentAuthorIanBack
    • CommentTimeJun 3rd 2010
     
    TCPDF uses ImageMagick - which I suspect is not commonly installed. But see mPDF v4.5 - it will do quite a lot of SVG files now, although it does not support all features.
    • CommentAuthorEvancool
    • CommentTimeJul 14th 2010 edited
     
    Can you post an example of how to add an svg image into a pdf?  Such as if I have the file image.svg?
    • CommentAuthorIanBack
    • CommentTimeJul 14th 2010
     
    <img src="image.svg" />

    Simple as that. Not all aspects of SVG specification is supported; here is one that does work - http://mpdf1.com/common/mpdf/examples/tiger.svg
    • CommentAuthorEvancool
    • CommentTimeJul 14th 2010
     
    Awesome thanks!!
    • CommentAuthorEvancool
    • CommentTimeJul 15th 2010
     
    It seems I ran into one of the unsupported issues with SVG, the gradient coloring is off in the middle of the logo when rendered in the pdf.  Is there any possibility that when mPDF 4.7 comes out, the support for SVG will increase?
    • CommentAuthorIanBack
    • CommentTimeJul 15th 2010
     
    To be honest, I don't see this increasing in the near future. SVG allows for very complex cross referencing of objects which makes it difficult to support it.
    • CommentAuthorseb835
    • CommentTimeAug 4th 2010 edited
     
    Just thought I'd throw some of my experience in here.

    You can add EPS support to MPDF using the class found here: http://www.fpdf.org/en/script/script84.php

    Then all you need to do is modify the first line of this class to extend from MPDF as follows:

    class PDF_EPS extends MPDF {

    You can then use the EPS function after instantiating your new EPS class:

    $mpdf = new PDF_EPS('en-GB','A4');
    $mpdf->ImageEps('pdf_logo.eps', 62, 3, 0, 10);

    Hope that helps someone out there!

    Seb