EdL
EdL

Reputation: 435

Acrobat nor any other pdf viewer won't print connected line annotations

Similar to this problem, however the solution does not work. Adobe Acrobat Reader doesn't print my drawing on a PDF

I use a Boox Max Carta to write and annotate pdf works. The annotations are exported from the e-reader as pdf annotations (comments) of the category connected lines.

Here is an example file.

When I go to print, if I select Document and markup - I get nothing.

If I select summarise comments then I get numbers for each annotation but no scribble.

Pdf Print annotation failure

What do I need to do to print annotated pdfs?

Is there a way to flatten it into an image or something?

Solution - Thanks to @mkl for finding the root cause

Use the Python PyMuPdf library to loop through the pages and annotations adding a flag to each of them.

""" Recipies used
https://pymupdf.readthedocs.io/en/latest/faq/#how-to-search-for-and-mark-text
https://pymupdf.readthedocs.io/en/latest/faq/#how-to-add-and-modify-annotations
"""

import sys
import fitz
fname = sys.argv[1]                    # filename
doc = fitz.open(fname)
updated_annot_count = 0;
for page in doc:       
    current_annot = page.firstAnnot;                # scan through the pages
    while current_annot:
        current_annot.setFlags(current_annot.flags|fitz.ANNOT_XF_Print)
        current_annot = current_annot.next          # Follow linked list
        updated_annot_count = updated_annot_count+1


if doc:
    doc.save("printable-" + doc.name)

The Pdf renders fine on the computer screen in both Chrome and Adobe Acrobat (2017)

Upvotes: 1

Views: 389

Answers (1)

mkl
mkl

Reputation: 96009

All of the line drawing annotations (actually there are annotations of type Line, Square, Polygon, and PolyLine) have no Flags entry; thus, their annotation flags value defaults to 0, all flags cleared.

F integer (Optional; PDF 1.1) A set of flags specifying various characteristics of the annotation (see 12.5.3, “Annotation Flags”). Default value: 0.

(ISO 32000-1, Table 164 – Entries common to all annotation dictionaries)

In particular the Print flag is cleared.

3 Print (PDF 1.2) If set, print the annotation when the page is printed. If clear, never print the annotation, regardless of whether it is displayed on the screen.

(ISO 32000-1, Table 165 – Annotation flags)

So your annotations explicitly are created to not be printed ever.

If you want to print them nonetheless, set the Print flag of your annotations.

This should be a simple task to implement using any general purpose PDF library.

Upvotes: 3

Related Questions