ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* issue importing metadata from PDF
@ 2021-11-12 17:53 Pablo Rodriguez via ntg-context
  2021-11-12 18:14 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2021-11-12 17:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Pablo Rodriguez

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: issue importing metadata from PDF
  2021-11-12 17:53 issue importing metadata from PDF Pablo Rodriguez via ntg-context
@ 2021-11-12 18:14 ` Hans Hagen via ntg-context
  2021-11-12 18:24   ` Pablo Rodriguez via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2021-11-12 18:14 UTC (permalink / raw)
  To: Pablo Rodriguez via ntg-context; +Cc: Hans Hagen

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: issue importing metadata from PDF
  2021-11-12 18:14 ` Hans Hagen via ntg-context
@ 2021-11-12 18:24   ` Pablo Rodriguez via ntg-context
  2021-11-12 19:04     ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2021-11-12 18:24 UTC (permalink / raw)
  To: Hans Hagen via ntg-context; +Cc: Pablo Rodriguez

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: issue importing metadata from PDF
  2021-11-12 18:24   ` Pablo Rodriguez via ntg-context
@ 2021-11-12 19:04     ` Hans Hagen via ntg-context
  2021-11-12 19:31       ` Pablo Rodriguez via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2021-11-12 19:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen, Pablo Rodriguez

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: issue importing metadata from PDF
  2021-11-12 19:04     ` Hans Hagen via ntg-context
@ 2021-11-12 19:31       ` Pablo Rodriguez via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2021-11-12 19:31 UTC (permalink / raw)
  To: Hans Hagen via ntg-context; +Cc: Pablo Rodriguez

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-12 19:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 17:53 issue importing metadata from PDF Pablo Rodriguez via ntg-context
2021-11-12 18:14 ` Hans Hagen via ntg-context
2021-11-12 18:24   ` Pablo Rodriguez via ntg-context
2021-11-12 19:04     ` Hans Hagen via ntg-context
2021-11-12 19:31       ` Pablo Rodriguez via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).