From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/115774 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aditya Mahajan via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Clipping multiple PDFs Date: Tue, 23 Aug 2022 11:27:03 -0400 (EDT) Message-ID: References: <322352C8-805C-4B30-97A7-80F560A32251@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1242984855-1661268311=:125139" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12397"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Alpine 2.23 (LNX 453 2020-06-18) Cc: Aditya Mahajan To: Jethro Djan via ntg-context Original-X-From: ntg-context-bounces@ntg.nl Tue Aug 23 17:27:48 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 1oQVoh-00030v-Ty for gctc-ntg-context-518@m.gmane-mx.org; Tue, 23 Aug 2022 17:27:47 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 141A62A3F93; Tue, 23 Aug 2022 17:27:14 +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 Sl_v1m5sIWoc; Tue, 23 Aug 2022 17:27:12 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 45D382A3FA2; Tue, 23 Aug 2022 17:27:12 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 9B9E52A3F93 for ; Tue, 23 Aug 2022 17:27:10 +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 LwtkeooVzkY5 for ; Tue, 23 Aug 2022 17:27:08 +0200 (CEST) Received-SPF: Softfail (mailfrom) identity=mailfrom; client-ip=132.206.73.2; helo=orford.cim.mcgill.ca; envelope-from=adityam@umich.edu; receiver= Original-Received: from orford.cim.mcgill.ca (orford.cim.mcgill.ca [132.206.73.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id E29E52A3F7B for ; Tue, 23 Aug 2022 17:27:06 +0200 (CEST) Original-Received: from adi-thinkpad (184-175-3-140.dsl.teksavvy.com [184.175.3.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adityam) by orford.cim.mcgill.ca (Postfix) with ESMTPSA id 315E1A11FD for ; Tue, 23 Aug 2022 11:27:04 -0400 (EDT) In-Reply-To: <322352C8-805C-4B30-97A7-80F560A32251@gmail.com> Content-ID: 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:115774 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1242984855-1661268311=:125139 Content-Type: text/plain; CHARSET=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: On Mon, 22 Aug 2022, Jethro Djan via ntg-context wrote: > =EF=BB=BF > Thanks for the solution Pablo. It works well. >=20 > I wanted to add more pdfs (which also has many pages) and found it was ea= sier for me to reason in the lua side of things. This is what I have at the= moment: >=20 > \starttext > \startluacode > local function doc(fil) > return fil..[[.pdf]] > end >=20 > 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 >=20 > local pdffiles =3D {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "as= s7", "ass8"} > for index=3D1,#pdffiles do=20 > local f =3D doc(pdffiles[index]) > context.getfiguredimensions({f}) > disppdf(pdffiles[index]) > end > \stopluacode > \stoptext >=20 > I didn=E2=80=99t know how to get an array (or indexed table or whatever y= ou call it) in ConTeXt/Tex. My problem is now with context(context.noffigur= epages). It doesn=E2=80=99t produce an integer so n is being compared to ni= l. Am I calling it wrong? All I want to do is call \noffigurepages from the= lua side. Is there something I am missing? For a more low-level interface to finding the number of pages, see: https://adityam.github.io/context-blog/post/include-multi-page-pdf/ Aditya --8323329-1242984855-1661268311=:125139 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== --8323329-1242984855-1661268311=:125139--