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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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
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