Hello, Thank you for helping me with this problem.
I'm trying to convert multipage tiffs to a multipage pdf. It works sometimes but some of the pages are blank when converting a file with many pages. It seems to miss more pages the larger the files. The conversion doesn't always miss the same pages and I can convert one of the blank pages when it is by itself.
Below is the code I am using. The converter is a dataservice within a silverlight app. All is well, except for the blank pages.
Stream imageStream = new FileStream(newTiffTempPath, FileMode.Open, FileAccess.Read,
FileShare.Read);
var decodeTiff = new TiffBitmapDecoder(imageStream, BitmapCreateOptions.PreservePixelFormat,
BitmapCacheOption.Default);
var doc = new PdfDocument();
// convert each page of the Tiff file to a pdf frame)
for (int x = 0; x < decodeTiff.Frames.Count; ++x)
{
PdfPage pg = new PdfPage();
pg.Size = PdfSharp.PageSize.Letter;
pg.width = (int)decodeTiff.Frames[x].Width;
pg height = (int)decodeTiff.Frames[x].Height;
XGraphics xgr = XGraphics.FromPdfPage(doc.Pages.Add(pg));
XImage img = XImage.FromBitmapSource(decodeTiff.Frames[x]);
xgr.DrawImage(img, 0, 0,);
}
doc.Save(destinationPath);
doc.Close();
Thanks again
Veronica.