Sign In  Sign Up Live-Chat

Add picture to pdf-document

Last post 07-12-2007, 2:21 AM by forever. 4 replies.
Sort Posts: Previous Next
  •  07-10-2007, 6:13 AM 83359

    Add picture to pdf-document

    Hello,

    How can I add a picture to a pdf document with a specific width, keeping the aspect ratio ? When I set the fixWidth of the imageInfo, the height remanes the same (= original height) ! Do I have to calculate the scale myself ? --> getWidth / available space

    Thanks !

    Goddeau H.

     
  •  07-10-2007, 7:03 AM 83364 in reply to 83359

    Re: Add picture to pdf-document

    HGOAS4:

    Hello,

    How can I add a picture to a pdf document with a specific width, keeping the aspect ratio ? When I set the fixWidth of the imageInfo, the height remanes the same (= original height) ! Do I have to calculate the scale myself ? --> getWidth / available space

    Thanks !

    Goddeau H.

    Result getWidth = 0 ?

     
  •  07-10-2007, 8:51 AM 83395 in reply to 83364

    Re: Add picture to pdf-document

    Hi,

    Thank you for considering Aspose.

    I have checked your problem and found that if you change the scale level then both Width and Height of the image is changed and aspect ratio is maintained. For example by default the scale is 1, you can change it to 0-1 any value to reduce the size and more than 1 to increase the size of the image:

    img.setImageScale(0.5f);

    About the FixWidth, you can set only width and the height remains as it is. I will discuss this problem of getWidth = 0 and to add another function to set the FixHeight to calculate the aspect ratio and scale of the image. 

    Thanks.

    Adeel Ahmad
    Support Developer
    Aspose Changsha Team
    http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html
     

     
  •  07-10-2007, 8:40 PM 83496 in reply to 83395

    Re: Add picture to pdf-document

    Currently you can only use setImageScale method and you have to use Java awt to get the image size. I have logged this issue and we will try to improve this in the future version.
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-12-2007, 2:21 AM 83779 in reply to 83496

    Re: Add picture to pdf-document

    In the attachment of http://www.aspose.com/Community/Forums/83769/ShowThread.aspx#83769, we also supported setting fixed width or height that keeps the aspect ratio.
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
View as RSS news feed in XML