Hidden fields / annotations aren't hidden

I'm using PDFKit to show a PDF which contains some hidden fields. Unfortunately, PDFKit seems to ignore that property, annotation.shouldDisplay is always YES.

I have to set shouldDisplay by my own depending on the annotation's internal flags:

// see Chapter 8.4.2 Annotation Flags in PDF Reference for PDF 1.7
// https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.7old.pdf
static const NSUInteger PDFAnnotationFlagInvisible = 1;
static const NSUInteger PDFAnnotationFlagHidden = 1 << 1;

// ...
for (PDFAnnotation* annotation in page.annotations) {
    id value = [annotation valueForAnnotationKey:PDFAnnotationKeyFlags];
    if (value != nil) {
        NSInteger annotationFlags = [value integerValue];
        if (annotationFlags & (PDFAnnotationFlagInvisible | PDFAnnotationFlagHidden)) {
            annotation.shouldDisplay = NO;
        }
    }
}

It doesn't feel right that this snippet is needed. So is this a bug / known issue in PDFKit or is my PDF somehow "wrong".

Replies

Feedback FB13296695.