issue importing metadata from PDF
Hans, I have a PDF document (which I didn’t generate) and it contains the following objects: 1 0 obj << /Title 272 0 R /Producer 273 0 R /Creator 274 0 R /CreationDate 275 0 R /ModDate 275 0 R
endobj
272 0 obj (This is an important title) endobj 273 0 obj (Mac OS X 10.12.1 Quartz PDFContext) endobj 274 0 obj (Keynote) endobj 275 0 obj (D:20161108071428Z00'00') endobj I cannot import these objects, since they are tables instead of strings, after checking that with: \startluacode function document.transfer_metadata(name) local main_doc = lpdf.epdf.load(name) context(type(main_doc.Info.ModDate)) context(type(main_doc.Info.Title)) end \stopluacode Would it be possible that LMTX can deal with these objects and import them as strings? Many thanks for your help, Pablo
On 11/12/2021 6:53 PM, Pablo Rodriguez via ntg-context wrote:
Hans,
I have a PDF document (which I didn’t generate) and it contains the following objects:
1 0 obj << /Title 272 0 R /Producer 273 0 R /Creator 274 0 R /CreationDate 275 0 R /ModDate 275 0 R
endobj
272 0 obj (This is an important title) endobj
273 0 obj (Mac OS X 10.12.1 Quartz PDFContext) endobj
274 0 obj (Keynote) endobj
275 0 obj (D:20161108071428Z00'00') endobj
I cannot import these objects, since they are tables instead of strings, after checking that with:
\startluacode function document.transfer_metadata(name) local main_doc = lpdf.epdf.load(name) context(type(main_doc.Info.ModDate)) context(type(main_doc.Info.Title)) end \stopluacode
Would it be possible that LMTX can deal with these objects and import them as strings?
They are tables because in lua objects are like tables. Doesn't context(tostring(main_doc.Info.ModDate)) work? ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 11/12/21 7:14 PM, Hans Hagen via ntg-context wrote:
They are tables because in lua objects are like tables. Doesn't
context(tostring(main_doc.Info.ModDate))
work?
Many thanks for your reply, Hans. I’m afraid I don’t know how to extract the real information, I only get: table: 0x324279a3400 BTW, how can I use "\enabledirectives[backend.date=2021.02.01]" in Lua? Many thanks for your help, Pablo
On 11/12/2021 7:24 PM, Pablo Rodriguez via ntg-context wrote:
On 11/12/21 7:14 PM, Hans Hagen via ntg-context wrote:
They are tables because in lua objects are like tables. Doesn't
context(tostring(main_doc.Info.ModDate))
work?
Many thanks for your reply, Hans.
I’m afraid I don’t know how to extract the real information, I only get:
table: 0x324279a3400
then you're doing something wrong \startluacode local main = lpdf.epdf.load("ar.pdf") context(tostring(main.Info.ModDate)) context(tostring(main.Info.Title)) local crap1 = tostring(main.Info.ModDate) local crap2 = tostring(main.Info.Title) context(crap1) context(crap2) \stopluacode works quite okay
BTW, how can I use "\enabledirectives[backend.date=2021.02.01]" in Lua?
grep is your friend ... (probably also in the cld manual) directives.enable('backend.date=2021.02.01') which of course doesn't mean that each one will work out as expected because timing matters Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 11/12/21 8:04 PM, Hans Hagen via ntg-context wrote:
On 11/12/2021 7:24 PM, Pablo Rodriguez via ntg-context wrote:
[...] I’m afraid I don’t know how to extract the real information, I only get:>> table: 0x324279a3400
then you're doing something wrong [...] context(tostring(main.Info.ModDate)) context(tostring(main.Info.Title)) [...] works quite okay
I think there is an issue with the PDF document, because it’s an issue only with that PDF file I have. I can read the info from other files pretty well. I’m going to ask the author whether I may share the PDF document here, so you can check it.
BTW, how can I use "\enabledirectives[backend.date=2021.02.01]" in Lua?
grep is your friend ... (probably also in the cld manual)
directives.enable('backend.date=2021.02.01')
which of course doesn't mean that each one will work out as expected because timing matters
Sorry, I found in some document (or I found out it worked): directives.enable(directives.enable("backend.date", "no") But I never thought that an equal sign could be the way. Many thanks for your help, Pablo
participants (2)
-
Hans Hagen
-
Pablo Rodriguez