pdf to image within Live Code?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
pdf to image within Live Code?
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
Mike
Re: pdf to image within Live Code?
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
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?
Klaus,
99.99% of anyone using this will be on windows.
Mike
99.99% of anyone using this will be on windows.
Mike
Re: pdf to image within Live Code?
OK, so my advice is only for the remaining 0.01 % users.
Could be worse
Could be worse
Re: pdf to image within Live Code?
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?
Perfect. That is what I was hoping. Thank you.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.
Mike
Re: pdf to image within Live Code?
Another cross-platform solution https://convertio.co/pdf-jpg/
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: pdf to image within Live Code?
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:
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")
shiftLock happens
Re: pdf to image within Live Code?
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
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
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: pdf to image within Live Code?
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?
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?
shiftLock happens
Re: pdf to image within Live Code?
Hallo Hermann,[-hh] wrote:Concluding from the very high quality of sunnYmidi,
I presume sunnYpdf will be also perfect.
Wow. Sounds Christmas time coming sooner this year
Here it is: ..........Perhaps you could think about offering sunnYpdf (or give more info about it) on your homepage?
Kind regards,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!