Name
p:css-formatter — The standard p:css-formatter step.
Synopsis
The p:css-formatter
step applies CSS
formatting to an XML or HTML document.
The output of this step is often, but not necessarily, a PDF document.
Input port | Primary | Sequence | Content types | Default binding |
---|---|---|---|---|
source | xml html | |||
stylesheet | ✔ | text | p:empty |
Output port | Primary | Sequence | Content types | Default binding |
---|---|---|---|---|
result | ✔ | any |
Option name | Type | Default value |
---|---|---|
content-type | xs:string? | () |
parameters | map(xs:QName,item()*)? | () |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
| <p:input port="source" content-types="xml html"/>
| <p:input port="stylesheet" content-types="text" sequence="true">
| <p:empty/>
5 | </p:input>
| <p:output port="result" content-types="any"/>
| <p:option name="parameters" as="map(xs:QName,item()*)?"/>
| <p:option name="content-type" as="xs:string?"/>
|</p:declare-step>
Errors
Code | Description |
---|---|
err:XC0166 | It is a dynamic error (err:XC0166 ) if the requested document
cannot be produced. |
err:XC0204 | It is a dynamic error (err:XC0204 ) if the requested
content-type is not supported. |
err:XD0079 | It is a dynamic error (err:XD0079 ) if a supplied content-type is not
a valid media type of the form
“type/subtype+ext ”
or “type/subtype ”. |
Implementation defined features
- The use of media type
parameters on the
content-type
option is implementation-defined. - If the
content-type
option is not specified, the output type is implementation-defined. - The precise way that the
p:css-formatter
step selects stylesheets is implementation-defined. - A formatter may take any number of optional rendering
parameters via the step's
parameters
; such parameters are defined by the CSS implementation used and are implementation-defined. - The CSS level and the particular CSS features supported by
p:css-formatter
are implementation-defined.
Description
The p:css-formatter
step is defined in the
XProc 3.1:
Standard Step Library. It is also described on
XProcRef.org.
XML Calabash supports several CSS formatter implementations. There is also a service provider interface so that additional implementations can be provided by third parties. Several XSL formatters are also supported.
Processors can be selected in the configuration file
with the cc:paged-media
element as described in the
User Guide.
Configuration URI | Processor selected |
---|---|
https://xmlcalabash.com/paged-media/css-formatter/antenna-house | Antenna House |
https://xmlcalabash.com/paged-media/css-formatter/prince | Prince XML |
https://xmlcalabash.com/paged-media/css-formatter/weasyprint | Weasyprint |
You must also obtain and install the relevant processor, configure it on your system, and satisfy its licensing requirements. XML Calabash doesn’t ship with the processors themselves.
Antenna House
In order to use the Antenna House formatter, you must install and configure Antenna House Formatter.
You can configure the formatter with
a
configuration property or via the parameters
option.
The following configuration options are supported:
Property name | Type |
---|---|
EmbedAllFontsEx | string: “part”, “base14”, or “all” |
ExitLevel | integer |
ImageCompression | integer |
NoAccessibility | boolean |
NoAddingOrChangingComments | boolean |
NoAssembleDoc | boolean |
NoChanging | boolean |
NoContentCopying | boolean |
NoFillForm | boolean |
NoPrinting | boolean |
OptionFileURI | string |
OwnersPassword | string |
TwoPassFormatting | boolean |
For more information about these properties, consult the AH Formatter API documentation.
The following content-type
s are supported:
Content type | AH output format |
---|---|
application/pdf | @PDF |
application/postscript | @PS |
application/vnd.inx | @INX |
application/vnd.mif | @MIF |
image/svg+xml | @SVG |
text/plain | @TEXT |
PrinceXML
In order to use the PrinceXML formatter, you must install and configure Prince.
You can configure the formatter with
a
configuration property or via the parameters
option.
The following configuration options are supported:
Property name | Type |
---|---|
exePath | string |
baseURL | string |
compress | boolean |
debug | boolean |
embedFonts | boolean |
encrypt | boolean |
keyBits | string |
userPassword | string |
ownerPassword | string |
disallowPrint | boolean |
disallowModify | boolean |
disallowCopy | boolean |
disallowAnnotate | boolean |
fileRoot | string |
html | boolean |
httpPassword | string |
httpUsername | string |
httpProxy | string |
inputType | string |
javascript | boolean |
log | string |
network | boolean |
subsetFonts | boolean |
verbose | boolean |
xinclude | boolean |
scripts | string |
The exePath
property is used to locate the
prince
executable. If it’s not specified, XML Calabash will
first look for the system property
com.xmlcalabash.css.prince.exepath
, and if that doesn’t
exist, it will search the user’s PATH
environment
variable.
The keyBits
, userPassword
,
ownerPassword
, disallowPrint
, disallowModify
,
disallowCopy
, and disallowAnnotate
values are combined
to form the encryption information.
The scripts
property is a space delimited list of scripts.
Each script will be added to the processor.
For more information about the properties, consult the Prince API documentation.
Weasyprint
In order to use the Weasyprint formatter, you must install and configure WeasyPrint.
You can configure the formatter with
a
configuration property or via the parameters
option.
The following configuration options are supported:
Property name | Type |
---|---|
exePath | string |
mediaType | string |
baseUrl | string |
attachment | string |
pdfIdentifier | string |
pdfVariant | string |
pdfVersion | string |
pdfForms | boolean |
uncompressedPdf | boolean |
customMetadata | boolean |
presentationalHints | boolean |
optimizeImages | boolean |
jpegQuality | string |
fullFonts | boolean |
hinting | boolean |
cacheFolder | string |
dpi | string |
verbose | boolean |
debug | boolean |
quiet | boolean |
timeout | string |
The exePath
property is used to locate the
weasyprint
executable. If it’s not specified, XML Calabash will
first look for the system property
com.xmlcalabash.css.weasyprint.exepath
, and if that doesn’t
exist, it will search the user’s PATH
environment
variable.
For more information about the properties, consult the WeasyPrint documentation.