Data for one SVG page to be added to a document file.
The DocumentSvgPage class derives from DocumentPage and contains the data for one SVG page to be added to a document file. It is used as a parameter to the DocumentWriter.AddPage or DocumentWriter.InsertPage methods used to add the page.
The DocumentSvgPage.SvgDocument property must contain a valid SVG (ISvgDocument) object that contains the visual representation of the page. This SVG object can obtained through multiple sources as explained in LEADTOOLS Document Writers.
DocumentSvgPage.SvgDocument is used as is when DocumentWriter.AddPage or DocumentWriter.InsertPage is called and the framework does not delete it. You must dispose the object when it is no longer used.
The DocumentSvgPage.Image property is optional and is used only when the document being created is PDF with the Image/Text overlay option. To create a PDF document with image/text overlay, perform the following steps:
SVG documents may or may not have a size. If a document has a size, it is stored in the width and height attributes of the root svg element and can be in any coordinate system. An SVG renderer will typically use this value to determine the final bounding rectangle of the document. SVG documents contain a hierarchy of elements. The final transformation (such as position and size) and style (such as color and fill) may depend on the transformation and style of the parent(s) inside the hierarchy. Calculations have to be done to keep track of this information when converting the SVG file. This procedure is defined by LEADTOOLS as flattening the document.
The DocumentSvgPage.Width and DocumentSvgPage.Height properties can be used to set a custom page size in inches. When the values are the default of 0, the framework will obtain the page width and height automatically from the ISvgDocument object set in SvgDocument when AddPage or InsertPage is called. If it is desired to create pages at a custom size, then simply set the values (in inches) in DocumentSvgPage.Width and DocumentSvgPage.Height before calling AddPage or InsertPage.
The LEADTOOLS Document Writer supports creating documents with zero or more empty pages inside them. Use AddPage or InsertPage with an DocumentEmptyPage with the dimension of the empty page set before hand in the DocumentOptions.EmptyPageWidth and DocumentOptions.EmptyPageHeight and its resolution set to DocumentOptions.EmptyPageResolution. As many empty pages as desired can be added in any index desired. To use empty pages, make sure the DocumentOptions.PageRestriction property is set to DocumentPageRestriction.Relaxed.
For more information, refer to PdfDocumentOptions.
For an example, refer to DocumentWriter.