Why iText7 occur error "Unexpected ColorSpace: /CS0."?

I using iText7 Ver7.1.15

This code to get text of page:

PdfReader reader = new PdfReader(inputFile);
PdfDocument pdfDoc = new PdfDocument(reader, writer);
for (int page_no = 1; page_no <= 1; page_no++)
{
        PdfPage page = pdfDoc.GetPage(page_no);                           

        MyLocationTextExtractionStrategy strategy = new MyLocationTextExtractionStrategy();
        string currentText = PdfTextExtractor.GetTextFromPage(page, strategy); 
}

           

But it occur error:

Unexpected ColorSpace: /CS0. 

I try add source of iText7 and check, target source is the same with answer at: What to do with iText "Unexpected color space /CS0" type of exceptions

enter image description here

Why iText7 still occur error "Unexpected ColorSpace: /CS0."?

I debug and get value:

PdfName.Indexed="Indexed"
colorSpace.GetAsName(0) ="ICCBased" 

How can fix this case?



Read more here: https://stackoverflow.com/questions/67378271/why-itext7-occur-error-unexpected-colorspace-cs0

Content Attribution

This content was originally published by D T at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: