From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/115766 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:46:48 +0000 Message-ID: References: <562590a3-0a27-ffb2-e76f-a5491bcbed8e@gmx.es> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5515316801610240878==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2819"; 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 17:47:49 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 1oQ9eW-0000X2-Jf for gctc-ntg-context-518@m.gmane-mx.org; Mon, 22 Aug 2022 17:47:48 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8044D36098F; Mon, 22 Aug 2022 17:47:20 +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 3zVGoPs5BueH; Mon, 22 Aug 2022 17:47:17 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 17B9E360977; Mon, 22 Aug 2022 17:47:17 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id DDCD036095D for ; Mon, 22 Aug 2022 17:47:15 +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 my3S6Sbw091o for ; Mon, 22 Aug 2022 17:47:14 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.176; helo=mail-yw1-f176.google.com; envelope-from=jthryeboah@gmail.com; receiver= Original-Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (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 6BCE336089F for ; Mon, 22 Aug 2022 17:47:14 +0200 (CEST) Original-Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-33387bf0c4aso304558397b3.11 for ; Mon, 22 Aug 2022 08:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc; bh=G+X6+HBrqBXKMo5H2eY4thokMHsd4oiaWdGBbYTfZDE=; b=qCtY0OGh2F6tIQDEDNtI8gJuTPQ1a/MgeT4/RYbG0aDVPBznBpu7igIaY2RuTSbfRY 4saRX+tPA5X6Y1OCY+0Pdu6nzSNBph7MKvabzZzs/u7Eblfq6a/Yv3T8nAyfXZvzgmUK b1ivctPh4+WmVX4tNVF46LhlevsY6wpzOqQxeYYpNzRkKIu2jgTMLRTEgnX27lFconLG ryLaSOBTIEbHDoEfe8UTRH8+PijMAKAv+dOGPeLkz/1c1w26WgZhzjsblw4PbBuXjc7W B/D5cerpXlWTRyabljQoo0a2KcowfMhyXdPRMVi3MSiXH+4wDmU1beNJGXTPeGbj8BWb tW9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc; bh=G+X6+HBrqBXKMo5H2eY4thokMHsd4oiaWdGBbYTfZDE=; b=osyOwUXyWX6wj4YX8eCJJaLh+J6/EIqLY64FpECIyIMfJuSw6sFlAHshNkuQseOX6i 9lI10qkGvtv5IsIC0QH1vnmuY9ZovebWamDSxWthWmxaPqJ63cp39TGFG6ThHFMoL424 LApsF4RPrReAdXNeRHdHmtBoCoWY5Ald2SP3BcH+RWYXn43I95NfxOg4DIXxnHY/zIO9 HcpZaxT86SpZI9QrRIslQglrjBOduoOYORy3H3F3pHvRS+zTCBQ6zgGmKLa2kbECFSEd K2oM7B2oAhYVJHW6vaQmYprsBCdwk+wB5Is4eKsuIseRFIDkYGOTxBUHVtwLgPw9E6iA i12g== X-Gm-Message-State: ACgBeo3JJw0LYD1QNfuW89Rs69p1q4CSYYUBfg//Gr2nqbnpsaevqdRu kevuFpAGqgS3r2Jhpyn5V0YeKC2GOwLAsilW4v3ZdiwnZDw= X-Google-Smtp-Source: AA6agR6PTkME2WNUOZN7veLu01C7I97tO9olJkrD0W/eGR7KNtUS9T8CE2BGISAnOXJNIPi3q8St8eHezPzvpF9UFy8= X-Received: by 2002:a25:a2c4:0:b0:695:818c:d1a2 with SMTP id c4-20020a25a2c4000000b00695818cd1a2mr10243137ybn.531.1661183231125; Mon, 22 Aug 2022 08:47:11 -0700 (PDT) In-Reply-To: <562590a3-0a27-ffb2-e76f-a5491bcbed8e@gmx.es> 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:115766 Archived-At: --===============5515316801610240878== Content-Type: multipart/alternative; boundary="00000000000065ee3005e6d65cdb" --00000000000065ee3005e6d65cdb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: \starttext \startluacode local function doc(fil) return fil..[[.pdf]] end local function disppdf(fname) n =3D 1 repeat 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 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= 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? Jethro On 21 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 differently int= o one document without modifying the individual files themselves. [...] The problem is the original page numbers show and I=E2=80=99d prefer that i= t 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. 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 source both generates the source PDF document and the imposed result with clipped pages (just to see a sample of the commands mentioned above): \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 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-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________= ________ --00000000000065ee3005e6d65cdb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= Thanks for the solution Pablo. It works well.

