We previously made a post on how to export a HighChart graph to PDF using the wkhtmltopdf endpoint. This time we are going to cover AnyChart, which is arguably better than HighCarts in many areas. In this post we are going to cover printing an AnyChart graph to PDF with wkhtmltopdf.
The following sample code is taken from the AnyChart website demo for a basic Area chart. We are going to use this as the baseline for printing to PDF.
Using the wkhtmltopdf endpoint from the Api2Pdf documentation, you have two options.
Manipulate the width. wkhtmltopdf and Headless Chrome render PDFs sort of in the Responsive state, so assume a small width browser. You may have to continuously adjust the widths of the charts via css and the highcharts settings to ensure it looks right.Tags: anychart, export-to-pdf, generate-pdf, html-to-pdf, pdf
Comments are closed.