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 portPrimarySequenceContent typesDefault binding
source  xml html 
stylesheet ✔ text p:empty
Output portPrimarySequenceContent typesDefault binding
result✔  any 
Option nameTypeDefault value
content-typexs:string?()
parametersmap(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
CodeDescription
err:XC0166It is a dynamic error (err:XC0166) if the requested document cannot be produced.
err:XC0204It is a dynamic error (err:XC0204) if the requested content-type is not supported.
err:XD0079It 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

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 URIProcessor selected
https://xmlcalabash.com/paged-media/css-formatter/antenna-houseAntenna House
https://xmlcalabash.com/paged-media/css-formatter/princePrince XML
https://xmlcalabash.com/paged-media/css-formatter/weasyprintWeasyprint
Important

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 nameType
EmbedAllFontsExstring: “part”, “base14”, or “all”
ExitLevelinteger
ImageCompressioninteger
NoAccessibilityboolean
NoAddingOrChangingCommentsboolean
NoAssembleDocboolean
NoChangingboolean
NoContentCopyingboolean
NoFillFormboolean
NoPrintingboolean
OptionFileURIstring
OwnersPasswordstring
TwoPassFormattingboolean

For more information about these properties, consult the AH Formatter API documentation.

The following content-types are supported:

Content typeAH 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 nameType
exePathstring
baseURLstring
compressboolean
debugboolean
embedFontsboolean
encryptboolean
keyBitsstring
userPasswordstring
ownerPasswordstring
disallowPrintboolean
disallowModifyboolean
disallowCopyboolean
disallowAnnotateboolean
fileRootstring
htmlboolean
httpPasswordstring
httpUsernamestring
httpProxystring
inputTypestring
javascriptboolean
logstring
networkboolean
subsetFontsboolean
verboseboolean
xincludeboolean
scriptsstring

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 nameType
exePathstring
mediaTypestring
baseUrlstring
attachmentstring
pdfIdentifierstring
pdfVariantstring
pdfVersionstring
pdfFormsboolean
uncompressedPdfboolean
customMetadataboolean
presentationalHintsboolean
optimizeImagesboolean
jpegQualitystring
fullFontsboolean
hintingboolean
cacheFolderstring
dpistring
verboseboolean
debugboolean
quietboolean
timeoutstring

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.