-
Notifications
You must be signed in to change notification settings - Fork 5
Reference: XML tags
These variable can be inserted freely in the XML document to specifiy the current page number and the totalnumber of pages (respectively).
The coordinate system has (0,0) as the top left of each page. The units used to specify coordinates and size correspond to 72 points/inch. For example a 8.5" x 11" page is 8.572 = 612 and 1172 = 792 (612x792).
All tags described here support the attributes 'id' and 'class'
This tag must be the root of the XML document.
Attributes: pagesize="page_width:page_height", orientation="portrait" (or "landscape")
Frames are a concept used in Reportlab. They are containers in which other elements can reside. Elements within a frame cannot have posx and posy attributes, they are positionned in a 'flow' within the frame.
Attributes: posx, posy, height, width
Draws a box.
Attributes: posx, posy, height, width, background-color, border, color, snapto
Draws a line.
Attributes: posx, posy, endx, endy, border, color
Draws an ellipse (or circle).
Attributes: posx, posy, rx, ry, border, color
Allows to transform the canvas through translations, rotations and scaling. All elements within the tranform tags will be tranformed accordingly. Transforms can be nested, to compose more complex transformations as needed.
Attributes: transform = "rotate:degrees" or ... = "translate:tx:ty" or ... = "scale:multx:multy"
Has no effect on the visual appearance of generated PDF. Simply a way to partition the XML content. It is recommened the 'style(s)' tags be declared within the 'header'.
Attributes: None
Has no effect on the visual appearance of generated PDF. Simply a way to partition the XML content.
Attributes: None
This tag is ESSENTIAL in telling PyXML2PDF where each page ends. Otherwise, the generated PDF will be a blank page. It should be placed at the end of each page that needs to be part of the PDF.
Attributes: None
This tag should be used in 'header'. It is simply a way to contain 'style' tags.
Attributes: None
This tag allows to create a named style. Each style can have specific attributes (font, color, height ...) which can be applied to a specific tag to modify it's appearance. If an attribute is also specified within a tag, it overrides the same attribute for the style used for that tag.
Attributes: name
Example:
<style name="normal">
font-size:10;
top-padding:0.5;
left-padding:0.5;
height:11;
</style>
This tags allow to create a textfield (paragraph). The text will be truncated by default if it is larger than the width. However, the 'wrap' attribute can be used to wrap the text within the width specified. All newline (\n) characters within this tag's text will be render as so in PDF document .
Attributes: background-color, font-weight, font-style, leading, color,wrap, text-align, posx, posy, height, width, snapto
This tag allows inserting images within the PDF document.
Attributes: border, border-color, posx, posy, height, src, width, snapto