Solved

pdf size using itextsharp

Posted on 2012-03-17
5
1,364 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

728 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