Menu

Phplot image using FPDF

2018-06-27
2018-06-27
  • Ryan Cremona

    Ryan Cremona - 2018-06-27

    Dear Team, Can I ask whether it is possible to use the output of PHplot as an image to insert it in a pdf using fpdf?
    All examples that I have seen and tested are attributed to creation of plots as stand alone. What I require is to include phplots inside other content.
    The graphs have to be dynamically generated and then the resulting output be included in a report.

    Thanks for your assistance.

     
  • Ryan Cremona

    Ryan Cremona - 2018-06-27

    Dear All,

    Issue resolved. For completeness sake the following resolved my issue.

    $plot->SetIsInline(true);
    $plot->SetOutputFile('file_name');

    then you need to place it as an image.

    Regards and thank you

     
  • Afan Ottenheimer

    Should be straightforward

    1) Set PHPlot to save the image (e.g. /tmp/my_phplot_output.png; )
    (Look for SetOutputFile)

    2) With FPDF
    $image1 = '/tmp/my_phplot_output.png';
    // Insert a logo in the top-left corner
    $pdf->Image($image1,10,10);
    or
    2) create a cell and put the image in it.
    //have a cell 40x40 with an image in it, no border, left aligned with text
    $this->Cell( 40, 40, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY()), 0, 0, 'L', false );

     

    Last edit: Afan Ottenheimer 2018-06-27

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.