
Para alguns projetos, preciso fazer um PDF de uma página, sem margem alguma. As margens esquerda, direita e superior são fáceis de definir como 0, mas também preciso que o pdf tenha a altura exata do que está dentro, então preciso cortar na parte inferior da profundidade do vbox final. Estou usando LuaTeX para isso, e é melhor que o corte vertical do pdf seja feito em um script separado (pois preciso de múltiplas passagens para gerar o PDF que desejo).
O que estou pensando é gerar a altura absoluta da profundidade da caixa final no arquivo aux, algo como XXXcutAt:10cm
, e então analisar o arquivo aux e passar esse valor pdfcrop
em um script.
Porém, não tenho certeza sobre a melhor maneira de saber esse valor ... Existe alguma maneira óbvia apenas de TeX de obtê-lo que estou perdendo? Se não, parece que ler o manual do LuaTeX pdf.v
é o que eu quero, mas estou um pouco confuso sobre como usá-lo... Existe algum código que eu possa usar como exemplo?
Responder1
Este é um texto simples, mas você pode fazer o mesmo em látex.
\setbox0=\vbox{\hsize=7.8cm
some text to fill out several lines of a paragraph with a high
proportion of g and y and f so that the depth is non zero
some text to fill out several lines of a paragraph with a high
proportion of g and y and f so that the depth is non zero
some text to fill out several lines of a paragraph with a high
proportion of g and y and f so that the depth is non zero
some text to fill out several lines of a paragraph with a high
proportion of g and y and f so that the depth is non zero
some text to fill out several lines of a paragraph with a high
proportion of g and y and f so that the depth is non zero
some text to fill out several lines of a paragraph with a high
proportion of g and y and f so that the depth is non zero}
\hoffset-1in
\voffset-1in
%asuming luatex 0.80 or older
\pdfpagewidth\wd0
\pdfpageheight\dimexpr\ht0+\dp0\relax
\shipout\box0
\bye