You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Lucas Junqueira / Ciclope <lu...@ciclope.art.br> on 2013/02/23 18:29:49 UTC

use flex to create picture (JPG or PNG) files from a PDF?

Hi, is there a way to use flex to open a PDF file and save its contents
(all pages) as picture files? I was looking for some solutions like opening
the PDF with the HTMLLoader class or use some libraries like alivepdf but
didn't get good results...

-- 
Lucas Junqueira
lucas@ciclope.art.br / (31)2555-0635 / (31)9133-6635
Ateliê Ciclope de arte e publicação digital

Re: use flex to create picture (JPG or PNG) files from a PDF?

Posted by Lucas Junqueira / Ciclope <lu...@ciclope.art.br>.
Great news: the Imagik approach worked perfectly and it was, in fact, very
simple to implement! The next Managana version will feature PDF import!
Some results here, with different PDF dentities:

http://www.managana.org/editor/?community=gettingstarteddoc

www.managana.org/editor/?community=managanaitsshowtime

2013/2/24 Wayne Studley <wa...@me.com>

> With regard this view PDF topic that's been bounded about of late - I'd
> last year built a flex app that would parse/decode PDF's and convert the
> various objects into their various objects - with some limitations I should
> add.
>
> PDFx were preferable inputs but the results were pretty good - decoding
> fonts (only the characters within the PDF), text (all ok), images
> (gifs/jpgs ok but png's were limited to non-alpha channelled). All the
> binaries could be written to output files (such as the images - regardless
> of input-format, fonts - although you'd need licensing agreements for the
> latter - needless to say).
>
> Vector graphics were also resolved but I'd had a good few problems
> resolving RGB>CMYK>RGB colour corrections (somewhat resolved but using
> native .net components - bit of a bugger as I prefer PHP/MySQL - and
> generally open-source code bases - you'll all be glad to hear).
>
> If anyone would like to positively contribute to the effort (I'd had to
> give up due to 'proper' responsibilities - but I'm keen to get this
> behemoth working full-time!) I'd be happy to open up the source - it ain't
> pretty but it works to a degree…
>
> The majority of the work is down to decoding/decrypting various types of
> Adobe's PDF methods - and it is a beast to overcome (countless hours on PDF
> discussion sites and binary/bytearray info site (Thibault Imbert of
> AlivePDF deserves a shout here for fantastic inspiration a good few years
> ago)) << am I allowed to double-brace comments on a coding forum?
>
> I'd have to ask for open-source updates (I don't want anybody to take this
> and run with it) and as I've not openly sourced anything before - can
> anyone on the Apache team let me know a good route to go down so as to
> ensure that my previous work would be collaborated on as opposed to… reaped?
>
> I'll look forward to any feedback?
>
> Wayne
>
>
>
>
> On 24 Feb 2013, at 22:16, "Lucas Junqueira / Ciclope" <
> lucas@ciclope.art.br> wrote:
>
> > HI, I did some checking on PurePDF and it sounds very promising, but for
> > creating PDF, not for reading and parsing it into pictures - there are
> some
> > key limitations... However the idea of ImageMagik is nice, and since I'll
> > use it for a desktop AIR application for Windows, the solution is
> > excellent. Tryied it here and worked just fine - (I had to install
> > GhostScript too to make it work).
> >
> > Thank you!
>
>


-- 
Lucas Junqueira
lucas@ciclope.art.br / (31)2555-0635 / (31)9133-6635
Ateliê Ciclope de arte e publicação digital

Re: use flex to create picture (JPG or PNG) files from a PDF?

Posted by Wayne Studley <wa...@me.com>.
With regard this view PDF topic that's been bounded about of late - I'd last year built a flex app that would parse/decode PDF's and convert the various objects into their various objects - with some limitations I should add.

PDFx were preferable inputs but the results were pretty good - decoding fonts (only the characters within the PDF), text (all ok), images (gifs/jpgs ok but png's were limited to non-alpha channelled). All the binaries could be written to output files (such as the images - regardless of input-format, fonts - although you'd need licensing agreements for the latter - needless to say).

Vector graphics were also resolved but I'd had a good few problems resolving RGB>CMYK>RGB colour corrections (somewhat resolved but using native .net components - bit of a bugger as I prefer PHP/MySQL - and generally open-source code bases - you'll all be glad to hear).

If anyone would like to positively contribute to the effort (I'd had to give up due to 'proper' responsibilities - but I'm keen to get this behemoth working full-time!) I'd be happy to open up the source - it ain't pretty but it works to a degree…

The majority of the work is down to decoding/decrypting various types of Adobe's PDF methods - and it is a beast to overcome (countless hours on PDF discussion sites and binary/bytearray info site (Thibault Imbert of AlivePDF deserves a shout here for fantastic inspiration a good few years ago)) << am I allowed to double-brace comments on a coding forum?

I'd have to ask for open-source updates (I don't want anybody to take this and run with it) and as I've not openly sourced anything before - can anyone on the Apache team let me know a good route to go down so as to ensure that my previous work would be collaborated on as opposed to… reaped?

I'll look forward to any feedback?

