[NTG-context] Clipping multiple PDFs

Jethro Djan jthryeboah at gmail.com
Mon Aug 22 17:46:48 CEST 2022

Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was
easier for me to reason in the lua side of things. This is what I have
at the moment:

  local function doc(fil)
    return fil..[[.pdf]]

  local function disppdf(fname)
    n = 1
        page = n,
        width = "200mm",
        scale = "950"
      n = n + 1
    until n == context(context.noffigurepages)

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7",
  for index=1,#pdffiles do
    local f = doc(pdffiles[index])

I didn’t know how to get an array (or indexed table or whatever you call
it) in ConTeXt/Tex. My problem is now with context(context.noffigurepages).
Am I calling it wrong? All I want to do is call \noffigurepages from the
lua side. Is there something I am missing?


On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context <
ntg-context at ntg.nl> wrote:

On 8/18/22 02:13, jethro Reuel via ntg-context wrote:


I am trying to put multiple PDF’s that were typeset differently into
one document without modifying the individual files themselves.
The problem is the original page numbers show and I’d prefer that it
did not. So I thought maybe I could clip all the page numbers from
every page (since they are all in the same position across all the
pages) but I don’t know how to do this with the \clip command. Any
ideas? I already tried using \input but it gives some weird output in
some places. It doesn’t have to use this method as long as it does
what I need it to do.

Hi Jethro,

it works using \clip with \externalfigure inside a loop (\dorecurse).

With \getfiguredimensions you get the number of pages of each PDF
document (\noffigurepages).

The following source both generates the source PDF document and the
imposed result with clipped pages (just to see a sample of the commands
mentioned above):

 \setupbodyfont[sans, 1200pt]
 {\startmakeup[page][pagestate=start, align=center, style=\bf]
 \savebuffer[newbuff][source_page.tex, prefix=no]
 \executesystemcommand{context --purgeall source_page.tex}
 \setuppaper[nx=2, ny=2]
 \setuparranging [XY]
   {\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]

Just in case it might help,

If your question is of interest to others as well, please add an entry to
the Wiki!

maillist : ntg-context at ntg.nl /
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20220822/9fc8234f/attachment.htm>

More information about the ntg-context mailing list