AddTextBlock
PowerScript function
Description
Adds a text block to the current PDFRichText object.
Applies to
PDFRichText object in Objects and Controls
Syntax
|
1 |
AddTextBlock(PDFTextBlock textBlock) |
|
1 |
PDFTextBlock AddTextBlock(string text) |
|
1 |
PDFTextBlock AddTextBlock(string text, PDFFont font) |
|
1 |
PDFTextBlock AddTextBlock(string text, PDFFont font, PDFColor textColor) |
|
1 |
PDFTextBlock AddTextBlock(string text, PDFColor textColor) |
|
1 |
PDFTextBlock AddTextBlock(string name, string text) |
|
1 |
PDFTextBlock AddTextBlock(string name, string text, PDFFont font) |
|
1 |
PDFTextBlock AddTextBlock(string name, string text, PDFFont font, PDFColor textColor) |
|
1 |
PDFTextBlock AddTextBlock(string name, string text, PDFColor textColor) |
|
Argument |
Description |
|---|---|
|
textBlock |
The PDFTextBlock object to be added in the current |
| text | The text to be added in the current PDFRichText object. It is supported to pass an empty string to this argument. |
| font | The font of the text to be added in the current PDFRichText object. |
| color | The color of the text to be added in the current PDFRichText object. |
| name | The name of text to be added in the current PDFRichText object. It is supported to pass an empty string to this argument. |
Return value
PDFTextBlock object in Objects and Controls. Returns the
PDFTextBlock object created in the PDFRichText object if it succeeds, or
null if it fails.
Usage
PDFTextBlock is a formatted text block, and must be used with the
PDFRichText object, for organizing and managing the content in
PDFRichText. When text is added in to a PDFRichText object,a PDFTextBlock
object is created for the text in the PDFRichText object.
Examples
This example adds a PDFTextBlock object to the lpdf_rtext
(PDFRichText) object using the syntax AddTextBlock(PDFTextBlock
textBlock).
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
PDFdocument lpdf_doc PDFpage lpdf_page PDFrichtext lpdf_rtext PDFtextblock lpdf_block lpdf_doc = create PDFdocument lpdf_page = create PDFpage lpdf_rtext = create PDFrichtext lpdf_block = create PDFtextblock lpdf_block.content = "add textblock" lpdf_block.textcolor.r = 255 lpdf_rtext.width = lpdf_page.getwidth( ) lpdf_rtext.addtextblock( lpdf_block) lpdf_page.addcontent( lpdf_rtext) lpdf_doc.addpage( lpdf_page) lpdf_doc.save( "D:save ichtext_addtextblock.pdf") |
This example directly adds text to the lpdf_rtext (PDFRichText)
object and sets the text font, color, and size using the syntax
PDFTextBlock AddTextBlock(string text, PDFFont font, PDFColor
textColor).
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
PDFdocument lpdf_doc PDFpage lpdf_page PDFrichtext lpdf_rtext PDFfont lpdf_font PDFcolor lpdf_color String ls_text lpdf_doc = create PDFdocument lpdf_page = create PDFpage lpdf_rtext = create PDFrichtext lpdf_font = create PDFfont lpdf_color = create PDFcolor lpdf_rtext.width = lpdf_page.getwidth( ) ls_text = "Addtextblock text" lpdf_font.fontname = "simsunb" lpdf_font.fontsize = 32 lpdf_color.rgb = rgb(255,0,0) lpdf_rtext.addtextblock(ls_text,lpdf_font,lpdf_color) lpdf_page.addcontent( lpdf_rtext) lpdf_doc.addpage( lpdf_page) lpdf_doc.save( "D:save ichtext_addtextblock.pdf") |
This example adds text to the lpdf_rtext (PDFRichText) object and
sets the text name, font, color, and size using the syntax PDFTextBlock
AddTextBlock(string name, string text, PDFFont font, PDFColor
textColor).
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
PDFdocument lpdf_doc PDFpage lpdf_page PDFrichtext lpdf_rtext PDFfont lpdf_font PDFcolor lpdf_color String ls_text lpdf_doc = create PDFdocument lpdf_page = create PDFpage lpdf_rtext = create PDFrichtext lpdf_font = create PDFfont lpdf_color = create PDFcolor lpdf_rtext.width = lpdf_page.getwidth( ) ls_text = "Addtextblock(string name,string text) text" lpdf_font.fontname = "simsunb" lpdf_font.fontsize = 32 lpdf_color.rgb = rgb(255,0,0) lpdf_rtext.addtextblock("block",ls_text,lpdf_font,lpdf_color) lpdf_page.addcontent( lpdf_rtext) lpdf_doc.addpage( lpdf_page) lpdf_doc.save( "D:save ichtext_addtextblock.pdf") |
See also