Title: RE: [iText-questions] embedded image doesn't look good

This code should work:

Image img = Image.getInstance("my_image.png");
int dpi = img.getDpiX();
if (dpi > 0)
    img.scalePercent(7200f / dpi);

Note that many times the dpi stated in the file is just a number, usually 300, and bear no relashionship with the original image dimensions.

Best Regards,
Paulo Soares

    -----Original Message-----
    From:   [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED] On Behalf Of Michael Korolyov

    Sent:   Thursday, January 22, 2004 17:47
    To:     [EMAIL PROTECTED]
    Subject:        RE: [iText-questions] embedded image doesn't look good

    It’s in PNG format

    Thank you.

    Best Regards.
    Michael.

    -----Original Message-----
    From: Paulo Soares [mailto:[EMAIL PROTECTED]]
    Sent: Thursday, January 22, 2004 7:00 AM
    To: Michael Korolyov; [EMAIL PROTECTED]
    Subject: RE: [iText-questions] embedded image doesn't look good


    What's the format of your image (jpeg, png, etc)?
    Best Regards,
    Paulo Soares

    -----Original Message-----
    From:�� Michael Korolyov [SMTP:[EMAIL PROTECTED]
    Sent:�� Thursday, January 22, 2004 1:20
    To:���� Paulo Soares; [EMAIL PROTECTED]
    Subject:������� RE: [iText-questions] embedded image doesn't look good

    Thanks for answer.
    I re read tutorial again, but still can't understand how to embed my
    image for 1 to 1 scale.
    Would you mind tell me what scale I need to set based on my image
    properties? Please.

    Image 700 x 300 pixels True Color (24bit)
    Also MS Photo editor shows: Resolution 96 Pixels/Inch and size 7.29 by
    3.13 Inches.

    What I need to put for scalePercent() or for any other method to get in
    result PDF not scaled image when PDF goes to Print or displays in 100%
    scale?

    Thanks a lot.
    Best Regards.
    Michael.


    -----Original Message-----
    From: Paulo Soares [<mailto:[EMAIL PROTECTED]>]
    Sent: Saturday, January 17, 2004 7:55 AM
    To: Michael Korolyov; [EMAIL PROTECTED]
    Subject: Re: [iText-questions] embedded image doesn't look good

    That's a problem of scaling. See the tutorial for an explanation on
    image
    scaling and DPI.

    Best Regards,
    Paulo Soares

    ----- Original Message -----
    From: "Michael Korolyov" <[EMAIL PROTECTED]>
    To: <[EMAIL PROTECTED]>
    Sent: Friday, January 16, 2004 19:11
    Subject: [iText-questions] embedded image doesn't look good


    Hello,
    In my code:
    ��������������� Image png = Image.getInstance(realPath +"/"+
    getFileName());
    ��������������� png.setAlignment(Element.ALIGN_CENTER);
    ��������������� document.add(png);

    As result in PDF this image is oversized and went out of page, where it
    has right size in pixels and looks good in HTML.
    What I'm missing?

    Thank you.
    Best Regards.
    Michael.

Reply via email to