From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/107063 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Jack Steyn Newsgroups: gmane.comp.tex.context Subject: Re: Trouble setting PDF boxes Date: Sun, 26 Apr 2020 02:42:36 +1000 Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5442228458383738985==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="58390"; mail-complaints-to="usenet@ciao.gmane.io" To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sat Apr 25 18:44:08 2020 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 1jSNuS-000F3e-1G for gctc-ntg-context-518@m.gmane-mx.org; Sat, 25 Apr 2020 18:44:08 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 284AB181EBF; Sat, 25 Apr 2020 18:43:09 +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 fPY4j1rmZgul; Sat, 25 Apr 2020 18:43:08 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 345D6182CC8; Sat, 25 Apr 2020 18:43:08 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2E841182CC8 for ; Sat, 25 Apr 2020 18:43:07 +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 Xm8TKrGx0BsS for ; Sat, 25 Apr 2020 18:43:05 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.215.181; helo=mail-pg1-f181.google.com; envelope-from=steynjack@gmail.com; receiver= Original-Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 F26FC181EBF for ; Sat, 25 Apr 2020 18:43:04 +0200 (CEST) Original-Received: by mail-pg1-f181.google.com with SMTP id j7so6189919pgj.13 for ; Sat, 25 Apr 2020 09:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=K4FH7q0ppq0oGKLauPPiUFXZoLQPKTLSuz6NlQf4nFY=; b=jsxl938Rivc0UCxdkP+2gkOuJx5k1D9MkDTQdWlPy36TI45168uD9ABdTEX6OVlycd 5o249zZjaKeAXniUpruI5HNHNF8AHCr5ygN6qCEmAXURkmRGLKe3pBRGd0NrFq2AhrwH ZwhAPkkwUgVm0Z549h5OrHDvYp6FOmB/sd3QFalpmeA2rcgZ9dAbZDkV6iXsg8WNRX4Z hhjG4BnQ4vba5m3ISdGPuVQgDmNp03Ce6yrvIylrJU0Mo1mmFQ2hH4mEgewDqgPTKZrc bXWWB75ingn6EhGLA6glp46qlEjwC4d119PdVMJAHhxacuTy+8Dk1UB69xJyJ3OsKUz8 h7LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=K4FH7q0ppq0oGKLauPPiUFXZoLQPKTLSuz6NlQf4nFY=; b=Y4O8ioNYHULvR367fwoR/sfMZDTRFNCEXUKG3zIXg+AYTv7onX7TMxepH/B66W34H/ rI8vwFrMeUsf9ozf9BB30a8bvv1dKMFIP4Q4NKCu+IPk31IAvDLSu7ofeDKB5t4Y2QqL yZEGbQpCdMqN5NrFsOiT5sy1rYJK5eBIuvO2I4x0fFOi8FIPnLolpQHsRPoCSWpJkMRT 8P1xFo/WINu1172HaPS0H4A+fGSUCLnAFdvUxLKfnWQjmZOm38b/l69GbKYe9f6j13QW HKNQ/C8KnUP1s6SLMXqUrxf1L9g33Odk9KtrDX3pmstu1QIsDsViAs2BbmrvJKosYfQ7 IuWQ== X-Gm-Message-State: AGi0PuYyqtzhc02sSVsFM6jAVK4/VAuGFI47VlCcGkR0dNRILdrvXb6I 4EhPJc347UKNSmnAmtCBu1gy/Q+MrVn5/7Vdp3r37ODH X-Google-Smtp-Source: APiQypKkGSGaF7IoAZIai3COwCjyQHaJbZThT7tNnY1cXBA2AEmVgo5U7COaaSxSI/SERfWvYYhIfkC5GEj331kSs7Y= X-Received: by 2002:aa7:8a92:: with SMTP id a18mr15987431pfc.0.1587832982292; Sat, 25 Apr 2020 09:43:02 -0700 (PDT) In-Reply-To: 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:107063 Archived-At: --===============5442228458383738985== Content-Type: multipart/alternative; boundary="000000000000df4cda05a4202c70" --000000000000df4cda05a4202c70 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable After much searching, my probably laughable attempt consists of combining the answer to the question at https://tex.stackexchange.com/questions/433110/setting-page-attributes-of-e= very-page-in-a-generated-context-file with what I can see in the source at https://source.contextgarden.net/tex/context/base/mkiv/lpdf-mis.lua: \appendtoks \startluacode local formatters =3D string.formatters local pdfverbose =3D lpdf.verbose local pdfarray =3D lpdf.array local factor =3D number.dimenfactors.bp local f_value =3D formatters["\letterpercent.6N"] local function boxvalue(n) return pdfverbose(f_value(factor * n)) end lpdf.addtopageattributes("TrimBox", pdfarray { boxvalue(30), boxvalue(30), boxvalue(180), boxvalue(267),}) \stopluacode \to \aftereverypage This code throws no errors, but unfortunately it also has no effect. What am I doing wrong? Jack On Sat, 25 Apr 2020 at 22:37, Jack Steyn wrote: > Hi, > > I am having trouble setting the PDF boxes to my desired dimensions. > Suppose I have \setuppapersize[*a*][*b*]. I want CropBox =3D MediaBox =3D= *b*. > So far, so good: I can just use cropoffset=3D0mm in \setuplayout. But I w= ant > TrimBox =3D *a*. However, as far as I can see, I can't achieve this using > trimoffset in \setuplayout unless (width of *b*) =E2=80=93 (width of *a*)= =3D > (height of *b*) =E2=80=93 (height of *a*), which does not hold in my case= . So it > looks like I need to find another way to set the TrimBox (and the BleedBo= x, > which I want to be 3mm wider and taller than the TrimBox). Does anyone kn= ow > how to do this? > > Best, > > Jack > --000000000000df4cda05a4202c70 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
After much searching, my probably laughable attempt consis= ts of combining the answer to the question at=C2=A0https://tex.stackexchange.com/q= uestions/433110/setting-page-attributes-of-every-page-in-a-generated-contex= t-file=C2=A0with what I can see in the source at=C2=A0https://source.contextgarden.net/tex/context/base/mkiv/lpdf-mis.lua:

