Sign In  Sign Up Live-Chat

Controlling image size/resolution of exported pdf page

Last post 05-05-2008, 2:00 AM by emilioMalaga. 9 replies.
Sort Posts: Previous Next
  •  08-27-2007, 3:09 PM 92431

    Controlling image size/resolution of exported pdf page

    Hi,

    is it possible to control the final size / resolution of an exported image from a pdf file/page?

    We would like to ensure that the image from any pdf file is correctly sized for the word document,

    including ensuring that it fits inside page margins.

    Can we query the pdf file for its resolution / page width and height?

    And if possible can we use these values to manipulate the resulting image size and resolution?

    Thanks,

     

       

     
  •  08-27-2007, 5:32 PM 92452 in reply to 92431

    Re: Controlling image size/resolution of exported pdf page

    Hi,

    Thank you for considering Aspose.

    I think you need to use Aspose.Pdf.Kit.PdfConverter class and use the following method convert Pdf to Image and also set the resolution as well. Please refer to:

    public void GetNextImage(
       Stream outputStream,
       ImageFormat format,
       int resolutionX,
       int resolutionY,
       int quality
    );

    Thanks.
     
  •  04-29-2008, 5:42 AM 124572 in reply to 92452

    Re: Controlling image size/resolution of exported pdf page

    Hi,

    Which are the units for resolution? And for the quality?

    Thanks
     
  •  04-29-2008, 8:11 AM 124601 in reply to 124572

    Re: Controlling image size/resolution of exported pdf page

    (I mean, PdfConverter.Resolution, and also resolutionX, resolutionY and quality. Is it dots per inch, or...??)

    Thanks
     
  •  04-29-2008, 8:53 AM 124613 in reply to 124601

    Re: Controlling image size/resolution of exported pdf page

    Hi,

    Yes, the unit of resolution is dots per inch. And the quality is measurement used in JPEG, with the value from 0 to 100(0 is lowest quality and 100 is highest qulity ).

    Thanks,


    Felix Liu
    Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  04-29-2008, 9:44 AM 124624 in reply to 124613

    Re: Controlling image size/resolution of exported pdf page

    Quick response!!

    Thanks.
     
  •  04-30-2008, 3:37 AM 124777 in reply to 124613

    Re: Controlling image size/resolution of exported pdf page

    Hi,

    I'd like to know what is the relationship between PdfConverter.Resolution, and the resolutionX, resolutionY parameters of PdfConverter.GetNextImage(...). How do they affect each other?

    I want to obtain an image at a certain resolution(dpi), but I'm not sure how to set those 3 parameters to obtain the desired result.

    This is the code:

                PdfConverter pdfConv = new PdfConverter();

                pdfConv.BindPdf(pdfStream);

                pdfConv.StartPage = startPage;
                pdfConv.EndPage = endPage;
                pdfConv.Resolution = PDF_TO_IMAGE_MAXRESOLUTION;

                // convert PDF page to image

                pdfConv.DoConvert();

                MemoryStream outputStream = new MemoryStream();

                if (pdfConv.HasNextImage())
                {
                    // Save image to specific file
                    pdfConv.GetNextImage(outputStream,
                                         imageFormat,
                                         PDF_TO_IMAGE_MAXRESOLUTION_X,
                                         PDF_TO_IMAGE_MAXRESOLUTION_Y,
                                        JPG_MAXQUALITY)
                        );
                }

                return outputStream;


    Thanks.
     
  •  05-01-2008, 7:48 PM 125069 in reply to 124777

    Re: Controlling image size/resolution of exported pdf page

    I will discuss this issue with the developers and reply to you. Currently we are on holiday so we might reply to you a little later.
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  05-03-2008, 8:27 AM 125255 in reply to 124777

    Re: Controlling image size/resolution of exported pdf page

    Hi,

    Thank you  for pointing that out.

    When the property PdfConverter.Resolution is set, the 2 parameters (resolution_x, resolution_y) in the method PdfConverter.GetNextImage() takes no effect. Sorry for that we didn't explain this in the documentation.

    Thanks,


    Felix Liu
    Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  05-05-2008, 2:00 AM 125331 in reply to 125255

    Re: Controlling image size/resolution of exported pdf page

    No worries, thanks for the clarification :-)
     
View as RSS news feed in XML