Pregunta

I recall at one point reading somewhere that PostScript includes some type of named page sizes, or some sort of preset default media sizes somewhere, but I am unable to find where I might have found this anywhere. (I know one can write /Letter <</PageSize [612 792]>> def to name a page media oneself, but that is not what I am looking for.)

Can anyone conform this, or have some idea where this might have been, if it exists?

Also, how can one get locations of the corners of the current page (or the page bounding box), for drawing borders or the like?

¿Fue útil?

Solución

Language level 1 implementations did have some predefined media sizes, but this is pretty much deprecated with later implementations. However many interpreters still carry definitions around in userdict or statusdict.

From the 3rd Edition PLRM 6.4 Output Device Dictionary In LanguageLevel 3, certain capabilities of a page device, such as the possible page sizes or resolutions, can be summarized in an output device dictionary that is stored as an instance of the OutputDevice resource category. This enables applications to query device capabilities directly and also maintains functional equivalence with LanguageLevel 1 (where information on page size capabilities is indicated by the presence of userdict entries such as letter, legal, and a4).

From the second edition PLRM userdict operators There are operators defined in the userdict dictionary that cause an imageable region to be defined. Examples of these operators include, but are not limited to: a4, a4small, b5, ledger, legal, letter, lettersmall, and note. These operators perform the equivalent of an initgraphics and an erasepage. These operators must not be used in an EPS file, as they will erase the entire page that includes the EPS file.

Sadly I no longer have a copy of the first edition PLRM.

The canonical method for finding the page bounding box is something like

initgraphics     %% reset graphics state to the initial state
clippath         %% set the currant path to be the current clip path (ie the page)
flattenpath      %% shouldn't be required, as the initial clip should be rectangular...
pathbbox         %% get the path bounding box
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top