Exporting SVG to PDF in a offline TideSDK webapp - php

I have an offline HTML5/CSS/JS app built with TideSDK in which a bar chart is drawn with Highcharts as an SVG "tag" using data entered by the user. I need to export this chart in a PDF document, which will also contain text and tables.
As it is an offline app I can't use the export module included in Highcharts (except the getSVG() method) or other solutions like DocRaptor.
I'm open to use another JS plugin for drawing the chart, but I really love the "look and feel" and the features of Highcharts graphs.
As you may know, with TideSDK I can embed Python, PHP or Perl scripts/modules in my app (I prefer avoid Perl as I've never used it).
The other limitation is that I cannot ask to the final users to install another software than mine, so I can't use wkhtmltopdf with PHP. Except if I manage to install it through my app in a transparent process (not sure it is particularly easy to do).
After having search for several days, my final idea is to use the CairoSVG Python module to export the graph in a first PDF. Then I will find a JS (jsPDF) or Python tool to include this PDF in the final PDF containing text and tables.
I will start to test this solution soon and let you know if I managed it. Nevertheless, if some of you already have to manage a similar problem, I will be very happy to hear your solutions.
The app will run, in a first time, on Windows platform and should be adapted to MacOS, Linux, Android and iOS in later phases.

There is simple command line tool (wkhtml to pdf), that lets you convert html pages to pdf files. Its not strictly python/js solution, but you can call os.system() or something similar from python to use it. It helped me with my python program and it is very simple to use. Command is "wkhtmltopdf.exe inputname outputname" and you get what you want. And its free software. Site: https://code.google.com/p/wkhtmltopdf/

Related

Displaying word documents, excel sheet, power point in browser

Is there is any way to displaying world document,excel sheet and power point in browser with out downloading.
I assume that you are going to use php for this, so you can try checking some libraries such as PHPWord by Microsoft for example.
If you wish to only display the document content, it is possible to do using some scripting language such as php. Basically office 2007+ formats are zipped XML documents with changed extension. Make a simple word 2007+ document, save it and change extension from .docx to .zip, than you can extract it and see what it's made of. You can find a lot of details here. Now displaying content may be a little tricky. As mentioned, there are libraries out there to handle this, but how will they handle the documents, I am not really sure. Most of them are abandoned, PHPword is in beta since 2011.
There are some indications that Apache is working on cloud version of Open office, but there is no release date yet. Once done, you will have a full featured office suite web app.
If you feel really creative you could use cron job (or scheduled task if you like Windows) to open a document, take a screenshot and basically make .jpg or .png version of the document (works fine with short documents, longer ones may be problematic), displaying it in a browser without much complication. It is also possible to schedule export to .pdf - all browsers do have Adobe PDF plugins.
To sum up, using php for parsing simple documents should be fine, but getting complex docs to display properly, may be much more difficult task and possibly not worth your time. I would go for cron export to pdf, to preserve most if not all of the document's structure.

How a video template can be used to replace with custom images/text on-the-fly using PHP

I am a website developer (php) and I have been given a task to develop a website similar to
http://ivipid.com/.
I need to make an identical website and I am trying to figure out how this can be done,
especially the part in which they use user-uploaded image files and text into the Video file and all this on-the-fly?
I know how to convert user-uploaded video files into FLV on-the-fly using FFMPEG but I'm not sure on how they (ivipid.com) manage to do this.
You can use Templater Bot from Dataclay to achieve this. From your PHP script launch Templater's command line interface using a function call like exec(). Check out Dataclay's github cli-tools repository for more information on how to work with its command line interface.
Templater Bot is built for Adobe After Effects. There is a basic workflow. First, you prepare an AE project to be compatible with Templater. It involves marking certain layers as dynamic whether it be text layers or footage layers. Then you create a data source: this could be a JSON object array, or something as simple as a Google Sheet. Next, you setup a configuration file for the cli launch script. The config file lets you specify output location, data source location, footage location, etc. Finally, launch Templater and you'll have the versioned content that your app needs.
Full disclosure: I am the lead developer of Templater at Dataclay.

PDF parsing specific text

hi I'm working on an app that parses out pdf data for viewing on mobile devices, I'm looking for a way to scan through a pdf file for specific text and getting the x & y coordinates of that text block. Is that even possible. I working on a Linux server, with php but I'm flexible to use whatever means to get this working. Thanks.
Commercial options:
TET (Text Extraction Toolkit) SDK from http://www.pdflib.com; Acrobat plug-in available for testing the mechanism
pdfToolbox SDK from http://www.callassoftware.com; interactive desktop version available for testing
if you are ready to do some more of the coding yourself: Adobe PDF Library, SDK, available through Datalogics
All are pretty mature, TET is very specific to text extraction, pdfToolbox is a general purpose SDK for analyzing and manipulating PDFs (but has a specific feature to do text extraction, with coordinates of text on the page), and Adobe PDF Library is rather a general purpose development tool (offers a lot of low level features, but code would have to be written that does find text/words/characters and pulls out the coordinates).
Disclaimer: I work for callas software, my view on pdfToolbox may be biased.

openoffice document (odt) to PDF with command line on Linux?

we are building a PHP script that we need at work to create reports in PDFs
the reports will be created by using templates from postgrSQL.
so far I found that it can be done with the use of php and odt (openoffice) files [http://www.odtphp.com/] (do you have any other suggestions?)
now how I can convert the results to PDF so teachers will get the final reports as PDF
any tips? the server has no GUI and I want to make it as simple as possible
we tried using PHP to PDF directly with FPDF [http://www.fpdf.org/] but it is really a CPU killer!
http://www.artofsolving.com/opensource/pyodconverter
this may help you, it needs to start OpenOffice as service, and the python script is merely utilizing its api, maybe you can write one in PHP too

Linux-based MS Office thumbnail generation

I've been taken onboard to work on a PHP-based web application. One part of the application generates thumbnail images for MS Office documents on demand, and it uses MS Office + the VeryPDF docprint utility to do this. Because of this one requirement, the system is running on Windows Server 2003 + IIS.
I would prefer to have the system running on a Linux server, rather than MS, as I have far more experience in administering Linux systems than Windows and we have no other in-house technical staff.
Does anyone know a way to handle the document conversion using native Linux software? I would love something PHP native, but am willing to look outside that if necessary.
I have never done anything like this, so I'm just throwing an idea off the top of my head.
Have you thought about utilizing Open Office's capabilities to create thumbnail images? I know OO saves thumbnail images within a created document, so all you need to do is extract the image to display it. (This is demonstrated on the Ubuntu forums.) You could always do something sort of "hackish" where you use run a file through OpenOffice and extract the image to display a small thumbnail.
Again, I have no idea how well this will work, but it may be worth a shot.
To anyone else who comes across this, I have ended up going with the newer version of jodconverter. The sample code includes a basic web page that can be POSTed to using something like Pear's HTTP_Request2. A sample class (by yours truly) which uses this is mentioned in the comments in jodconverter's group on google code.

Categories