• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1533
  • Last Modified:

pdf size using itextsharp

hi
This is really the question,
How can we get the exact obsolete image size of the image, because when I extracted the image from the pdf file, the image was huge(1295x620),  but in viewing the pdf using any pdf reader, the image is small(a small RED box at the center)

small image in pdf page
How can I get that small size?
0
systan
Asked:
systan
  • 4
1 Solution
 
systanAuthor Commented:
it says:
jpg2.Height * my_scalefactor

Open in new window


where can i get my_scalefactor?
if (pic.Height > pic.Width)
    {
        //Maximum height is 800 pixels.
        float percentage = 0.0f;
        percentage = 700 / pic.Height;
        pic.ScalePercent(percentage * 100);
    }
    else
    {
        //Maximum width is 600 pixels.
        float percentage = 0.0f;
        percentage = 540 / pic.Width;
        pic.ScalePercent(percentage * 100);
    }

    pic.Border = iTextSharp.text.Rectangle.BOX;
    pic.BorderColor = iTextSharp.text.BaseColor.BLACK;
    pic.BorderWidth = 3f;

//BUT this CODE is for adding image to PDF file
    document.Add(pic);
    document.NewPage();

Open in new window

//BUT that CODE is for adding image to PDF file

I'm Extracting the image, if the image is small in the preview, then when extracted it will have the same size.

I hope you understand my grammar, sorry for that.

I'll try to see this link: (also adding image in PDF)
http://fahadzia.com/blog/2010/06/itextsharp-image-resize/

thank you
0
 
systanAuthor Commented:
Should the question is:
How to get the image position from left?
If I can get the image position left, then I can get the image position right and top to bottom.

then it might be
right - left = the image crop width
then
bottom - top = the image crop height

But how to get it? since there is no left or right properties in itextsharp.text.image
0
 
systanAuthor Commented:
hi
is that possible?
0
 
systanAuthor Commented:
I found the links, thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now