Skip to content

Instantly share code, notes, and snippets.

@acardy acardy/add_annotation.cpp
Last active Dec 6, 2018

Embed
What would you like to do?
Searching PDFs
IPopupAnnotationPtr popup = IPopupAnnotation::create(jawsMako, FRect(location.x, location.y, 200, 200));
popup->setContents(description);
page->addAnnotation(popup);
ITextAnnotationPtr textAnnotation = ITextAnnotation::create(jawsMako, location, description.c_str());
textAnnotation->setPopup(popup);
page->addAnnotation(textAnnotation);
// Find the path nodes
CEDLVector<IDOMNodePtr> pathNodes;
page->getContent()->findChildrenOfType(eDOMPathNode, pathNodes, true);
// For through each path node we've found
for (uint32 pathNodeIndex = 0; pathNodeIndex < pathNodes.size(); pathNodeIndex++)
{
IDOMPathNodePtr path = edlobj2IDOMPathNode(pathNodes[pathNodeIndex]);
// It should have an image brush
IDOMBrushPtr brush;
path->getFill(brush);
// See if it's an image brush, if not, we can continue to the next path
const IDOMImageBrushPtr imageBrush = edlobj2IDOMImageBrush(brush);
if (imageBrush == nullptr)
continue;
// Get the image from the brush
IDOMImagePtr image;
imageBrush->getImageSource(image);
// Do things with it...
}

Searching PDFs

This accompanies the blog post.

// Create the output
IPDFOutputPtr pdfOutput = IPDFOutput::create(jawsMako);
// And write the new PDF to disk.
pdfOutput->setEnableIncrementalOutput();
pdfOutput->writeAssembly(assembly, outputPath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.