export dojo chart to pdf or some other vector format - pdf

I need help with exporting dojo charts to pdf. How could i export dojo chart like this one to pdf or some other vector formats? i tried to use this but i can't make it work. Any vector format (ie. svg) works for me! also, i tried to use this example, but don't know what to do.
Can somebody help me!!!
Thanks!

I too was trying to export a dojo chart to pdf.
I tried to use toSvg function of dojox gfx utils then sent the svg stream to server and used apache's Batik for generating the image or pdf.
This works great, except that i am not able export the chart labels.
I tried to do this, with the chart you had shared (http://www.hiim.unizg.hr/mihovil/dojo/dojo.html) and it export had worked well exept the labels again.
Let me know, the exact problem you are seeing.
Thanks,
Srilatha.

You have to set the property of the dojox chart htmlLabels to false and then you can get the svg with:
var def = dojox.gfx.utils.toSvg(chart.surface);

Related

Create PDF layers using DomPDF

I'm trying to create a PDF with layers, one for the texts and the other for a background image so user can print only the text layer.
Does anyone knows if it's possible and if so, how can I do that ?
I'm using version 0.8.2.
Thanks
Finally it looks like layers or the Optional Content Groups are not supported by DomPDF. So my solution was to change to TCPDF, it's not great for CSS but it offers the option to create layers and change the visibility of objects in the PDF.
So you can set objects to show only in screen or print.
I hope this can help if someone has the same issue.
Here's the link to TCPDF

Is it possible to convert fabricjs svg output to pdf without rasterizing?

We are building a web app where the user can make a design by using fabric.js and at the end he should receive a pdf file with his work.
At first, we tried to use JSPDF because it was prefered to have a cliente-side solution. However by doing pdf.addImage(canvas.toDataURL(),...) we are rasterizing the design.
In second place, we tried server side solution using WKHTMLTOPDF, sending canvas.toSVG(), but there are some issues with fonts and shapes rendering.
The designs are complex as they can have text, shapes, images and svg.
We also tried INKSCAPE (inkscape --without-gui --export-pdf ...), MPDF and MUPDF without good results. IMAGEMAGICK is not a solution has it also rasterize the design.
The main goal is to get a vector pdf, where it's possible to increase size and where the elements of the design are selectable, and if possible that pdf should be ready to print (300 dpi and cmyk)
Yes its possible using TCPDF library.
Please check this ImageSVG api for more information for converting SVG to PDF.
https://tcpdf.org/examples/example_058/
Export the canvas to svg and use pdflib to make the pdf.
You can find an exemple here:https://www.pdflib.com/pdflib-cookbook/graphics/starter-svg/

Export PHP Chart to PDF

I'm looking for suggestions on exporting PHP Charts to PDF format.
I am currently using Flot Chart. I have got all my charts working perfect I only need to exporting them to PDF. Any idea please?
Thank you,
Zina
Flot Chart is a client side solution for charts, so you would need to use javascript PDF library such as jsPDF to export image to PDF; Or you can serialize image and post back to server side using base64 or other binary to text encoding methods, then you can process the image however you want once images are sent to server side. If you use PHP, you can use FPDF. Personally, I prefer the later.
PHP Chart has code snippets demonstrates the later approach sending data to server side for process.
URL: Export phpChart on the server side.

Printing a Vaadin Layout

I want to print a Vaadin layout and all of its components (text, tables, html, charts, etc), sending it to a pdf preview, hopefully getting exactly what I see in the screen (for that specific layout)
thanks!!!
The solution, seems to me, that is not something Vaadin is able to provide. You have to extract the html specific to you desired layout and, along with the styling, delegate to a tool that might convert it properly to a PDF, like jsPDF, but you need to integrate it into your Vaadin application.
If you're interested I can try to write some code that will help you. If so, let me know.

How to convert Google Gauge Chart in PDF Format

I just want to know how to convert Google Gauge Chart in PDF Format.
Is there any way to get a url for gauge chart like bar chart and pie chart, which I have sent and received respective gauge chart in PDF format.
Yeah you can try to convert the google chart to a canvas and then get png image data from that, this will allow you to send png image data to libraries such as FPDF in which you can save the image as a PDF.
Google charts are created using SVG ... to convert SVG to canvas you can use the library canvg. It works like canvg(yourCanvas, yourSVG) then use var PNGimg = canvas.toDataURL("image/png");
This should pretty much do the trick
There isn't a simple way to do this. Since visualization charts with google are made with javascript you are pretty much helpless if you want it as an image.