2

My tags are follows:

\documentclass{book}

\newwrite\stylesheetdetails% \immediate\openout\stylesheetdetails\jobname.ssh%

\AtEndDocument{\immediate\closeout\stylesheetdetails}%

\setlength{\paperheight}{9truein}% \setlength{\paperwidth}{6truein}%

\immediate\write\stylesheetdetails{Trim size\space\the\paperwidth\space x\space\the\paperheight\space inches}%

\begin{document}

This is for test

\end{document}

I need to get the Trim size values and need to store in a separate file with extension of .ssh, I tried with the above, but the output came as:

Trim size 433.62pt x 650.43pt inches

But I need the output in inches or whatever I given (e.g., some time it may be in mm) not the point values, please suggest, how to get it...

MadyYuvi
  • 13,693

1 Answers1

2

You will need to save the lengths in macros for writing out, but of course still set \paperwidth and \paperheight to have effect on the PDF. That is best done using a short wrapper, for example

\documentclass{book}

\newwrite\stylesheetdetails \immediate\openout\stylesheetdetails\jobname.ssh %

\AtEndDocument{\immediate\closeout\stylesheetdetails}

\newcommand\savedpaperheight{0pt} \newcommand\savedpaperwidth{0pt}

\NewDocumentCommand\setpapersize{mm}{% \setlength{\paperheight}{#1}% \setlength{\paperwidth}{#2}% \renewcommand\savedpaperheight{#1}% \renewcommand\savedpaperwidth{#2}% }

\setpapersize{9truein}{6truein}

\immediate\write\stylesheetdetails{Trim size \savedpaperheight\space x \savedpaperwidth}

\begin{document}

This is for test

\end{document}

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036