Iām using WebSite in ASP.NET and PdfSharp PDF library. I have a tiff document image that contains 3 pages, I would want to convert all those 3 tiff pages into 1 PDF file with 3 pages.
Please tell me what should I do?
PdfDocument doc = new PdfDocument();
System.Drawing.Image img2 = System.Drawing.Image.FromFile(@"C:\File\0.tiff");
Guid objGuid = img2.FrameDimensionsList[0];
FrameDimension objDimension = new FrameDimension(objGuid);
int pageCount = (img2.GetFrameCount(objDimension));
pageCount--;
for (int i = 0; i <= pageCount; i++)
{
PdfPage page = doc.AddPage();
XGraphics xgr = XGraphics.FromPdfPage(page);
img2.SelectActiveFrame(objDimension, i);
XImage img = XImage.FromGdiPlusImage(img2);
page.Width = img.PointWidth;
page.Height = img.PointHeight;
xgr.DrawImage(img, 0, 0);
}
img2.Dispose();
doc.Save(@"C:\File\0.pdf");
doc.Close();