i am using this code to images to pdf
Code:
static void Main(string[] args)
{
DirectoryInfo di = new DirectoryInfo(@"C:\Users\masoodr\Desktop\Pages");
FileInfo[] files = di.GetFiles();
string filename = String.Format("{0}_tempfile.pdf", Guid.NewGuid().ToString("D").ToUpper());
PdfDocument s_document = new PdfDocument();
//PdfPage p = s_document.AddPage();
for (int i = 0; i < files.Count(); i++)
{
DrawPage(s_document.AddPage(), files[i].FullName);
}
// Save the s_document...
s_document.Save(filename);
// ...and start a viewer
Process.Start(filename);
}
public static void DrawPage(PdfPage page,string fileName)
{
XGraphics gfx = XGraphics.FromPdfPage(page);
XImage image = XImage.FromFile(fileName);
gfx.DrawImage(image, 0, 0);
}
but for some reason the images are so enlarged they dont fit in. image should fit in as an A4 size rectangle. so what can i do ?