groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiline Subject as PDF metadata


From: Tadziu Hoffmann
Subject: Re: Multiline Subject as PDF metadata
Date: Tue, 25 Jan 2022 20:18:58 +0100
User-agent: Mutt/1.11.4 (2019-03-13)

> This metadata is held in the "document information dictionary"
> of the pdf. In the pdf 1.4 standard the items
> Title/Author/Keywords/Subject are all defined as text strings,
> so I believe that precludes them from being multiline.

You can embed \n into the strings, but not all programs will
display this as a newline -- pdfinfo does, but my version of
acroread displays a boxed "000A" instead.

  \X'ps: exec mark \
  /Title (\\nMy\\nmultiline\\ndocument\\ntitle\\n) \
  /Synopsis (A short description of the document content.) \
  /CreationDate (Jan 25, 2022) \
  /ModDate (Jan 25, 2022) \
  /DOCINFO pdfmark'
  Hello, world!

I used groff -Tps and ps2pdf to create the PDF file,
and pdfinfo shows:

  Title:
  My
  multiline
  document
  title

  Creator:        groff version 1.22.4
  Producer:       GPL Ghostscript 9.53.3
  CreationDate:   Jan 25, 2022
  ModDate:        Jan 25, 2022
  Tagged:         no
  UserProperties: no
  Suspects:       no
  Form:           none
  JavaScript:     no
  Pages:          1
  Encrypted:      no
  Page size:      595 x 842 pts (A4)
  Page rot:       0
  File size:      4785 bytes
  Optimized:      no
  PDF version:    1.4


> It does seem a little odd that the command "pdfinfo -meta"
> does not include custom keys in its output.

"pdfinfo -meta" prints the "Metadata" stream from the PDF
file's Catalog object.  This is an entirely different object
than the Info dictionary, so it doesn't make sense to jumble
the two together.  (Instead, it would be better if pdfinfo
would simply always print all keys of the Info dictionary.)

  trailer <<
    /Info 2 0 R
    /Root 1 0 R
    ... other entries ...
  >>

  2 0 obj
  <<
    /Producer (GPL Ghostscript 9.53.3)
    /CreationDate (Jan 25, 2022)
    /ModDate (Jan 25, 2022)
    /Creator (groff version 1.22.4)
    /Title (\nMy\nmultiline\ndocument\ntitle\n)
    /Synopsis (A short description of the document content.)
  >>
  endobj

  1 0 obj
  <<
    /Type /Catalog
    /Metadata 3 0 R
    /Pages 5 0 R
  >>
  endobj

  3 0 obj
  <<
    /Type /Metadata
    /Subtype /XML
    /Length 4 0 R
  >>
  stream
  ... XMP encoded metadata ...
  endstream
  endobj

(PDF version 1.2 has no Metadata stream, but PDF 1.4 does.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]