From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/115769 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jethro Djan via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Clipping multiple PDFs Date: Mon, 22 Aug 2022 15:43:33 +0000 Message-ID: <322352C8-805C-4B30-97A7-80F560A32251@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (1.0) Content-Type: multipart/mixed; boundary="===============6673727053641529002==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13348"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jethro Djan To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Aug 22 19:25:16 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQBAq-0003FX-1y for gctc-ntg-context-518@m.gmane-mx.org; Mon, 22 Aug 2022 19:25:16 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 926272A4034; Mon, 22 Aug 2022 19:19:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T6tFzXq2QnL5; Mon, 22 Aug 2022 19:19:48 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E028E259; Mon, 22 Aug 2022 19:19:36 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id AC1182A402B for ; Mon, 22 Aug 2022 19:19:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QUQz30JEFtqC for ; Mon, 22 Aug 2022 19:19:34 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.43; helo=mail-wm1-f43.google.com; envelope-from=jthryeboah@gmail.com; receiver= Original-Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 2FF5B2A3FF3 for ; Mon, 22 Aug 2022 19:19:34 +0200 (CEST) Original-Received: by mail-wm1-f43.google.com with SMTP id h204-20020a1c21d5000000b003a5b467c3abso8159527wmh.5 for ; Mon, 22 Aug 2022 10:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:date:message-id:subject:mime-version:from :content-transfer-encoding:from:to:cc; bh=7FVeJ4P2vHv7pUdgDp5LGKiE+nPMA4cWWRNT5ZEdIQs=; b=TETpmCY/Nuj6POVnL6PPg6n/VktYUh90MQxu7CQDFBH1fXOYZPkAEBTlHvDtSRwWUe Wx9arORMZzR4liWzLHTCWQ2PBkvSps6uUNo+SAlqEk4h6v34TTGS0QK+KAWi4mIKr2HN RV2OFzg+oZn94Xv9RiCQDDD4jIhAypf5Vn2RzwQzsYa7z5h4YLNZyeaGx5raJEwQ/sVU 6VPY/XyLPuXb2SnEeeNo1nn5maorVP+pAHnTXgiu20C2XPbzOsPZko+ZLbkEi9KcrVnJ o8ziCa+jZoBZB0pUITRx6pb2Txoao7TFTdQdN+2xk7TvFmVrBUJldU5hnyrhnYfwbvoB 02PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:date:message-id:subject:mime-version:from :content-transfer-encoding:x-gm-message-state:from:to:cc; bh=7FVeJ4P2vHv7pUdgDp5LGKiE+nPMA4cWWRNT5ZEdIQs=; b=2o4ahPX4j4wUbpnDuTJMy/yxLr0fM8UnH/iJ8ibwfCjx2p5Qy6Ryf8ePElMTXYcfm3 yn8QJnIyTd/SRRqnD8JQuIYyJETQoX8sFqxW6ZI7F4BJKpuIijrXL+3YhAiZKyV8DLrX +CkeoHjfEwCrtbXdNGy3Tit6tvUjhKSVakFVcFPi0HoulMweQypGYRmiVyJqE9r9TQiI 5CvrEja7HPgM6E39FD47Cir+GOy9vA+Gk2iMR/1clrdCmN11fC307MKKlTrD2ZjMlucW 0V1BFKJJ7gm5on5zouDfz+FquL+CVdhdo3s3j31CYxdtvf01JhhT5S+3eKW+BrZsJr3d oIEg== X-Gm-Message-State: ACgBeo0O327eWXC3jX2hlHGF4l9Tlk7KqZPvGuewvDHSp6yO8OqSDUZ/ qD8Tje8dazfNGc1Eq9ohvd8t8Kijcyg= X-Google-Smtp-Source: AA6agR75KE2WAXzJWDNYF/MxVaNlpm2wnbqUJKrDdkv5fApFjCNf4r+j6cjw3GZO3bN40GAphw+5FQ== X-Received: by 2002:a05:600c:190f:b0:3a5:f6dc:f542 with SMTP id j15-20020a05600c190f00b003a5f6dcf542mr12847687wmq.130.1661188773414; Mon, 22 Aug 2022 10:19:33 -0700 (PDT) Original-Received: from smtpclient.apple ([102.176.94.135]) by smtp.gmail.com with ESMTPSA id m27-20020a056000181b00b0022549ac786asm6754987wrh.47.2022.08.22.10.19.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Aug 2022 10:19:32 -0700 (PDT) X-Mailer: iPhone Mail (19G71) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:115769 Archived-At: --===============6673727053641529002== Content-Type: multipart/alternative; boundary=Apple-Mail-3C02B8DE-AD6A-4FED-AC24-759D0EEDFCA2 Content-Transfer-Encoding: 7bit --Apple-Mail-3C02B8DE-AD6A-4FED-AC24-759D0EEDFCA2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =EF=BB=BF Thanks for the solution Pablo. It works well. I wanted to add more pdfs (which also has many pages) and found it was easie= r for me to reason in the lua side of things. This is what I have at the mom= ent: \starttext \startluacode local function doc(fil) return fil..[[.pdf]] end local function disppdf(fname) n =3D 1=20 repeat=20 context.externalfigure({fname},{ page =3D n, width =3D "200mm", scale =3D "950" }) n =3D n + 1 until n =3D=3D context(context.noffigurepages) end local pdffiles =3D {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7"= , "ass8"} for index=3D1,#pdffiles do=20 local f =3D doc(pdffiles[index]) context.getfiguredimensions({f}) disppdf(pdffiles[index]) end \stopluacode \stoptext I didn=E2=80=99t know how to get an array (or indexed table or whatever you c= all it) in ConTeXt/Tex. My problem is now with context(context.noffigurepage= s). It doesn=E2=80=99t produce an integer so n is being compared to nil. Am I= calling it wrong? All I want to do is call \noffigurepages from the lua sid= e. Is there something I am missing? Jethro > On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context wrote: >=20 > On 8/18/22 02:13, jethro Reuel via ntg-context wrote: >> Hello, >>=20 >> I am trying to put multiple PDF=E2=80=99s that were typeset differently i= nto >> one document without modifying the individual files themselves. >> [...] >> The problem is the original page numbers show and I=E2=80=99d 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=E2=80=99t know how to do this with the \clip command. An= y >> ideas? I already tried using \input but it gives some weird output in >> some places. It doesn=E2=80=99t have to use this method as long as it doe= s >> what I need it to do. >=20 > Hi Jethro, >=20 > it works using \clip with \externalfigure inside a loop (\dorecurse). >=20 > With \getfiguredimensions you get the number of pages of each PDF > document (\noffigurepages). >=20 > 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): >=20 > \startbuffer[newbuff] > \setuppapersize[A3] > \setupbodyfont[sans, 1200pt] > \starttext > \dorecurse{8} > {\startmakeup[page][pagestate=3Dstart, align=3Dcenter, style=3D\bf] > \recurselevel > \stopmakeup} > \stoptext > \stopbuffer > \startmode[*first] > \savebuffer[newbuff][source_page.tex, prefix=3Dno] > \executesystemcommand{context --purgeall source_page.tex} > \stopmode > \setuplayout[page] > \setuppapersize[A6][A4] > \setuppaper[nx=3D2, ny=3D2] > \setuparranging [XY] > \starttext > \startnotmode[*first] > \def\Doc{source_page.pdf} > \getfiguredimensions[\Doc] > \dorecurse{\noffigurepages} > {\clip[hoffset=3D96mm, voffset=3D136mm, width=3D105mm, height=3D148mm] > {\externalfigure[\Doc][page=3D\recurselevel]}} > \stopnotmode > \stoptext >=20 > Just in case it might help, >=20 > Pablo > __________________________________________________________________________= _________ > If your question is of interest to others as well, please add an entry to t= he Wiki! >=20 > maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-co= ntext > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > __________________________________________________________________________= _________ --Apple-Mail-3C02B8DE-AD6A-4FED-AC24-759D0EEDFCA2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
=EF=BB=BF
Thanks for the solution Pablo. It work= s well.

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

= \starttext
\startluacode
  local function d= oc(fil)
    return fil..[[.pdf]]
 = ; end

  local function disppdf(fname)
    n =3D 1 
    repeat&nbs= p;
      context.externalfigure({fname},{
        page =3D n,
   =     width =3D "200mm",
        s= cale =3D "950"
      })
  &n= bsp;   n =3D n + 1
    until n =3D=3D context(c= ontext.noffigurepages)
  end

  local pdffiles =3D {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "= ass7", "ass8"}
  for index=3D1,#pdffiles do 
    local f =3D doc(pdffiles[index])
  &= nbsp; context.getfiguredimensions({f})
    disppdf(p= dffiles[index])
  end
\stopluacode
\stoptext

I didn=E2= =80=99t know how to get an array (or indexed table or whatever you call it) i= n ConTeXt/Tex. My problem is now with context(context.noffigurepages). I= t doesn=E2=80=99t produce an integer so n is being compared to nil. Am I cal= ling it wrong? All I want to do is call \noffigurepages from the lua side. I= s there something I am missing?
Jethro

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

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

I am trying to put multiple PDF=E2=80=99s that were typeset different= ly into
one document without modifying the individual files th= emselves.
[...]
The problem is the original page= numbers show and I=E2=80=99d prefer that it
did not. So I tho= ught maybe I could clip all the page numbers from
every page (= since they are all in the same position across all the
pages) b= ut I don=E2=80=99t 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=E2=80=99t 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 sourc= e both generates the source PDF document and the
imposed resul= t with clipped pages (just to see a sample of the commands
men= tioned above):

 \startbuffer[newbuff]
 \setuppapersize[A3]
 \setupbodyfont[sans,= 1200pt]
 \starttext
 \dorecurse{8} {\startmakeup[page][pagestate=3Dstart, align=3Dcenter, sty= le=3D\bf]
   \recurselevel
  \sto= pmakeup}
 \stoptext
 \stopbuffer
 \startmode[*first]
 \savebuffer[newbuff][s= ource_page.tex, prefix=3Dno]
 \executesystemcommand{conte= xt --purgeall source_page.tex}
 \stopmode
&= nbsp;\setuplayout[page]
 \setuppapersize[A6][A4]
 \setuppaper[nx=3D2, ny=3D2]
 \setuparranging [= XY]
 \starttext
 \startnotmode[*first]=
 \def\Doc{source_page.pdf}
 \getfigur= edimensions[\Doc]
 \dorecurse{\noffigurepages}
   {\clip[hoffset=3D96mm, voffset=3D136mm, width=3D105mm, heigh= t=3D148mm]
       {\externalfigure[\Doc][p= age=3D\recurselevel]}}
 \stopnotmode
 = \stoptext

Just in case it might help,

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-contextwebpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bi= tbucket.org/phg/context-mirror/commits/
wiki    = : https://contextgarden.n= et
_______________________________________________________= ____________________________

= --Apple-Mail-3C02B8DE-AD6A-4FED-AC24-759D0EEDFCA2-- --===============6673727053641529002== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cHM6Ly93d3cubnRnLm5sL21haWxtYW4v bGlzdGluZm8vbnRnLWNvbnRleHQKd2VicGFnZSAgOiBodHRwczovL3d3dy5wcmFnbWEtYWRlLm5s IC8gaHR0cDovL2NvbnRleHQuYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHBzOi8vYml0YnVja2V0 Lm9yZy9waGcvY29udGV4dC1taXJyb3IvY29tbWl0cy8Kd2lraSAgICAgOiBodHRwczovL2NvbnRl eHRnYXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============6673727053641529002==--