
Para algún proyecto necesito hacer un PDF de una página, sin margen alguno. Los márgenes izquierdo, derecho y superior son fáciles de establecer en 0, pero también necesito que el pdf tenga la altura exacta de lo que hay dentro, por lo que necesito cortar en la parte inferior de la profundidad del vbox final. Estoy usando LuaTeX para esto, y es mejor si el corte vertical del pdf se realiza en un script separado (ya que necesito varias pasadas para generar el PDF que quiero).
Lo que estoy pensando es generar la altura absoluta de la profundidad del cuadro final en el archivo auxiliar, algo así como XXXcutAt:10cm
, y luego analizar el archivo auxiliar y pasar este valor pdfcrop
en un script.
Sin embargo, no estoy seguro de cuál es la mejor manera de conocer este valor... ¿Hay alguna forma obvia de obtenerlo solo en TeX que me esté perdiendo? Si no, parece que leer el manual de LuaTeX pdf.v
es lo que quiero, pero estoy un poco desconcertado sobre la forma de usarlo... ¿Hay algún código que pueda usarlo como ejemplo?
Respuesta1
Este es tex simple, pero puedes hacer lo mismo con 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