Try Apache FOP: http://xmlgraphics.apache.org/fop/.

It has very good support for many different image types. Just download
it and try it from the command-line:

fop -imagein myimage.png -pdf myimage.pdf

On 22.04.2011 02:01:50 Adam wrote:
> I see.  I also found out that converting to a TIF was not a trivial task, 
> so I went with the PNG -> JPG -> [Resized JPG to fit on page ->] PDF 
> route.  Not the best solution, but it's good enough to suit my needs.
> 
> If anyone wants to work on the PDPixelMap(PDDocument doc, BufferedImage 
> awtImage) constructor, this sounds like it's the answer to embed any image 
> into a PDF.
> 
> ---- 
> Thanks,
> Adam
> 
> 
> 
> From:
> Russ Pridemore <[email protected]>
> To:
> [email protected]
> Date:
> 04/21/2011 14:07
> Subject:
> Re: Converting an image to a PDF
> 
> 
> 
> Yes, I can confirm that works, but may not produce acceptable results
> depending on the image.  JPG is not optimal for many types of images.  I
> have the same issue with pdfbox...
> 
> Russ
> On Apr 21, 2011 4:38 PM, "Ken Bowen" <[email protected]> wrote:
> > Adam,
> >
> > Why not do a separate conversion of the PNG to JPEG first, and then
> convert the JPEG to PDF? There are many tools (if it's only a one-off or
> two) and libraries (for a pipeline) out there. I even think you could
> probably do the conversion using the basic JVM 1.6 AWT facilities.
> >
> > Ken
> >
> > On Apr 21, 2011, at 3:55 PM, [email protected] wrote:
> >
> >> I'm looking for a way to convert an image to a PDF. I found
> >> org.apache.pdfbox.examples.pdmodel.ImageToPDF which looks like it'll 
> work
> 
> >> for JPG and TIF files, but it doesn't seem to support PNG (or any other
> >> type for that matter). I traced through the library a little and found
> >> some code that was commented out which uses a PDPixelMap, but the
> >> constructor which takes a BufferedImage no longer exists. The comments
> >> around there say "This method is broken and needs to be implemented"
> which
> >> is a bit discouraging.
> >>
> >> So my basic question is this: Is there an easy way to convert a PNG to 
> a
> >> PDF?
> >>
> >> If so, do I need to worry about things like scaling, images becoming
> >> blurry or too small to see/read, large images getting cut off b/c they
> >> don't fit on a page, etc.?
> >>
> >> ----
> >> Thanks,
> >> Adam
> >>
> >> - FHA 203b; 203k; HECM; VA; USDA; Conventional
> >> - Warehouse Lines; FHA-Authorized Originators
> >> - Lending and Servicing in over 45 States
> >> www.swmc.com - www.simplehecmcalculator.com Visit 
> www.swmc.com/resourcesfor helpful links on Training, Webinars, Lender 
> Alerts and Submitting
> Conditions
> >> This email and any content within or attached hereto from Sun West
> Mortgage Company, Inc. is confidential and/or legally privileged. The
> information is intended only for the use of the individual or entity named
> on this email. If you are not the intended recipient, you are hereby
> notified that any disclosure, copying, distribution or taking any action 
> in
> reliance on the contents of this email information is strictly prohibited,
> and that the documents should be returned to this office immediately by
> email. Receipt by anyone other than the intended recipient is not a waiver
> of any privilege. Please do not include your social security number, 
> account
> number, or any other personal or financial information in the content of 
> the
> email. Should you have any questions, please call (800) 453 7884.
> >
> 
> 
> 
> 
> 
> - FHA 203b; 203k; HECM; VA; USDA; Conventional 
> - Warehouse Lines; FHA-Authorized Originators 
> - Lending and Servicing in over 45 States 
> www.swmc.com   -  www.simplehecmcalculator.com   Visit  
> www.swmc.com/resources   for helpful links on Training, Webinars, Lender 
> Alerts and Submitting Conditions  
> This email and any content within or attached hereto from Sun West Mortgage 
> Company, Inc. is confidential and/or legally privileged. The information is 
> intended only for the use of the individual or entity named on this email. If 
> you are not the intended recipient, you are hereby notified that any 
> disclosure, copying, distribution or taking any action in reliance on the 
> contents of this email information is strictly prohibited, and that the 
> documents should be returned to this office immediately by email. Receipt by 
> anyone other than the intended recipient is not a waiver of any privilege. 
> Please do not include your social security number, account number, or any 
> other personal or financial information in the content of the email. Should 
> you have any questions, please call (800) 453 7884.  




Jeremias Maerki

Reply via email to