Am 05.05.2021 um 18:39 schrieb jorgeeflorez:
Hi, I would like to know what would be the best way to detect whether ia pdf file has CID fonts. As far as I understand, these fonts are used in asian texts (japanese, chinese, korean, etc). I have the following code:PDDocument doc = PDDocument.load(myFile); for (int i = 0; i < doc.getNumberOfPages(); ++i) { PDPage page = doc.getPage(i); PDResources res = page.getResources(); for (COSName fontName : res.getFontNames()) { PDFont font = res.getFont(fontName); COSName subType = font.getCOSObject().getCOSName(COSName.SUBTYPE); System.out.println("CID? " + COSName.TYPE0.equals(subType)); System.out.println("font instanceof PDType0Font? " + (font instanceof PDType0Font)); } } Would this be the right way to do it?
It's more complicated because form XObjects, patterns, annotations, softmasks (and maybe more) can also have fonts. I also doubt that you can detect CK fonts this way.
Re removing the text, see the RemoveAllTexts example in the source code download. IIRC this one only does the page content stream.
Tilman
I need to detect this and try to create a pdf file from the original, but without the text. Any indication is appreciated. Regards, Jorge
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

