Solved

pdf size using itextsharp

Posted on 2012-03-17
5
1,310 Views
Last Modified: 2012-03-21
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
Comment
Question by:systan
  • 4
5 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 37733789
0
 
LVL 14

Author Comment

by:systan
ID: 37734030
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
 
LVL 14

Author Comment

by:systan
ID: 37741420
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
 
LVL 14

Author Comment

by:systan
ID: 37743849
hi
is that possible?
0
 
LVL 14

Author Closing Comment

by:systan
ID: 37750062
I found the links, thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question