This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/knowledge-base/how-do-i-prevent-printing-annotations.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Prevent printing PDF annotations | Nutrient

For some use cases, you might want to print your document without annotations. This where the noPrint flag comes in handy. The following code shows how to apply it to all annotations in a document:

(async () => {
const pagesAnnotations = await Promise.all(
Array.from({
length: instance.totalPageCount
}).map((_, pageIndex) => instance.getAnnotations(pageIndex))
);
await Promise.all(
pagesAnnotations.flatMap((pageAnnotations) =>
pageAnnotations.map(
(annotation) => instance.update(annotation.set("noPrint", true)) // Do not print the annotation.
)
)
);
})();