Using PDFsharp .NET library, I need to set the page size in the PDF document same as that of the images.
Example, image no. 1 measures 152px x 1775px. Image no. 2 measures 100px x 1582px
The resulting PDF should have varying page size inside.
Please help.
With the following code, I am able to set the size of the images, the problem is now setting the page size.
PdfDocument doc = new PdfDocument();
//doc.Pages.Add(new PdfPage());
PdfPage page = doc.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(doc.Pages[0]);
XImage xImage = XImage.FromFile(source);
gfx.DrawImage(xImage, 0, 0, xImage.PixelWidth, xImage.PixelHeight);
doc.Save(destinaton);
doc.Close();
//