TransWikia.com

Set language metadata for Adobe

TeX - LaTeX Asked on July 23, 2021

I am handing in my phd thesis created with LaTex, and the library demands that the metadata of the created pdf contains the title, author and language, specifically mentioning that when opened in Adobe the language has to be correct ( under advanced reading options). The library proposes to add the following code to the texfile:

usepackage{hyperref}
hypersetup {
pdfpagemode = {UseNone},
pdftitle = {Titel},
pdfauthor = {Vorname Nachname},
pdflang = {de-DE}
}

If I add this to my document, the title and author are correctly inserted, but the language field is still blank in Adobe.

At first I thought some packages are incompatible, so I created the following minimal (not) working example:

documentclass{book}
usepackage[utf8]{inputenc}
title{metatest}

usepackage{hyperref}
hypersetup{
pdftitle = {Some title},
pdfauthor = {Name Name},
pdflang = {en-US},
} 

begin{document}

section{Introduction}

end{document}

When compiled, this gives a pdf with metadata author and title set, but the language field remains empty. So, how can one generate a language metadata which is recognized in Adobe?

2 Answers

The lang setting is there. But unlike author and title it is not written in the the info dictionary but in the PDF catalog. If you create an uncompressed pdf and then look into the file you can see it.

RequirePackage{expl3}
ExplSyntaxOn
pdf_uncompress:
ExplSyntaxOff
documentclass{book}
title{metatest}

usepackage{hyperref}
hypersetup{
 pdftitle = {Some title},
 pdfauthor = {Name Name},
 pdflang = {en-US},
}

begin{document}

section{Introduction}

end{document}

gives

30 0 obj
<<
/Type /Catalog
/Pages 14 0 R
/Outlines 27 0 R
/Names 29 0 R
/PageMode/UseOutlines/Lang(en-US)%<---- /Lang is there
/OpenAction 5 0 R
>>
endobj

With adobe reader the language is not visible. But with acrobat I can see it in the extended options:

enter image description here

Correct answer by Ulrike Fischer on July 23, 2021

enter image description here

Use the following settings. It works with both pdflaltex and lualatex.

% !TeX TS-program = pdflatex

documentclass{book}
usepackage[utf8]{inputenc}
title{metatest}

usepackage{hyperref}

hypersetup{%
    pdfinfo={%
        Author={Simon Dispa},
        Title={Metadata of PDF document using PDFLaTeX},
        CreationDate={D:20210607195600},
        ModDate={...},
        Keywords={PDF,LaTeX},
        Subject={Add custom properties},
        version=0.9.b,  % custom property <<<<<<<<<<
        language=en-US  % custom property  <<<<<<<
    }
}

begin{document}
    
    section{Introduction}
    
end{document}

zzz

w

NOTE I do not think that right now you want to deepen your knowledge on the subject of XMP to include metadata within a document.

Other readers may be interested in the hyperxmp package and its excellent manual in https://ctan.org/pkg/hyperxmp?lang=en

Answered by Simon Dispa on July 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP