Вопрос

Somebody knows how to include jpgraph into dompdf?

This is my code for DOMPDF:

//generamos el PDF
require_once("../dompdf/dompdf_config.inc.php");
    if ( get_magic_quotes_gpc() ) {
        $html = stripslashes($html);
        $old_limit = ini_set("memory_limit", "64M");
        $dompdf = new DOMPDF();
        $dompdf->load_html($html);
        $dompdf->set_paper('letter', 'portrait'); //landscape , portrait
        $dompdf->render();
        $dompdf->stream("TPE - Reporte F.E.A. $asignaturashort.pdf");       
        exit(0);
        }
    }

DOMPDF is running great but I need to add a graph before creating the PDF using jpgraph library. Do somebody know how to do that? Thanks!

Это было полезно?

Решение

You need to do it exactly the same way you would to it in a regular HTML document. Something like this.

Другие советы

This is by far the first post I ever made here... anyway you firstly need to generate the graph and save it on any preferred directory in your web server, then reference the image from dompdf.

This saves the image as a png format on my /tmp directory $myGraph->Stroke("/tmp/myimage.png") see After installation all I get is an empty page when I try any of the examples?

then I reference the image using the code below on dompdf

$html.="<img width='500px' height='300px' src='/tmp/myimage.png' /><br />";

Hope that helps

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top