ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* total pages in external PDF
@ 2015-02-25 17:41 Pablo Rodriguez
  2015-02-25 21:45 ` Hans Hagen
  2015-02-25 22:05 ` Aditya Mahajan
  0 siblings, 2 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2015-02-25 17:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I need to get the number of pages from an external PDF file that I also
define with an \env.

I think I could get something like this.:

    \def\Myfilename{\env{filename}}
    doc = epdf.open(arg[\MyFilename])
    total_pages_ =  doc:getNumPages()
    \def\Mypages{total_pages}

But mixing both lua and ConTeXt commands the wrong way won’t work.

Sorry, but this is all Greek to me. Although I see how it could be done,
I cannot write the code for this.

Which is the right way to get the code above working?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: total pages in external PDF
  2015-02-25 17:41 total pages in external PDF Pablo Rodriguez
@ 2015-02-25 21:45 ` Hans Hagen
  2015-02-26 17:54   ` Pablo Rodriguez
  2015-02-25 22:05 ` Aditya Mahajan
  1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2015-02-25 21:45 UTC (permalink / raw)
  To: ntg-context

On 2/25/2015 6:41 PM, Pablo Rodriguez wrote:
> Dear list,
>
> I need to get the number of pages from an external PDF file that I also
> define with an \env.
>
> I think I could get something like this.:
>
>      \def\Myfilename{\env{filename}}
>      doc = epdf.open(arg[\MyFilename])
>      total_pages_ =  doc:getNumPages()
>      \def\Mypages{total_pages}
>
> But mixing both lua and ConTeXt commands the wrong way won’t work.
>
> Sorry, but this is all Greek to me. Although I see how it could be done,
> I cannot write the code for this.
>
> Which is the right way to get the code above working?

\getfiguredimensions[whatever.pdf] \noffigurepages

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: total pages in external PDF
  2015-02-25 17:41 total pages in external PDF Pablo Rodriguez
  2015-02-25 21:45 ` Hans Hagen
@ 2015-02-25 22:05 ` Aditya Mahajan
  2015-02-26 17:55   ` Pablo Rodriguez
  1 sibling, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2015-02-25 22:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1029 bytes --]

On Wed, 25 Feb 2015, Pablo Rodriguez wrote:

> Dear list,
>
> I need to get the number of pages from an external PDF file that I also
> define with an \env.
>
> I think I could get something like this.:
>
>    \def\Myfilename{\env{filename}}
>    doc = epdf.open(arg[\MyFilename])
>    total_pages_ =  doc:getNumPages()
>    \def\Mypages{total_pages}
>
> But mixing both lua and ConTeXt commands the wrong way won’t work.
>
> Sorry, but this is all Greek to me. Although I see how it could be done,
> I cannot write the code for this.
>
> Which is the right way to get the code above working?

From my old cut-n-paste module (to format two column pdfs into one column 
so that they are easier to read on an eink reader)

\useexternalfigure[cnp:name][\cut!n!paste!parameter\c!name]% Is this really needed?
\getfiguredimensions[cnp:name]%
\edef\cut!n!paste!NOfpages {\noffigurepages}%

Aditya

[1]: 
https://github.com/adityam/cut-n-paste/blob/master/tex/context/third/cut-n-paste/t-cut-n-paste.tex

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: total pages in external PDF
  2015-02-25 21:45 ` Hans Hagen
@ 2015-02-26 17:54   ` Pablo Rodriguez
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2015-02-26 17:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 02/25/2015 10:45 PM, Hans Hagen wrote:
> On 2/25/2015 6:41 PM, Pablo Rodriguez wrote:
>> [...]
>>      \def\Myfilename{\env{filename}}
>>      doc = epdf.open(arg[\MyFilename])
>>      total_pages_ =  doc:getNumPages()
>>      \def\Mypages{total_pages}
>> [...]
>> Which is the right way to get the code above working?
> 
> \getfiguredimensions[whatever.pdf] \noffigurepages

Many thanks for your reply, Hans.

It works like charm.

Now I can generate my booklets fully automatic (for the people :-)).

Many thanks again for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: total pages in external PDF
  2015-02-25 22:05 ` Aditya Mahajan
@ 2015-02-26 17:55   ` Pablo Rodriguez
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2015-02-26 17:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 02/25/2015 11:05 PM, Aditya Mahajan wrote:
> On Wed, 25 Feb 2015, Pablo Rodriguez wrote:
>> I need to get the number of pages from an external PDF file that I also
>> define with an \env.
>> [...]
> 
> From my old cut-n-paste module (to format two column pdfs into one column 
> so that they are easier to read on an eink reader)
> 
> \useexternalfigure[cnp:name][\cut!n!paste!parameter\c!name]% Is this really needed?
> \getfiguredimensions[cnp:name]%
> \edef\cut!n!paste!NOfpages {\noffigurepages}%

Many thanks for your reply, Aditya.


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2015-02-26 17:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 17:41 total pages in external PDF Pablo Rodriguez
2015-02-25 21:45 ` Hans Hagen
2015-02-26 17:54   ` Pablo Rodriguez
2015-02-25 22:05 ` Aditya Mahajan
2015-02-26 17:55   ` Pablo Rodriguez

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).