Hi, I use your component for building PDP from a set of images and other pdf files.
Unfortunately arose a problem with files Tiff.
Your component perfectly working with multi-page monochrome tiffs.
However, when trying to use a color multipage Tiff, to the PDF is added 1 gray blank page instead of multi-page block.
Question: Is there a solution for color, multi-page TIFF?
Here is the code I'm using.
Code:
using (Image MyImage = Image.FromFile(pdfPart.Value))
{
for (int PageIndex = 0; PageIndex < MyImage.GetFrameCount(FrameDimension.Page); PageIndex++)
{
MyImage.SelectActiveFrame(FrameDimension.Page, PageIndex);
var stream = new System.IO.MemoryStream();
MyImage.Save(stream, ImageFormat.Tiff);
stream.Position = 0;
XImage img = XImage.FromStream(stream);
var page = new PdfPage();
if (img.PixelWidth > img.PixelHeight)
page.Orientation = PdfSharp.PageOrientation.Landscape;
else
page.Orientation = PdfSharp.PageOrientation.Portrait;
outputDocument.AddPage(page);
using (XGraphics xgr = XGraphics.FromPdfPage(outputDocument.Pages[targetPageIndx]))
{
xgr.DrawImage(img, 0, 0);
}
targetPageIndx++;
}
}