Solved

pdf size using itextsharp

Posted on 2012-03-17
5
1,277 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
Comment Utility
0
 
LVL 14

Author Comment

by:systan
Comment Utility
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
Comment Utility
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
Comment Utility
hi
is that possible?
0
 
LVL 14

Author Closing Comment

by:systan
Comment Utility
I found the links, thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now