Hi all,

 

I searched the iText mailinglist fort his problem.

I found several, but none of the provided solutions work for me.

 

I am making a program for a friend of mine wich must extract images from a
pdf.

All the images are upside down, they are NOT rotated!!

 

Here's the pdf:
www.jpproducties.nl/Documents/order 200047.pdf
<http://www.jpproducties.nl/Documents/order%20200047.pdf> 

 

Here's the extracted image from the first page:

www.jpproducties.nl/Documents/test_1_0.png

 

Here's my codesnippet.

The class has 2 methods. 

1 without _outputFilePrefix and _outputFolder, this one is the one i intend
to use.

The other method can be used to write the images to file.

Both methods give the images upside down.

 

public void RenderImage(ImageRenderInfo renderInfo)

        {

            try

            {

                PdfImageObject image = renderInfo.GetImage();

                if (image != null)

                {

                    if (_outputFilePrefix.Length == 0 ||
_outputFolder.Length == 0)

                    {

                        var drawingImage = image.GetDrawingImage();

                        _retList.Add(drawingImage);             

                    }

                    else

                    {

                        var imageFileName = String.Format("{0}_{1}_{2}.{3}",
_outputFilePrefix, _currentPage, _imageCount, image.GetFileType());

                        var imagePath =
System.IO.Path.Combine(_outputFolder, imageFileName);

                        if (_overwriteExistingFiles ||
!File.Exists(imagePath))

                        {

                            var imageRawBytes = image.GetImageAsBytes();

                            File.WriteAllBytes(imagePath, imageRawBytes);

                        } 

                        // Subtle: Always increment even if file is not
written. This ensures consistency should only some

                        //   of a PDF file's images actually exist.

                        _imageCount++;

                    }

                }

            }

            catch (Exception)

            {

            }

        }

 

Thank in advance for your help.

 

Best Regards,

JohnvandePol

 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to