You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2010/03/30 07:56:27 UTC
[jira] Commented: (PDFBOX-116) PNG image page completely garbled
[ https://issues.apache.org/jira/browse/PDFBOX-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12851266#action_12851266 ]
Andreas Lehmkühler commented on PDFBOX-116:
-------------------------------------------
Hmm, sounds like one of my last checkins doesn't work that well. Probably my changes (928402 and 928408) to PDPixelmap are the reason. I'll investigate later
> PNG image page completely garbled
> ---------------------------------
>
> Key: PDFBOX-116
> URL: https://issues.apache.org/jira/browse/PDFBOX-116
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Fix For: 1.1.0
>
>
> [imported from SourceForge]
> http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1392196
> Originally submitted by nobody on 2005-12-28 11:09.
> Hi:
> Attached is a zip file containing a 1 page PDF scanned
> PDF doc and the image extracted using pdfBox.
> As you can see, the PDF file shows the document fine,
> but the image (which it saved with suffix png.png) is
> completely garbled.
> I have tried the following ways, all with the same
> result:
> (a) PDPage.convertToImage() --> BufferedImage -->
> ImageIO.write(image,"png",...)
> Code:
> PDDocument document = PDDocument.load("test3.pdf");
> List pages = document.getDocumentCatalog().getAllPages
> ();
> PDPage page = (PDPage)pages.get(0);
> BufferedImage image = page.convertToImage();
> ImageIO.write(image, "png", new File("test31.png"));
> (b) PDPage --> PDResources --> getImages() --> obtain
> the PDXObjectImage() from iterator --> getRGBImage() -
> -> BufferedImage --> ImageIO.write().
> PDDocument document = PDDocument.load("test3.pdf");
> List pages = document.getDocumentCatalog().getAllPages
> ();
> PDPage page = (PDPage)pages.get(0);
> PDResources resources = page.getResources();
> Map images = resources.getImages();
> if( images != null )
> {
> Iterator imageIter = images.keySet().iterator();
> while( imageIter.hasNext() )
> {
> String key = (String)imageIter.next();
> PDXObjectImage image = (PDXObjectImage)
> images.get( key );
> image.write2file("test3."+image.getSuffix());
> BufferedImage bufImg = image.getRGBImage();
> ImageIO.write(bufImg, "png", new File
> ("test31.png"));
> }
> }
> Please let me know!
> CONTACT: vick_venkat at yahoo dot com.
> [attachment on SourceForge]
> http://sourceforge.net/tracker/download.php?group_id=78314&atid=552832&aid=1392196&file_id=161339
> testdocs.zip (application/x-zip-compressed), 74080 bytes
> Contains PDF file with extracted garbled PNG image
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.