PDF のボトムラインの高さを知る最良の方法

PDF のボトムラインの高さを知る最良の方法

あるプロジェクトでは、余白を一切設けない 1 ページの PDF を作成する必要があります。左、右、上余白を 0 に設定するのは簡単ですが、PDF を中身と同じ高さにする必要もあるため、最終的な vbox の深さの一番下でカットする必要があります。これには LuaTeX を使用していますが、PDF の垂直カットは別のスクリプトで行うのが最適です (必要な PDF を生成するには複数のパスが必要なため)。

私が考えているのは、最終ボックスの深さの絶対高さを のような形式で aux ファイルに出力しXXXcutAt:10cm、aux ファイルを解析してこの値をpdfcropスクリプトで に渡すことです。

ただし、この値を知るための最良の方法がわかりません...私が見逃している、TeX のみで取得できる明らかな方法はありますか?そうでない場合は、LuaTeX マニュアルを読むのが目的のようですpdf.vが、使用方法について少し困惑しています...例として使用できる、それを使用したコードはありますか?

答え1

ここに画像の説明を入力してください

これはプレーン tex ですが、latex でも同じことができます。

\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

関連情報