From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/90357 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: total pages in external PDF Date: Wed, 25 Feb 2015 17:05:01 -0500 (EST) Message-ID: References: <54EE095A.7080607@gmx.es> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1167588678-1424901909=:18633" X-Trace: ger.gmane.org 1424901965 16882 80.91.229.3 (25 Feb 2015 22:06:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Feb 2015 22:06:05 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Feb 25 23:05:53 2015 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YQk5Y-0003jM-4E for gctc-ntg-context-518@m.gmane.org; Wed, 25 Feb 2015 23:05:52 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 72FF7101FD for ; Wed, 25 Feb 2015 23:05:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hVLiHnV6SCPg for ; Wed, 25 Feb 2015 23:05:50 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 4A9E110233 for ; Wed, 25 Feb 2015 23:05:24 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E252C101FC for ; Wed, 25 Feb 2015 23:05:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5Vz182S7b4Rf for ; Wed, 25 Feb 2015 23:05:18 +0100 (CET) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 8D028101FB for ; Wed, 25 Feb 2015 23:05:13 +0100 (CET) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.12.86]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id t1PM5Aqi001618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 25 Feb 2015 23:05:12 +0100 Original-Received: FROM Decentralized.ECE.McGill.CA (Decentralized.ECE.McGill.CA [132.206.69.142]) By tombraider.mr.itd.umich.edu ID 54EE4714.5F940.2291 ; Authuser adityam; 25 Feb 2015 17:05:08 EST In-Reply-To: <54EE095A.7080607@gmx.es> User-Agent: Alpine 2.03 (LNX 1266 2009-07-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=141.211.12.86; country=US; region=Michigan; city=Ann Arbor; latitude=42.3241; longitude=-83.7113; http://maps.google.com/maps?q=42.3241,-83.7113&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03NUK5byX - 6e6ec4d2126f - 20150225 (trained as not-spam) Received-SPF: none (filter3-ams.mf.surf.net: domain of adityam@umich.edu does not designate permitted sender hosts) receiver=filter3-ams.mf.surf.net; client-ip=141.211.12.86; envelope-from=; helo=tombraider.mr.itd.umich.edu; identity=mailfrom X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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.org gmane.comp.tex.context:90357 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. --8323328-1167588678-1424901909=:18633 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE 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 =3D epdf.open(arg[\MyFilename]) > total_pages_ =3D doc:getNumPages() > \def\Mypages{total_pages} > > But mixing both lua and ConTeXt commands the wrong way won=E2=80=99t work= =2E > > 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=20my old cut-n-paste module (to format two column pdfs into one column= =20 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]:=20 https://github.com/adityam/cut-n-paste/blob/master/tex/context/third/cut-n-= paste/t-cut-n-paste.tex --8323328-1167588678-1424901909=:18633 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --8323328-1167588678-1424901909=:18633--