Wayne 



 
On 24 Feb 2013, at 22:16, "Lucas Junqueira / Ciclope" <lu...@ciclope.art.br> wrote:

> HI, I did some checking on PurePDF and it sounds very promising, but for
> creating PDF, not for reading and parsing it into pictures - there are some
> key limitations... However the idea of ImageMagik is nice, and since I'll
> use it for a desktop AIR application for Windows, the solution is
> excellent. Tryied it here and worked just fine - (I had to install
> GhostScript too to make it work).
> 
> Thank you!


Re: use flex to create picture (JPG or PNG) files from a PDF?

Posted by Lucas Junqueira / Ciclope <lu...@ciclope.art.br>.
HI, I did some checking on PurePDF and it sounds very promising, but for
creating PDF, not for reading and parsing it into pictures - there are some
key limitations... However the idea of ImageMagik is nice, and since I'll
use it for a desktop AIR application for Windows, the solution is
excellent. Tryied it here and worked just fine - (I had to install
GhostScript too to make it work).

Thank you!

2013/2/23 Terry Corbet <tc...@ix.netcom.com>

> What the original poster would like to accomplish is, I believe, nicely
> accomplished in an AIR application that uses the PurePDF actionscript
> library in preference to the AlivePDF library.  If you visit both sites and
> spend a little time reviewing the issues at both of them, you may think
> that PurePDF is better supported.  Having tried to work with both, it was
> my experience that because the PurePDF library started with a more
> comprehensive intent to port the features from the very comprehensive
> iText, Java implementation it delivered more.  That said, I suppose you
> would care less about the comprehensiveness of the library as long as
> whichever one you chose provided the specific facilities you need.
>  Essentially that boils down to reading an existing PDF more than producing
> a new one, which is the primary problem that both projects originally set
> out to solve.
>
> Since that was also my primary interest, I can tell you that in terms of
> producting full-featured PDF documents, PurePDF wins hands down over
> AlivePDF.  In terms of reading and exracting content -- specifically jpeg
> images -- since my applications do not need to do that, I cannot give you a
> first-hand experience.  Instead, in reading your posting, I just went to
> the site and tested the sample program that compiles right out of the box
> and demonstrates such an extraction of a jpeg image from a test document.
>  I am pretty certain you could just point the sample program to your own
> PDF file and it would successfully extract all jpeg files for you..
>
>
> ----- Original Message ----- From: "Greg Huddleston" <
> ghuddleston@reachips.com>
> To: <us...@flex.apache.org>
> Cc: "Greg Huddleston" <gh...@reachips.com>
> Sent: February 23, 2013 12:59 PM
> Subject: RE: use flex to create picture (JPG or PNG) files from a PDF?
>
>
>
> 2/23/2013 @ 1 pm PT
>
> Hi Lucas and all... (I am new to the group and thought I would take a stab
> at your ?)
>
> Re:  convert PDF to pages.
>
> Not sure how to approach this inside a FLEX/AS3 app -- but I do know how
> you can do it offline using ImageMagik
>
> If interested in this approach, Install Imagemagik for your platform then
> issue a convert command  similar to the one below (like this depending on
> your general needs),
>
> Example:
>
>   Home:\ or   C:\  or ...     convert.exe c:\xampp\htdocs\bookdrop\test.**pdf
> -units PixelsPerInch -colorspace RGB -density 900x900 -quality 90
> c:\xampp\htdocs\assets\%%d.jpg
>
> Will pick apart a PDF and make test00.jpg, text01.jpg etc etc
>
> All for free...  I presume convert has a switch of some sort to go from
> PDF -> single-image if that's what you need/want.
>
> Obviously not flex/air related, but depending on your environment, perhaps
> you can logically kick off some sort of System("convert.exe . . . ") let
> the outside process perform what you need, and read in the IMG using
> something like StageWebView(), upon a completionEvent of some sort.
>
> Just a thought   Cheers //GH
>
> -----Original Message-----
> From: Lucas Junqueira / Ciclope [mailto:lucas@ciclope.art.br]
> Sent: Saturday, February 23, 2013 9:30 AM
> To: users@flex.apache.org
> Subject: use flex to create picture (JPG or PNG) files from a PDF?
>
> Hi, is there a way to use flex to open a PDF file and save its contents
> (all pages) as picture files? I was looking for some solutions like opening
> the PDF with the HTMLLoader class or use some libraries like alivepdf but
> didn't get good results...
>
> --
> Lucas Junqueira
> lucas@ciclope.art.br / (31)2555-0635 / (31)9133-6635 Ateliê Ciclope de
> arte e publicação digital
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2013.0.2899 / Virus Database: 2639/6110 - Release Date: 02/17/13
>
>
>


-- 
Lucas Junqueira
lucas@ciclope.art.br / (31)2555-0635 / (31)9133-6635
Ateliê Ciclope de arte e publicação digital

Re: use flex to create picture (JPG or PNG) files from a PDF?

