Codementor Events

Show Graph in PDF

Published May 31, 2018

What if you have data and some graphs populated using that data and you want to show it in PDF.
I had this same issue, I was using abcpdf to generate PDF from my web URL, and i want to show graph in it.
The problem was, I was using javascript to draw graph, so while taking snapshot of my webpage ABCPDF was not waiting till graph to load and used to take empty graphs snapshot.
So I found method in abcpdf where you can ask abcpdf to wait till web page performs some script and then it renders same HTML in pdf.
you can do this by simple writing below code:
Doc doc = new Doc();
doc.HtmlOptions.UseScript = true;
doc.HtmlOptions.OnLoadScript = "(function(){ //your script to draw graph on your page })();";

even though it was simple to implement it gave big simle on my face when solved. 😄

Discover and read more posts from vishal
get started
post commentsBe the first to share your opinion
Show more replies