Created Date: 03 Oct, 2022 15:02
Last Modifed Date: 03 Oct, 2022 15:02


Form fields, such as text boxes, buttons etc. are not normally included when rendering a page. This is because they don't form part of the page content per se - they are annotations, similar to comments and other markup. To include them on the page, their appearance streams must be added to the page content. You can do this with some simple code:

flattenAnnotation

void flattenAnnotation(const IPagePtr& page, const IAnnotation::eAnnotationType& annotationType)
{
    CAnnotationVect annotations = page->getAnnotations();
    for (const auto& annotation : annotations)
    {
        if (annotation->getType() == annotationType)
        {
            const IAnnotationAppearancePtr appearance = annotation->getAppearance(eAUNormal);
            page->edit()->appendChild(appearance->getScaledAppearance(annotation->getRect()));
        }
    }
}
CPP

As we only want to render form fields, you call this method with eATWidget as the filter:

// Flatten form fields
flattenAnnotation(page, IAnnotation::eATWidget);
CPP

This method should be applied to the IPage, before rendering.