Rendering form fields
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()));
}
}
}
As we only want to render form fields, you call this method with eATWidget as the filter:
// Flatten form fields
flattenAnnotation(page, IAnnotation::eATWidget);
This method should be applied to the IPage
, before rendering.