PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

"Insufficient Image Data"
https://forum.pdfsharp.net/viewtopic.php?f=3&t=3479
Page 1 of 1

Author:  darthchai [ Tue Oct 25, 2016 5:43 pm ]
Post subject:  "Insufficient Image Data"

I am using PDFSharp v1.32 with GDI in Visual Studio 2015 C# and below is the code I am using with a list of tif image files:

PdfSharp.Pdf.PdfDocument document = new PdfSharp.Pdf.PdfDocument();

foreach (string tiffile in tiffiles)
{
PdfSharp.Pdf.PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
XImage ximg = XImage.FromFile(tiffile);
gfx.DrawImage(ximg, 0, 0);
}
document.Save(outputPdfName);


I do not get any error's but when opening various PDF files there are random images/pages within that generate the "Insufficient Image Data" error and a blank page is displayed in Adobe Reader DC, or Irfanview, or FoxitReader and various other readers). The tif images the error occurs on are tiff group IV black and white images. It occurs at random, as I have run through a list of 10 tif images and it will occur on only the 5th page in the generated PDF. I ran it against various different sets of images, and the same thing occurs, and it's not reliable with the results.

Any idea what could cause this, or what changes in code I could make to get it working?

I also tried using another tif to PDF toolkit(ImageMagick) and it did not have any issues so I may just go with that one.

Author:  Thomas Hoevel [ Wed Oct 26, 2016 11:34 am ]
Post subject:  Re: "Insufficient Image Data"

Hi!

Switch to PDFsharp 1.50 beta 3b. The issue should not occur.

If it does occur with the latest version, too, then please provide a VS solution with a TIFF file that allows us to replicate the issue.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/