PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

smaller image
http://forum.pdfsharp.de/viewtopic.php?f=2&t=1349
Page 1 of 1

Author:  marcocim [ Sun Sep 26, 2010 10:51 pm ]
Post subject:  smaller image

Hi all,

i have a funny behavior drawing two images to a pdf.
i use Ximage.FromFile method to load both the images but after drawing the images my Pdf shows the first image smaller than
the original ?

First image dimensions are width=300,height=500
Second image dimensions are width=500,height=334
i use .PNG image format.

Thanks

P.S.: see attached files

Attachments:
File comment: captured from the pdf created using pdfsharp library
my_pdf.jpg
my_pdf.jpg [ 47.7 KiB | Viewed 6088 times ]

Author:  marcocim [ Mon Sep 27, 2010 7:50 am ]
Post subject:  Re: smaller image

i have the same effect using Z3.jpg image (from PdfSharp samples).
It shows smaller than the original (seen in Photoshop).

Thanks

Author:  Thomas Hoevel [ Mon Sep 27, 2010 8:03 am ]
Post subject:  Re: smaller image

marcocim wrote:
First image dimensions are width=300,height=500
Second image dimensions are width=500,height=334

Dimensions don't matter.

If you don't specify an image size while drawing, images will be drawn with their actual size (as specified in the image file).
And width=500 pixel can be 1 cm or 5 inches or anything else.

Open the images in Microsoft Word and scale them to 100 % - you might get the same sizes ...

Author:  marcocim [ Mon Sep 27, 2010 9:02 am ]
Post subject:  Re: smaller image

Thank you Thomas,

there is a method inside PdfSharp to scale the image proportionally ?

I need to fit images inside the box but maintaining proportions.

Author:  Thomas Hoevel [ Mon Sep 27, 2010 9:12 am ]
Post subject:  Re: smaller image

marcocim wrote:
there is a method inside PdfSharp to scale the image proportionally?

I'm afraid there's not.

But it only takes a few lines of code to do it.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/