\appendtoks
=C2=A0 \startluacode
=C2=A0 =C2=A0= =C2=A0 local formatters =3D string.formatters

=C2=A0 =C2=A0 =C2=A0 = local pdfverbose =3D lpdf.verbose
=C2=A0 =C2=A0 =C2=A0 local pdfarray = =3D lpdf.array

=C2=A0 =C2=A0 =C2=A0 local factor =C2=A0=3D number.di= menfactors.bp
=C2=A0 =C2=A0 =C2=A0 local f_value =3D formatters["\l= etterpercent.6N"]

=C2=A0 =C2=A0 =C2=A0 local function boxvalue(= n)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return pdfverbose(f_value(factor *= n))
=C2=A0 =C2=A0 =C2=A0 end

=C2=A0 =C2=A0 =C2=A0 lpdf.addtopage= attributes("TrimBox", pdfarray {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 boxvalue(30),
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 boxvalue(30),=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 boxvalue(180),
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 boxvalue(267),})
=C2=A0 \stopluacode
\to \aftereverypag= e

This code throws no errors, but unfortunatel= y it also has no effect. What am I doing wrong?

Ja= ck

On Sat, 25 Apr 2020 at 22:37, Jack Steyn <steynjack@gmail.com> wrote:
Hi,<= div>
I am having trouble setting the PDF boxes to my desired = dimensions. Suppose I have \setuppapersize[a][b].=C2=A0I want= CropBox =3D MediaBox =3D=C2=A0b. = So far, so good: I can just use cropoffset=3D0mm in \setuplayout. But I wan= t TrimBox =3D a. However, as far as I can see, I can't achieve t= his using trimoffset in \setuplayout unless (width of b) =E2=80=93 (= width of a) =3D (height of b) =E2=80=93 (height of a),= which does not hold in my case. So=C2=A0it looks like I need to find anoth= er way to set the TrimBox (and the BleedBox, which I want to be 3mm wider a= nd taller than the TrimBox). Does anyone know how to do this?
Best,

Jack
--000000000000df4cda05a4202c70-- --===============5442228458383738985== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============5442228458383738985==--