This article describes the customization options available for processing PDF files in Hyperscience.
PDF Page Box
PDF Page Boxes are page dimensions defined in a PDF’s metadata that are primarily used for commercial printing purposes. However, with the PDF_PAGE_BOX “.env” file variable, you can also use these properties to control how your PDF files’ pages appear in the Hyperscience application.
The value of the PDF_PAGE_BOX variable determines which PDF Page Box type the system uses to display PDFs in the application. The possible values for this variable are listed below:
MediaBox — defines the physical page size of your document. It includes the crop marks, bleed box, trim box, and art box described below.
BleedBox — (default) represents the region to which the page’s contents or elements should be extended. This region may include any extra bleed area needed to accommodate the physical limitations when output in a production environment.
TrimBox — defines the intended dimensions. It determines the final size of the page when printed.
ArtBox — the content area of the page (i.e., the area covered with graphics and text).
CropBox — specifies the region to which the contents of the page should be cropped when displayed on screen.
To learn more about PDF Page Boxes, see ActivePDF’s What are PDF Page Boxes.
Sometimes, images of PDF pages may appear as thumbnails if the PDF file defines incorrect page dimensions. To resolve this issue, you need to set PDF_PAGE_BOX to CropBox. Learn more about editing environment variables in Editing the ".env" file and running the application.
Mutool and Ghostscript
Hyperscience uses Mutool and Ghostscript to process PDF pages.
Mutool is a command line tool that allows you to perform various operations on PDF files. It’s used to compress the size of the PDF or convert the file to a PNG, JPEG, TIFF, or SVG.
Ghostscript is a tool for working with PostScript and PDF files. It allows you to view, convert, or manipulate these document formats.
Order of tools
In v39.0.1-39.0.10, v38, and earlier versions, the system attempts to use Ghostscript before Mutool when processing PDFs, and this order cannot be edited.
In v39.0.11+, v39.1, and later versions, you can define the order in which these tools are used by editing the PDF_PAGINATION_LIBS “.env” file variable. By default, the system attempts to use Mutool before Ghostscript, and the variable is defined as follows:
PDF_PAGINATION_LIBS=mutool,gs
If you have defined a value for PDF_PAGE_BOX, PDF_PAGINATION_LIBS will be ignored, and Ghostscript will be used as the default tool for PDF processing.