Skip to content

Problems removing annotations (missing required entry "Obj") #796

@rdlarah

Description

@rdlarah

Hi Horst,

thank you for creating this great tool.

Unfortunately I can't use it to remove all annotations in the pdf file (or on a particular page) at once.

Let's assume I want to remove all of five annotations on page 414 of my test.pdf:

harald:~/test$ pdfcpu annot remove -pages 414 test.pdf 
writing test.pdf...
optimizing...
pages: 414
removing all annotations for selected pages!
pdfcpu: validateObjectReferenceDict: missing required entry "Obj"

The five annotations, however, are beautifully listed:

harald:~/test$ pdfcpu annot list -pages 414 test.pdf 
optimizing...
pages: 414
4 annotations available

Page 414:

  Popup:
     obj#                 rect id  content
    ======================================
     1974 (349, 244, 529, 364)    -> #1968

  Text:
     obj#                 rect                     id content
    =========================================================
     1963 ( 92, 151, 102, 166) ujABwuq5sSWDqo07nwvCoB 
     1966 (167, 222, 256, 237) WmaKX6_0mBTNBWUR-L-A-B 
     1968 (112, 349, 145, 364) 0Lbf4N1s7BrBN5inxKM2RC 

and I can remove them by manually giving the obj#'s:

harald:~/test$ pdfcpu annot remove test.pdf 1974 1963 1966 1968
writing test.pdf...
optimizing...

No error, and they are gone:

harald:~/test$ pdfcpu annot list -pages 414 test.pdf 
optimizing...
pages: 414
0 annotations available

I'm using the latest version:

harald:~/test$ pdfcpu version
pdfcpu: v0.6.0 dev
commit: dae09ebf (2024-01-30T10:04:31Z)
base  : go1.21.6
config: /home/harald/.config/pdfcpu/config.yml

on debian sid:

harald:~/test$  uname -a
Linux <hostname> 6.6.11-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.6.11-1 (2024-01-14) x86_64 GNU/Linux

It seems like pdfcpu finds all obj#'s but does not pass them correctly to the routine that deletes them.

Thanks in advance for looking into it.

Cheers
harald

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions