Hi, thanks for this great tool. However, I'm having a problem when resizing/scaling an image to fit the page. This is the image I'm trying to put in the pdf:
http://imgur.com/XNUEXJpAnd when I put it in the pdf (with the width set to match the width of the pdf and the height proportionally set) this is what I get
Dropbox link to pdf:
https://www.dropbox.com/s/eh2wk9stc71vyzc/67405_IO000001_Caries_Normal_SCALED.pdfImage of pdf:
http://imgur.com/NbJ2SSUAs you can see I get significat loss of resolution, and the gray scale isn't nearly as clear.
In addition to showing an image of the pdf I have also attached it. For some reason the generated pdf (395 KB) is even smaller than the image drawn onto it (1.98 MB)!
Here is the code I used to do the image scaling and drawing:
Code:
static void Main(string[] args)
{
// Create a new PDF document
PdfDocument document = new PdfDocument();
document.Info.Title = "Created with PDFsharp";
// Create an empty page
PdfPage page = document.AddPage();
// Get an XGraphics object for drawing
XGraphics gfx = XGraphics.FromPdfPage(page);
// Draw image
const string imagePath = "imagepath";
XImage xImage = XImage.FromFile(imagePath);
double height = page.Width / xImage.PixelWidth * xImage.PixelHeight;
gfx.DrawImage(xImage, 0, 0, page.Width, height);
// Save the document...
const string filename = "filename";
document.Save(filename);
// ...and start a viewer.
Process.Start(filename);
}
When I don't scale the image it is to large to fit the page. How can I scale the image without losing resolution? For example, here is what the image looks like when I convert it to pdf with a tool on my computer (and what I'm trying to do with pdf sharp):
Dropbox link to pdf:
https://www.dropbox.com/s/36xfpjizx9vyecd/67405_IO000001_Caries_Normal.pdfImage of pdf:
http://imgur.com/NJY4UleThank you for your time.