|
The following code adds a number of chunks of text to a
document. Each chunk is in a different style. This sample makes use
of the fact that the Pos is updated to point to the next text
insertion point after adding a piece of text. However note that
when inserting muti-styled text it is generally more efficient to
use the AddTextStyled method.
using var doc = new Doc();
doc.Page = doc.AddPage();
doc.FontSize = 48;
int font1 = doc.AddFont("Times-Roman");
int font2 = doc.AddFont("Times-Bold");
doc.Font = font1;
doc.AddText("Gallia est omnis ");
doc.Font = font2;
doc.AddText("tertiam Galli appellantur ");
doc.Font = font1;
doc.AddText("divisa in partes tres, ");
doc.Font = font2;
doc.AddText("quarum unam incolunt ");
doc.Font = font1;
doc.AddText("Belgae, aliam Aquitani. ");
doc.Font = font2;
doc.AddText("tertiam Galli appellantur");
doc.Save(Server.MapPath("docaddtext.pdf"));
Using doc As New Doc()
doc.Page = doc.AddPage()
doc.FontSize = 48
Dim theF1 As Integer = doc.AddFont("Times-Roman")
Dim theF2 As Integer = doc.AddFont("Times-Bold")
doc.Font = theF1
doc.AddText("Gallia est omnis ")
doc.Font = theF2
doc.AddText("tertiam Galli appellantur ")
doc.Font = theF1
doc.AddText("divisa in partes tres, ")
doc.Font = theF2
doc.AddText("quarum unam incolunt ")
doc.Font = theF1
doc.AddText("Belgae, aliam Aquitani. ")
doc.Font = theF2
doc.AddText("tertiam Galli appellantur")
doc.Save(Server.MapPath("docaddtext.pdf"))
End Using

docaddtext.pdf
Also see example code in: ABCpdf Deletion Example,
ABCpdf Headers and
Footers Example, ABCpdf Landscape
Example, ABCpdf
Unicode Example, ABCpdf eForm Placeholder
Example, ABCpdf
eForm FDF Example, ABCpdf Advanced
Graphics Example, ABCpdf Fields, Markup and
Movies Example, Doc AddBookmark
Function, Doc AddColorSpaceFile
Function, Doc AddColorSpaceSpot
Function, Doc AddFont Function,
Doc AddPage Function, Doc Append Function, Doc
EmbedFont Function, Doc Read Function,
Doc RemapPages Method, Doc Save Function, Doc Encryption Property,
Doc Font Property, Doc FontSize Property, Doc Page Property, Doc Pos Property, Doc String Property, Doc TextStyle Property,
Doc TopDown Property,
Doc Transform Property,
XColor Alpha
Property, XEncryption
SetCryptMethods Function, XHtmlOptions
GetTagRects Function, XHtmlOptions
HtmlCallback Property, XPoint Point Property,
XRect Rectangle
Property, XRendering
AntiAliasPolygons Property, XRendering
AntiAliasText Property, XRendering IccCmyk
Property, XRendering SaveAlpha
Property, XTextStyle Bold
Property, XTextStyle
CharSpacing Property, XTextStyle HPos
Property, XTextStyle Indent
Property, XTextStyle Italic
Property, XTextStyle
Justification Property, XTextStyle
LeftMargin Property, XTextStyle
LineSpacing Property, XTextStyle Outline
Property, XTextStyle
ParaSpacing Property, XTextStyle Size
Property, XTextStyle Strike
Property, XTextStyle Strike2
Property, XTextStyle Underline
Property, XTextStyle VPos
Property, XTextStyle
WordSpacing Property, XTransform Invert
Function, XTransform Magnify
Function, XTransform Reset
Function, XTransform Rotate
Function, XTransform
AngleUnit Property,
FileSpecification FileSpecification Function, FontObject
Widths Property, Page
VectorizeText Function, Signature
Validate Function,
ArrayAtom FromContentStream Function,
XpsImportOperation Import Function,
SwfImportOperation Import Function,
WebPageOperation Doc Property.
|
|
|