Posted by Terry Corbet <tc...@ix.netcom.com>.
What the original poster would like to accomplish is, I believe, nicely 
accomplished in an AIR application that uses the PurePDF actionscript 
library in preference to the AlivePDF library.  If you visit both sites and 
spend a little time reviewing the issues at both of them, you may think that 
PurePDF is better supported.  Having tried to work with both, it was my 
experience that because the PurePDF library started with a more 
comprehensive intent to port the features from the very comprehensive iText, 
Java implementation it delivered more.  That said, I suppose you would care 
less about the comprehensiveness of the library as long as whichever one you 
chose provided the specific facilities you need.  Essentially that boils 
down to reading an existing PDF more than producing a new one, which is the 
primary problem that both projects originally set out to solve.

Since that was also my primary interest, I can tell you that in terms of 
producting full-featured PDF documents, PurePDF wins hands down over 
AlivePDF.  In terms of reading and exracting content -- specifically jpeg 
images -- since my applications do not need to do that, I cannot give you a 
first-hand experience.  Instead, in reading your posting, I just went to the 
site and tested the sample program that compiles right out of the box and 
demonstrates such an extraction of a jpeg image from a test document.  I am 
pretty certain you could just point the sample program to your own PDF file 
and it would successfully extract all jpeg files for you..


----- Original Message ----- 
From: "Greg Huddleston" <gh...@reachips.com>
To: <us...@flex.apache.org>
Cc: "Greg Huddleston" <gh...@reachips.com>
Sent: February 23, 2013 12:59 PM
Subject: RE: use flex to create picture (JPG or PNG) files from a PDF?


2/23/2013 @ 1 pm PT

Hi Lucas and all... (I am new to the group and thought I would take a stab 
at your ?)

Re:  convert PDF to pages.

Not sure how to approach this inside a FLEX/AS3 app -- but I do know how you 
can do it offline using ImageMagik

If interested in this approach, Install Imagemagik for your platform then 
issue a convert command  similar to the one below (like this depending on 
your general needs),

Example:

   Home:\ or   C:\  or ...     convert.exe 
c:\xampp\htdocs\bookdrop\test.pdf -units PixelsPerInch -colorspace 
RGB -density 900x900 -quality 90 c:\xampp\htdocs\assets\%%d.jpg

Will pick apart a PDF and make test00.jpg, text01.jpg etc etc

All for free...  I presume convert has a switch of some sort to go from 
PDF -> single-image if that's what you need/want.

Obviously not flex/air related, but depending on your environment, perhaps 
you can logically kick off some sort of System("convert.exe . . . ") let the 
outside process perform what you need, and read in the IMG using something 
like StageWebView(), upon a completionEvent of some sort.

Just a thought   Cheers //GH

-----Original Message-----
From: Lucas Junqueira / Ciclope [mailto:lucas@ciclope.art.br]
Sent: Saturday, February 23, 2013 9:30 AM
To: users@flex.apache.org
Subject: use flex to create picture (JPG or PNG) files from a PDF?

Hi, is there a way to use flex to open a PDF file and save its contents (all 
pages) as picture files? I was looking for some solutions like opening the 
PDF with the HTMLLoader class or use some libraries like alivepdf but didn't 
get good results...

--
Lucas Junqueira
lucas@ciclope.art.br / (31)2555-0635 / (31)9133-6635 Ateliê Ciclope de arte 
e publicação digital


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.2899 / Virus Database: 2639/6110 - Release Date: 02/17/13



RE: use flex to create picture (JPG or PNG) files from a PDF?

Posted by Greg Huddleston <gh...@reachips.com>.
2/23/2013 @ 1 pm PT

Hi Lucas and all... (I am new to the group and thought I would take a stab at your ?)

Re:  convert PDF to pages.

Not sure how to approach this inside a FLEX/AS3 app -- but I do know how you can do it offline using ImageMagik

If interested in this approach, Install Imagemagik for your platform then issue a convert command  similar to the one below (like this depending on your general needs),

Example: 

   Home:\ or   C:\  or ...     convert.exe c:\xampp\htdocs\bookdrop\test.pdf -units PixelsPerInch -colorspace RGB -density 900x900 -quality 90 c:\xampp\htdocs\assets\%%d.jpg

Will pick apart a PDF and make test00.jpg, text01.jpg etc etc

All for free...  I presume convert has a switch of some sort to go from PDF -> single-image if that's what you need/want.

Obviously not flex/air related, but depending on your environment, perhaps you can logically kick off some sort of System("convert.exe . . . ") let the outside process perform what you need, and read in the IMG using something like StageWebView(), upon a completionEvent of some sort.

Just a thought   Cheers //GH

-----Original Message-----
From: Lucas Junqueira / Ciclope [mailto:lucas@ciclope.art.br] 
Sent: Saturday, February 23, 2013 9:30 AM
To: users@flex.apache.org
Subject: use flex to create picture (JPG or PNG) files from a PDF?

Hi, is there a way to use flex to open a PDF file and save its contents (all pages) as picture files? I was looking for some solutions like opening the PDF with the HTMLLoader class or use some libraries like alivepdf but didn't get good results...

--
Lucas Junqueira
lucas@ciclope.art.br / (31)2555-0635 / (31)9133-6635 Ateliê Ciclope de arte e publicação digital