0

I am trying to extract entities from the pdf and mark it back to pdf using pdf annotation. Is there any way I can annotate specific text using ghostscript?

Thanks

Mahek Shah
  • 485
  • 2
  • 5
  • 17

1 Answers1

1

You're going to have to be more specific. What do you mean by 'annotate specific text' ? Are you talking about;

  • Altering a FreeText annotation ?
  • Finding text in a content stream and altering it ?
  • Adding an annotation at a specific point on the page ?
  • Something else ?

Ghostscript is not intended as a general purpose PDF editing tool, and so it's quite limited in what you can do with it. You might be better advised to use something like MuPDF, but so much depends on exactly what you are trying to do, it's not really possible to make any specific recommendations.

halfer
  • 19,824
  • 17
  • 99
  • 186
KenS
  • 30,202
  • 3
  • 34
  • 51
  • What I want is to add comment in the page... Lets say if address is mentioned in the pdf, I want to comment on that page with the address. MuPDF does the work but I dont want to depend on MUPDF. So finding way to solve this using ghostscript or postscript. – Mahek Shah May 07 '20 at 09:43
  • Why are you more comfortable using Ghostscript than MuPDF ? They both belong to Artifex after all. You cannot do this in one pass with Ghostscript. You could use the txtwrite device to extract the text, find the specific text you are interested in and, provided you used format 0 or 1, you would have the location of that text. You could then construct a pdfmark which places an annotation on the page at that location, and run the PDF file again. BUt as I said, its not what Ghostscript is intended for, I feel you'd be better to use MuPDF. – KenS May 07 '20 at 13:10