Using PDFNET SDK we combine individual PDF documents into one document we call a "package." This package is sent to our clients' users whereby they are using Adobe Acrobat X Pro 10.1.4. On occasion, some of these documents, the user reports some pages (e.g. one of the merged documents) of the package are unreadable (blank, white pages) and result in the following message from Acrobat:
Optimizer.MonoImageSettings mono_image_settings = new Optimizer.MonoImageSettings(); mono_image_settings.SetCompressionMode(Optimizer.MonoImageSettings.CompressionMode.e_flate); mono_image_settings.ForceRecompression(true); mono_image_settings.ForceChanges(true); Optimizer.ImageSettings gray_image_settings = new Optimizer.ImageSettings(); gray_image_settings.SetCompressionMode(Optimizer.ImageSettings.CompressionMode.e_jpeg); gray_image_settings.ForceRecompression(true); gray_image_settings.ForceChanges(true);
Exact code needed depends on whether the image is mono, gray, or color. If it is JPEG2000 scan image, then probably gray, but might be color. I believe Acrobat also suffers the issue of “insufficient data” for JBIG2 images, which is why I included the mono settings above also, as this has helped other previously.
Optimizing has proved successful. What I am trying understand is how does Optimizer determine what is Monochrome, Grayscale, or full-color? For example, you can see the original document has BPC set to 1 and ColorSpace is \DeviceGray yet only the MonoImageSettings actually have any affect on solving the problem? If changing the BPC to 8, would that make a difference?
There is no DeviceMono color space in a PDF, so it is the BPC 1 that separates a mono image from a gray scale image. In both cases the number of channels is 1. If an image has more than 1 channel, then it will be treated as a Color Image.