This commit is contained in:
John Whitington 2016-07-21 19:30:02 +01:00
parent ff9e90cb36
commit a673e96090
3 changed files with 34 additions and 21 deletions

View File

@ -749,23 +749,12 @@ let cropbox pdf page =
| Some pdfobject -> Pdf.direct pdf pdfobject
| None -> page.Pdfpage.mediabox
let width box =
let minx, miny, maxx, maxy = Pdf.parse_rectangle box in maxx -. minx
let height box =
let minx, miny, maxx, maxy = Pdf.parse_rectangle box in maxy -. miny
let minx box =
let minx, miny, maxx, maxy = Pdf.parse_rectangle box in minx
let miny box =
let minx, miny, maxx, maxy = Pdf.parse_rectangle box in miny
let maxx box =
let minx, miny, maxx, maxy = Pdf.parse_rectangle box in maxx
let maxy box =
let minx, miny, maxx, maxy = Pdf.parse_rectangle box in maxy
let width box = let minx, miny, maxx, maxy = Pdf.parse_rectangle box in maxx -. minx
let height box = let minx, miny, maxx, maxy = Pdf.parse_rectangle box in maxy -. miny
let minx box = let minx, miny, maxx, maxy = Pdf.parse_rectangle box in minx
let miny box = let minx, miny, maxx, maxy = Pdf.parse_rectangle box in miny
let maxx box = let minx, miny, maxx, maxy = Pdf.parse_rectangle box in maxx
let maxy box = let minx, miny, maxx, maxy = Pdf.parse_rectangle box in maxy
let find_page_width pdf page = width page.Pdfpage.mediabox
let find_page_height pdf page = height page.Pdfpage.mediabox

Binary file not shown.

View File

@ -276,13 +276,37 @@ supported:
\begin{table}[h]
\centering
\begin{tabular}{rl}
pt & Points (72 points per inch). The default. \\
cm & Centimeters \\
mm & Millimeters \\
in & Inches \\
\texttt{pt} & Points (72 points per inch). The default. \\
\texttt{cm} & Centimeters \\
\texttt{mm} & Millimeters \\
\texttt{in} & Inches \\
\end{tabular}
\end{table}
\noindent For example, one may write \texttt{14mm} or \texttt{21.6in}. In addition, the following letters stand, in some operations (\texttt{-scale-page}, \texttt{-scale-to-fit}, \texttt{-scale-contents}, \texttt{-shift}, \texttt{-mediabox}, \texttt{-crop}) for various page dimensions:
\begin{table}[h]
\centering
\begin{tabular}{rl}
\texttt{PW} & Page width\\
\texttt{PH} & Page height\\
\texttt{PMINX} & Page minimum x coordinate\\
\texttt{PMINY} & Page minimum y coordinate\\
\texttt{PMAXX} & Page maximum x coordinate\\
\texttt{PMAXY} & Page maximum y coordinate\\
\texttt{CW} & Crop box width\\
\texttt{CH} & Crop box height\\
\texttt{CMINX} & Crop box minimum x coordinate\\
\texttt{CMINY} & Crop box minimum y coordinate\\
\texttt{CMAXX} & Crop box maximum x coordinate\\
\texttt{CMAXY} & Crop box maximum y coordinate
\end{tabular}
\end{table}
\noindent For example, we may write \texttt{PMINX PMINY} to stand for the coordinate of the lower left corner of the page.
Simple arithmetic may be performed using the words \texttt{add}, \texttt{sub}, \texttt{mul} and \texttt{div} to stand for addition, subtraction, multiplication and division. For example, one may write \texttt{14in sub 30pt} or \texttt{PMINX mul 2}
\section{PDF Version Numbers}
\index{version number}
When an operation which uses a part of the PDF standard which was introduced in