ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jack Steyn <steynjack@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: Trouble setting PDF boxes
Date: Sun, 26 Apr 2020 02:42:36 +1000	[thread overview]
Message-ID: <CAA=DcJHx5b++uADo_EHvjHEiTyB2CyYyDUmYmhyYr-LEhT3psA@mail.gmail.com> (raw)
In-Reply-To: <CAA=DcJEbQdsU6yFBOBPup2WUk0wYh4_NnXAh79K9kHnvQcdLAw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1723 bytes --]

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-every-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 = string.formatters

      local pdfverbose = lpdf.verbose
      local pdfarray = lpdf.array

      local factor  = number.dimenfactors.bp
      local f_value = 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 <steynjack@gmail.com> wrote:

> Hi,
>
> I am having trouble setting the PDF boxes to my desired dimensions.
> Suppose I have \setuppapersize[*a*][*b*]. I want CropBox = MediaBox = *b*.
> So far, so good: I can just use cropoffset=0mm in \setuplayout. But I want
> TrimBox = *a*. However, as far as I can see, I can't achieve this using
> trimoffset in \setuplayout unless (width of *b*) – (width of *a*) =
> (height of *b*) – (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 BleedBox,
> which I want to be 3mm wider and taller than the TrimBox). Does anyone know
> how to do this?
>
> Best,
>
> Jack
>

[-- Attachment #1.2: Type: text/html, Size: 2562 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-04-25 16:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 12:37 Jack Steyn
2020-04-25 16:42 ` Jack Steyn [this message]
2020-04-30 15:51   ` Jack Steyn
2020-04-30 19:44     ` Hans Hagen
2020-05-01  1:55       ` Jack Steyn
2020-04-26  9:46 ` bug in PDF boxes? (was: Re: Trouble setting PDF boxes)) Pablo Rodriguez
2020-04-26 14:43   ` Jack Steyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA=DcJHx5b++uADo_EHvjHEiTyB2CyYyDUmYmhyYr-LEhT3psA@mail.gmail.com' \
    --to=steynjack@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).