Display Illustrations created in illustrator - php

I am trying to create a web application where designers can submit and share there work. But i figured not all designers would submit only jpeg's or gif's. So i am allowing options to submit their creations in .ai (Adobe Illustrator) format. But after the file is uploaded can i give any options to the users to view those illustrations. Is there any external application which i can use to give preview of such files.
I am developing in PHP, and using CakePHP

They can save their files as SVG, which is a vector graphics file that won't loose quality on zoom.
Modern browsers can display SVG file, Wikipedia seems to use them a lot : http://fr.wikipedia.org/wiki/Fichier:SVG_Simple_Logo.svg

ImageMagick seems to have support for .ai
http://www.imagemagick.org

Illustrator natively has the ability to save as a PDF.

The challenge with users submitting an .ai file is you can have many versions of the same design or document with varied layer combinations within the same document and endless combinations of these across various artboards (which can all be different sizes within the same document). I don't think doing this well is a matter of simply being able to display a certain file format or a preview of the document. As above I think it would be better to utilise other formats such as PDF, SVG or just make it simpler and educate them through the UI to save comps as PNG/JPG/SVG etc and make the ai available for download.

Related

Display PDF in <div> tag in my website

I'm developing a PHP MySql website in which pdf will be uploaded by site administrator. Viewers will get a list of all the pdf documents.
What I want is:
To open the PDF in my <div>.
No user should be able to download the PDF by any means.
I tried google doc viewer, it simply converts pdf to images which can be saved easily.
Also it gives View in Full option by which one can easily download the pdf.
And ofcourse,
<div><object data="test.pdf" type="application/pdf" width="300" height="200"></object></div>
is not working.
Please help..
You can use an iframe to embed a PDF inside a div, though it will rely on them having a PDF-reader plugin enabled on their browser. However, there is no way to show a PDF to a user in a way that does not let them save it
In order to read the PDF they HAVE to save a tmp version on their computer in any case, so you simply cannot prevent them from having a copy if they want.
There are a variety of ways to make it more difficult, but that's it. Tieson's solution, which draws the PDF to an HTML5 canvass makes it difficult to get the original PDF for non-technical users, but it only took about 2 minutes for me to find the PDF source and download the original (i.e. http://hazaar.funkynerd.com/pdfdoc/get?file=acr5smallpdf_80327_7.pdf). There are other, similar approaches using java or flash that don't actually show the PDF, but rather a rendering of the PDF by a third-party plugin, which will make it even more difficult, but even then the user could re-create the PDF using third-party tools or just simple screenshots, etc.
It's not really 100% reliable/stable, but there is a jQuery plugin for Mozilla's experimental PDF.js at http://dev.funkynerd.com/projects/jquery-pdfdoc

Pdf book reader in php?

Actually I have to upload pdf files and need to read on my website as book reader like a presentation. Please show me the possible ways to achieve my goals.
Thank you
I've been using flexpaper, I use pdf2swf to convert the pdf to swf as I used the flash version but there is a javascript version too.
One possible solution would be to use scribd. You simply upload your document to their website and embed their reader on your website. This is the easiest way, and you get things like searchability. Their reader also works like Adobe's Acrobat Reader.
The downside is that you are uploading your documents onto a public website, so everyone will be able to view it. Perhaps they might have settings where you can lock your documents so that only certain people can see them.
The next solution is to roll your own. You can use turn.js. In this case, you will need to find a way to convert your PDF files to HTML files or perhaps image files. With images, your text won't be selectable, and they won't be discoverable by search engines. Again, converting PDF to HTML can also be difficult as you might lose formatting in the process.
But it is entirely up to your use case. Personally, I would go with scribd, as their platform works very well, and you won't have to worry about implementing your own system.

What PHP library or tool can scale the size of an existing PDF and its contents?

I have written an web application that dynamically creates PDFs that contain only 1-page that has various vector graphics in it, say for example a complex pie or bar chart. In the back-end I have need to scale this PDF and its contents programaticaly to a few different sizes for print.
The few tools I've looked at so far for PHP seem to generate an image out of the original PDF and scale that, which doesn't work for me, I need the contents to remain vectorized and scale with the document.
Any pointers?
probably the simples walkaround would be to generate different PDF files for different page sizes from your original web-application

creating pdf from web page with SWF files

I am trying to generate a pdf from a web page which has pictures and swf files.
Final pdf should have pictures (swf should be converted into image, last frame is sufficient).
I am able to generate pdf when only images are there but i am stuck in creating pdf when the web page has swf files.
I've used wkhtmltopdf before to render pdfs programatically from web sites. I'm not sure if it'll cope with swf but it may do since it uses a version of webkit compiled in to qt.
You might be able to use wkhtmltopdf --enable-plugins. But according to this bugreport it might not work http://code.google.com/p/wkhtmltopdf/issues/detail?id=48 with the flash plugin (Java however does!).
Another option is running a browser in headless mode, or on a virtual X. Firefox3 works supposedly if you use the extension "CommandLinePrint".
Xvfb :2 -screen 0 1600x1200x24 &
firefox --display=localhost:2.0 -print http://flashgames.com -printmode pdf -printfile '/tmp/test.pdf'
Infos stolen from http://spielwiese.la-evento.com/xelasblog/archives/31-Headless-Firefox-als-HTML-to-PDF.html (in German however).
But there are a few more guides like this ("headless browser, HTML to PDF"). I would totally link to one of the dupes here on Stackoverflow. But I'm too lazy to search right now.
Since you are wanting to output the target page as a PDF I would look at using .rdlc (Report Definition Language Client). It is part of the Microsoft.Reporting namespace and is designed to work with asp.net. It is freely usable and redistributable.
In many cases the layout of a web page is not "printer friendly". By using this technique you can re-arrange the layout and spacing of the PDF output to a presentation that is more printer friendly.
This will not "directly" convert your page to a PDF, but rather allow you to adapt your page layout and data to a dataset and use that to build a report. That report can then be output programmatically at runtime using the reportviewer control. If this approach interests you, let me know and I will be glad to provide more help getting you through setting it up and using.

PHP generate HTML convert to JPG then to PDF

I'm developing an app where the user adds items to a list. That list is stored in an array and passed to PHP with JSON.
The objective is to then create a PDF with all the values extracted from the user. The PDF is quite complicated. It includes images depending on what the user selects and the text varies depending on the images and the input data.
The first idea was to generate the pdf in php with one of those pdf libraries, but that's going to be a real hassle.
Then I thought of creating an html & css (much easier) and the convert it to PDF. But since the html & css are quite complex I don't think those pdf converters will work with this.
Then I thought I could convert the html to jpg and then to pdf.
It'll be much simpler if I could just use html but the output needs to be pdf.
What do you suggest?
Here's a post that discusses creating PDF files with PHP and the PDFLib extension.
Generate PDFs with PHP it's on sitepoint.
Or if you want to go from HTML to the PDF it looks like TCPDF might work.
You can try using FPDF
Then I thought of creating an html & css (much easier) and the convert it to PDF. But since the html & css are quite complex I don't think those pdf converters will work with this.
wkhtmltopdf to the rescue! If you are on a VPS or dedicated machine, it's probably the best (open source) HTML-to-PDF engine out there. It leverages Webkit, the rendering engine used by Google Chrome and Apple Safari, amongst others.
Otherwise, your only other options are going to involve drawing every aspect of the PDF or image yourself, "by hand" in your code.

Categories