Page 1 of 1

pdf to image within Live Code?

Posted: Thu Jun 30, 2011 4:25 pm
by admin12
In the program I am writing, I need to allow users to upload files. Some will upload as jpg and some as pdf. What I want to do is convert the pdf files to jpg or png and store them on the file server as that. Will the snapshot command work for this? If not, is it possible within Live Code?

Mike

Re: pdf to image within Live Code?

Posted: Thu Jun 30, 2011 4:30 pm
by Klaus
Hi Mike,

on the Mac you could use a shell command with "SIPS" (enter "man sips" in the terminal),
no idea about windows.


Best

Klaus

Re: pdf to image within Live Code?

Posted: Thu Jun 30, 2011 6:29 pm
by admin12
Klaus,

99.99% of anyone using this will be on windows.

Mike

Re: pdf to image within Live Code?

Posted: Thu Jun 30, 2011 7:09 pm
by Klaus
OK, so my advice is only for the remaining 0.01 % users.
Could be worse 8)

Re: pdf to image within Live Code?

Posted: Fri Jul 01, 2011 12:28 am
by SparkOut
Cross-platform, I think you should be able to view the pdf in a browser window and then use "revBrowserSnapshot" to export the snapshot of the pdf display to a variable that can be saved into an image file.

Re: pdf to image within Live Code?

Posted: Sat Jul 02, 2011 6:40 pm
by admin12
SparkOut wrote:Cross-platform, I think you should be able to view the pdf in a browser window and then use "revBrowserSnapshot" to export the snapshot of the pdf display to a variable that can be saved into an image file.
Perfect. That is what I was hoping. Thank you.

Mike

Re: pdf to image within Live Code?

Posted: Wed Oct 15, 2014 7:25 pm
by Lakoza
Another cross-platform solution https://convertio.co/pdf-jpg/

Re: pdf to image within Live Code?

Posted: Thu Oct 16, 2014 1:44 am
by [-hh]
Snapshot is currently at some low "density" (some say 'at dpi'), mostly at 72 dpi. "Big" imaging apps ask you at which "resolution" the pdf should be imported.

To have this also with an open source tool, you could install on Mac-Win-Linux graphicsMagick (needs on Windows also ghostScript). This is very fast and enables you to have the image in a certain resolution, in case you think of scaling the image for some high-resolution displays or think of printing it. Installing is easy (good documented).

You can use this by "shell". For example:

Code: Select all

-- Converts your PDF to an image at advanced LaserPrinter quality (600 dpi)
-- JPG is small in size, PNG preserves transparency, GIF holds multipages of PDF
-- All formats are good for PDF-Text if density is good enough (try first 144)
set defaultfolder to "/your-home/folder-containing-input-pdf"
get shell("gm convert -density 600 input.pdf output.png")

Re: pdf to image within Live Code?

Posted: Thu Oct 16, 2014 4:15 am
by Thierry
Hi,

Are you aware of this Windows only product (not free)?

http://www.soraxsoft.com/pdf/sdk/dll.php#sdk_dll

and there is a Livecode external for it: sunnYpdf

You can contact me off-list if you are interested.

Regards,

Thierry

Re: pdf to image within Live Code?

Posted: Thu Oct 16, 2014 4:47 am
by [-hh]
Concluding from the very high quality of sunnYmidi, I presume sunnYpdf will be also perfect. This could be interesting for everybody who has to do a lot of such conversions.
Moreover, the new CEF browser of LC has and will have for next time a *lot* of problems to display local pdfs (that is, to make the adobe reader plugins working).

Perhaps you could think about offering sunnYpdf (or give more info about it) on your homepage?

Re: pdf to image within Live Code?

Posted: Thu Oct 16, 2014 5:00 am
by Thierry
[-hh] wrote:Concluding from the very high quality of sunnYmidi,
I presume sunnYpdf will be also perfect.
Hallo Hermann,
Wow. Sounds Christmas time coming sooner this year :)
Perhaps you could think about offering sunnYpdf (or give more info about it) on your homepage?
Here it is: ..........

Kind regards,

Thierry