I wanted to add more p= dfs (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=C2=A0the moment:

\st= arttext
\startluacode
=C2=A0 local function doc(fil)
=C2=A0 =C2=A0= return fil..[[.pdf]]
=C2=A0 end

=C2=A0 local function disppdf(fn= ame)
=C2=A0 =C2=A0 n =3D 1=C2=A0
=C2=A0 =C2=A0 repeat=C2=A0
=C2=A0= =C2=A0 =C2=A0 context.externalfigure({fname},{
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 page =3D n,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 width =3D "200mm",=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 scale =3D "950"
=C2=A0 =C2=A0 = =C2=A0 })
=C2=A0 =C2=A0 =C2=A0 n =3D n + 1
=C2=A0 =C2=A0 until n =3D= =3D context(context.noffigurepages)
=C2=A0 end

=C2=A0 local pdffi= les =3D {"ass1", "ass2", "ass3", "ass4&q= uot;, "ass5", "ass6", "ass7", "ass8"= ;}
=C2=A0 for index=3D1,#pdffiles do=C2=A0
=C2=A0 =C2=A0 local f =3D = doc(pdffiles[index])
=C2=A0 =C2=A0 context.getfiguredimensions({f})
= =C2=A0 =C2=A0 disppdf(pdffiles[index])
=C2=A0 end
\stopluacode
\st= optext

I didn=E2=80=99t know how to get an array (or ind= exed table or whatever you call it) in ConTeXt/Tex. My problem is now with= =C2=A0context(context.noffigurepages). Am = I calling it wrong? All I want to do is call \noffigurepages from the lua s= ide. Is there something I am missing?

Jethro=

On 21 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 themselves.<= br>[...]
The problem is the original page numbers show and I=E2=80=99d p= refer that it
did not. So I thought maybe I could clip all the page numb= ers 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 comman= d. Any
ideas? I already tried using \input but it gives some weird outpu= t 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 w= orks using \clip with \externalfigure inside a loop (\dorecurse).

Wi= th \getfiguredimensions you get the number of pages of each PDF
document= (\noffigurepages).

The following source both generates the source P= DF document and the
imposed result with clipped pages (just to see a sam= ple of the commands
mentioned above):

=C2=A0\startbuffer[newbuff]=
=C2=A0\setuppapersize[A3]
=C2=A0\setupbodyfont[sans, 1200pt]
=C2= =A0\starttext
=C2=A0\dorecurse{8}
=C2=A0{\startmakeup[page][pagestate= =3Dstart, align=3Dcenter, style=3D\bf]
=C2=A0 =C2=A0\recurselevel
=C2= =A0 \stopmakeup}
=C2=A0\stoptext
=C2=A0\stopbuffer
=C2=A0\startmod= e[*first]
=C2=A0\savebuffer[newbuff][source_page.tex, prefix=3Dno]
= =C2=A0\executesystemcommand{context --purgeall source_page.tex}
=C2=A0\s= topmode
=C2=A0\setuplayout[page]
=C2=A0\setuppapersize[A6][A4]
=C2= =A0\setuppaper[nx=3D2, ny=3D2]
=C2=A0\setuparranging [XY]
=C2=A0\star= ttext
=C2=A0\startnotmode[*first]
=C2=A0\def\Doc{source_page.pdf}
= =C2=A0\getfiguredimensions[\Doc]
=C2=A0\dorecurse{\noffigurepages}
= =C2=A0 =C2=A0{\clip[hoffset=3D96mm, voffset=3D136mm, width=3D105mm, height= =3D148mm]
=C2=A0 =C2=A0 =C2=A0 =C2=A0{\externalfigure[\Doc][page=3D\recu= rselevel]}}
=C2=A0\stopnotmode
=C2=A0\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 / <= a href=3D"https://www.ntg.nl/mailman/listinfo/ntg-context" target=3D"_blank= ">https://www.ntg.nl/mailman/listinfo/ntg-context
webpage =C2=A0: https://www.pragma-a= de.nl / http:/= /context.aanhet.net
archive =C2=A0: https://bitbucket.org/phg/c= ontext-mirror/commits/
wiki =C2=A0 =C2=A0 : https://contextgarden.net
_________= __________________________________________________________________________<= br>

--00000000000065ee3005e6d65cdb-- --===============5515316801610240878== 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== --===============5515316801610240878==--