ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Hangman on November 27, 2023, 03:31:15 AM

Title: Adding Targeted Tags to a PDF File
Post by: Hangman on November 27, 2023, 03:31:15 AM
Is there any way to target specific objects in a PDF file to tag them? For example, if I have a simple PDF page made up of a Heading, some body copy and say two photographs, is there any way to add Title, Headline and Description tags to each individual photograph so each has its own unique tags?
Title: Re: Adding Targeted Tags to a PDF File
Post by: Hangman on November 27, 2023, 04:57:49 AM
Is there any way to target specific objects in a PDF file to tag them? For example, if I have a simple PDF page made up of a Heading, some body copy and say two photographs, is there any way to add Title, Headline and Description tags to each individual photograph so each has its own unique tags, i.e., these two images?

Quote from: Hangman on November 27, 2023, 03:31:15 AM| | | | + [XObject directory with 2 entries]
  | | | | | 0)  I0 (SubDirectory) -->
  | | | | | + [I0 directory with 7 entries]
  | | | | | | 0)  Subtype = /Image
  | | | | | | 1)  Width = 1080
  | | | | | | 2)  Height = 1080
  | | | | | | 3)  BitsPerComponent = 8
  | | | | | | 4)  ColorSpace = [/ICCBased,ref(10 0 R)]
  | | | | | | 5)  Filter = /DCTDecode
  | | | | | | 6)  Length = 1639353
  | | | | | 1)  I1 (SubDirectory) -->
  | | | | | + [I1 directory with 7 entries]
  | | | | | | 0)  Subtype = /Image
  | | | | | | 1)  Width = 1080
  | | | | | | 2)  Height = 1080
  | | | | | | 3)  BitsPerComponent = 8
  | | | | | | 4)  ColorSpace = ref(11 0 R)
  | | | | | | 5)  Filter = /DCTDecode
  | | | | | | 6)  Length = 933446
Title: Re: Adding Targeted Tags to a PDF File
Post by: StarGeek on November 27, 2023, 12:06:35 PM
No.  Exiftool cannot target objects within a PDF.  That is because exiftool uses the incremental update feature of PDFs (see this Foxit Knowledgebase page (https://www.debenu.com/kb/incremental-updates/)).  This is why any exiftool edits are reversible and the file must be re-linearized to remove previous data and make the edits permanent.

I could be wrong but I think QPDF can extract individual objects and re-insert them into a PDF. I would have no idea how to do this though.
Title: Re: Adding Targeted Tags to a PDF File
Post by: Phil Harvey on December 03, 2023, 07:04:22 AM
Quote from: StarGeek on November 27, 2023, 12:06:35 PMNo.  Exiftool cannot target objects within a PDF.  That is because exiftool uses the incremental update feature of PDFs (see this Foxit Knowledgebase page (https://www.debenu.com/kb/incremental-updates/)).

Just a technical note:  It is theoretically possible to target individual objects using an incremental update, but the pain-to-gain ratio is too high for me to add this ability.

- Phil