Export PHP Chart to PDF - 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.

Related

Android camera, take picture(s) and save as multipage PDF, then upload to server via <input type="file" />

I have a webform with and want to open it on smartphone - than take pictures of some documents which need to be merged in one PDF, and on the end this file need to be uploaded to server.
My solution is to use Google Drive to upload PDF (scan) to GDrive and then somehow download this file from gdrive to server via some sort of widget (any links appreciate) installed on website.
Maybe someone have a better idea?
I know its late but my answer might help others. I also face the same challenge and implemented a custom solution based on Javascript and Since you are using web form so this solution will perfectly fits on your need.
You have to use JSPdf javascript library, JSPdf provide you pdf object in your browser and you can upload it download it and there are many other thing to play with.
First you have to initialize JSPdf object as per your requirement. I am creating PDF with page size width:500px and height 500px.
pdf = new jsPDF("l", "pt", [500,500]);
Simply when you will take picture from camera you will have each picture in form of base64, that base64 format you have to insert in JSPdf object
pdf.addImage(imgData, 'JPEG', 0, 0);
you can repeat the above code to add pictures from camera as much as you want, at the back-end these images are compiling and creating pdf document where each page have each images in sequence.
Once you are done, you can get PDF object in form of base64 object using below code that you can upload to any server.
pdf.output('datauristring')
above is only pdf part, you can find complete working example including camera part here Javascript Component to Scan Document

Is it possible with Print.js to send the PDF to storage in a folder online instead of printing it?

I am trying to use print.js(crabbly) https://github.com/crabbly/print.js to send a PDF to a folder on my website instead of printing it.
My task is to save form data into a PDF and save the PDF in a folder on my website once the user submits. I like the way print.js creates the PDF and sends it to print but I need it to send to my folder...maybe through php?
Thanks for anyone's help!!
You need to handle that form submission on the server side. Once you receive the form request or the payload, you can then use it to create your own PDF.
Looks like you may be using Php in the back-end, if that's the case, the FPDF class should have everything you need to create your PDF:
http://www.fpdf.org/
If you use Laravel, here is a convenient package wrapping the FPDF class so we can import it with composer:
https://github.com/crabbly/fpdf-laravel

How to generate PDF offline with UWP

I'm developing a UWP app for tablet and i need to generate a PDF with data from SQLite. I need to do this completely offline because where I will use the app there is no connection. What could I do?
I'd prefer not to use paid libraries like Syncfusion and XFinium so I'm trying to find an alternative solution.
I tried with iTextSharp but unfortunately I can't find a good documentation to render a complex PDF or to export a Bitmap generated from a Grid Component to a PDF File.
Why not render your data into a webpage displayed with a WebView control? Then you can use any permissive licensed javascript library to generate the PDF.
If it hasn't changed much, then you can only send text back and forth between your WebView and UWP app, but that's workable. Your final PDF result can be read back as a base64 encoded string.
A very quick search found this one that seems easy to use and you can just download the source to put into your app:
https://github.com/MrRio/jsPDF

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 dojo chart to pdf or some other vector format

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);