From Html to PDF

Is it possible to have the dynamically created graphic line to get displayed in PDF from htmlpages?

Are you trying to turn an HTML web page into a PDF? If so, give TCPDF a try. It’s an open-source PHP library that comes with many examples.

Thanks for your reply.

I did try with that. The problem is that I am not getting the results of the line which I drew dynamically from one box to another in the html page to PDF.

Thats why I had a doubt and asked whether is there a possibility for the dynamically created graphics line to get displayed in the PDF.

I would try testing it by removing all the other parts of the PDF besides the graphic you referenced. If it still does not show up, you may have to translate your graphics into something that TCPDF can understand. I see on the examples page (, example #12 shows some graphic transformations. I hope this helps!

Thanks for your reply.

But I saw the coding for the example you have mentioned. The coding are given with X and Y values for the graphics to get displayed in the PDF. What I have created is the user will draw a line in the webpage. So does that value need to get stored in some variables and that should be used to display the graphics line in the PDF?

Yes exactly. If your user is going to draw a line on a web page, you’ll need the starting point (X1 and Y1) and the ending point (X2 and Y2). Then you can pass these as parameters to the TCPDF Line function: $pdf->Line(X1, Y1, X2, Y2, $style);

Depending on the shapes your drawing this may get much more complex. Also, you may have to change the coordinates depending on where you want the graphic to show up in your PDF.

Thanks for your reply.
I will try it.