BA_
BA_

Reputation: 55

Use Ghostscript to set PDF natural language via pdfmarks

I'm setting metadata on PDFs using Ghostscript and pdfmarks. I'm able to set just about everything I need IE: Title, Author, Bookmarks, etc using pdfmarks. However, I can not set the Natural Language. I'm sure I'm just missing the correct syntax, as I've looked over Adobe documentation and see it listed in there.

This is what I have tried:

[ /Type /Catalog /Lang (en-US) /StPNE pdfmark
[ /Subtype /document /Lang (en-US) /StPNE pdfmark

Neither of these works, unfortunately. Does anyone know the correct syntax to add a language?

Upvotes: 0

Views: 285

Answers (1)

KenS
KenS

Reputation: 31141

That's a logical structure pdfmark StPNE, but the last pdfmark reference I can find (version 9 from 2008) does not list /Lang as a legal attribute for a logical structure pdfmark.

I note that the PDF specification does permit /Lang to be a member of a logical structure element, but that doesn't mean there's a pdfmark for it. I think Adobe stopped updating the pdfmark reference with new content for new versions of the PDF specification.

/Type /Catalog won't be legal either.

Can you explain which part of the resulting PDF you are trying to add this to ? Ghostscript only implements the pdfmarks listed in the pdfmark refrence, and I don't think it fully implements all of those currently.

[EDIT]

I just checked and Ghostscript's pdfwrite device does not implement the StPNE pdfmark at all, so that's not going to do anything.

[further edit]

It may be (looking at the PDF specification) that what you want is to set a key called /Lang in the Catalog object of the PDF file. Obviously I'm not certain but....

[{Catalog} <</Lang (en-US)>> /PUT pdfmark

puts a key called /Lang in the Catalog dictionary, and assigns it the string value (en-US). That may be sufficient, I can't tell.

Upvotes: 1

Related Questions