Summary: How can I reduce the amount of time it takes to convert tifs to pdfs using itextsharp
?
Background: I\'m convertin
The trouble is with the length of time it takes for iTextSharp to finishing messing around with your System.Drawing.Image object.
To speed this up to literally a 10th of a second in some tests I have run you need to save the selected frame out to a memory stream and then pass the byte array of data directly to the GetInstance method in iTextSharp, see below...
bm.SelectActiveFrame(FrameDimension.Page, k);
iTextSharp.text.Image img;
using(System.IO.MemoryStream mem = new System.IO.MemoryStream())
{
// This jumps all the inbuilt processing iTextSharp will perform
// This will create a larger pdf though
bm.Save(mem, System.Drawing.Imaging.ImageFormat.Png);
img = iTextSharp.text.Image.GetInstance(mem.ToArray());
}
img.ScalePercent(72f / 200f * 100);