Apitron.PDF.Kit library for .NET
Assembly: Apitron.PDF.Kit (in Apitron.PDF.Kit.dll) Version: 2.0.37.0 (2.0.37.0)
List containing markup elements, if it fails to parse the given text it will contain the TextBlock initialized using the text parameter.
Given that markup text is in XML format and its parsing will be done by XML-aware utils, entries which don't exist in XML like should be entered differently.
So instead of <tag> mytext. </tag> the following entities will produce the same result:
//This is sample markup with element that links to our website and has bold style set.
document.StyleManager.RegisterStyle(".b",new Style(){Font = new Font("HelveticaBold",10)});
Section section = new Section(ContentElement.FromMarkup("<b link='www.apitron.com'> bold </b>"));
document.Add(section);
Creates a collection of elements using given text as markup. The markup looks similar to XML markup, given that each element will have its Class property assigned to the name or a set of names of the enclosing tags.
The resulting list will contain parsed content elements(mostly textblocks) with assigned classes.
A markup element can contain the following attributes:
- link, affects the Link property of the created element. If link destination starts with # then it will be considered as a CrossReference otherwise as a LinkUri. There is an additional attribute supported, href that works exactly the same.
- Bookmark, affects the Bookmark property of the created element.
- Id, affects the Id property of the created element, so it can be linked to.
- elementType, sets the target content element type, currently supported values are: section, image. This attribute makes it possible to create sections containing other elements or define some of the elements as images.
- <img>, can be used for putting images, e.g. <img src='[path to file or resource id]' width='[image width][unit]' height='[image height][unit]'/> creates Image element entry. Unit can be omitted or can be one of the following: auto|pt|in|px|cm|%.
- <br/>, creates Br element entry.
- <div/>,<ol/>,<ul/>, create Section element entry.
Namespace: Apitron.PDF.Kit.FlowLayout
Assembly: Apitron.PDF.Kit (in Apitron.PDF.Kit.dll) Version: 2.0.37.0 (2.0.37.0)
Syntax
Parameters
- text
- Type: SystemString
The text to parse.
Return Value
Type: IListContentElementList containing markup elements, if it fails to parse the given text it will contain the TextBlock initialized using the text parameter.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | If text is null. |
Remarks
- <tag> mytext. </tag>
- <tag> mytext.&nbsp</tag>
Examples
See Also