iTextSharp.text.Document document = new iTextSharp.text.Document(new RectangleReadOnly(842,595), 0, 0, 0, 0); iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, new System.IO.FileStream(DestPath, System.IO.FileMode.Create)); // load the tiff image and count the total pages System.Drawing.Bitmap bm = new System.Drawing.Bitmap(Source); int total = bm.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page); document.Open(); iTextSharp.text.pdf.PdfContentByte cb = writer.DirectContent; for (int k = 0; k < total; ++k) { bm.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, k); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(bm, System.Drawing.Imaging.ImageFormat.Bmp); img.ScalePercent(50f / img.DpiX * 100); img.SetAbsolutePosition(0, 0); cb.AddImage(img); document.NewPage(); } document.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)