We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to identify correct Black and white PDF pages

Hi,


I want to determine if the current PDF is colored, B&W or Gray-scale. The following code snippet works fine for color PDF and Gray scale PDFs. When i test it with B&W PDF files it display that current PDF is gray scale.

Document pdfDocument = new Document(file);
// itterate through all the page of PDF file
string filename = Path.GetFileName(file);
for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{

// get the color type information for particular PDF page
Aspose.Pdf.ColorType pageColorType = pdfDocument.Pages[pageCount].ColorType;
switch (pageColorType)
{
case ColorType.BlackAndWhite:
Console.WriteLine(“File " + filename + " Page # - " + pageCount + " is Black and white…”);
break;
case ColorType.Grayscale:
Console.WriteLine(“File " + filename + " Page # - " + pageCount + " is Gray Scale…”);
break;
case ColorType.Rgb:
Console.WriteLine(“File " + filename + " Page # - " + pageCount + " is RGB…”);
break;
case ColorType.Undefined:
Console.WriteLine(“File " + filename + " Page # - " + pageCount + " Color is undefined…”);
break;
}
}

Need your help in this regard. I am also attaching the B&W PDF “200dpi.pdf” .

Hi Ali,


Thanks for using our API’s.

I
have tested the scenario and I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWNET-36647 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.<o:p></o:p>

Dear Support,


Is there any update on the fix?

Hi Ali,

Thanks for your inquiry. I am afraid your reported issue is still not resolved, it is pending for investigation in queue with other priority task. As soon as its investigation is completed then we will be in a good position to share an ETA with you.<o:p></o:p>

We are sorry for the inconvenience caused.<o:p></o:p>

Best Regards,

Hi,

Is there anything new regarding this topic?

Regards,

Christophe

Hi Christophe,


Thanks for your inquiry. I am afraid your issue is still pending for analysis, as product team is busy in investigating/resolving other issues in the queue, reported earlier. We will notify you as soon as me made some significant progress towards issue resolution.

Thanks for your patience and cooperation.

Best regards,

The issues you have found earlier (filed as PDFNET-36647) have been fixed in Aspose.PDF for .NET 21.6.