Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I convert a PDF file to an image?
    text
    copied!<p>I'm giving users the ability to upload an image to my Air app, then displaying this image in an image control. But I need to allow for PDF uploading in the same manner, so I need to convert the PDF to an image. I only care about the first page of the PDF they upload for now. </p> <p>What I'm doing is: 1) User browses for a file with the file reference control 2) User chooses the image or PDF to upload 3) I encode said image to base64 and store it 4) I then load from that base64 with something like:</p> <pre><code>public function decodeImage(b64String:String):void{ var decoder:Base64Decoder = new Base64Decoder(); decoder.decode(b64String); var imgLoader:Loader = new Loader(); imgLoader.loadBytes(decoder.toByteArray()); imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,decodedImageLoaded); } private function decodedImageLoaded(event:Event):void{ var imgLoader:Loader = (event.target as LoaderInfo).loader; var bmp:Bitmap = Bitmap(imgLoader.content); imgLoader.removeEventListener(Event.COMPLETE, decodedImageLoaded); var img:Image = new Image(); img.source = bmp; this.addChild(img); } </code></pre> <p>This method is working great for .gif, .jpg, and .png. At some point in my process, probably the initial upload I need to convert the first page of a PDF to a png so that I can use the rest of this process. </p> <p>I welcome any ideas with the sole requirement being that it has to be a part of the Air app, I can't use something like ImageMagick that runs on a server, but I could use a component that I can compile in to the finished product.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload