Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
Last month, a new property named TextRise
was added to the PDFTextFormatter
of PDFOne .NET. PDFTextFormatter
is used with the basic PDFDocument.WriteText(string)
method. The TextRise
can be used to write text with superscript or subscript styles.
Here is the code for it.
// Create a font instance PDFFont fntConsolas = new PDFFont("Courier New", FontStyle.Underline, 15); // Create a text formatter instance PDFTextFormatter tf = new PDFTextFormatter(); // Create a new document and add a page to it PDFDocument doc = new PDFDocument(PDFOne_License.KEY); PDFPage pg = new PDFPage(System.Drawing.Printing.PaperKind.A4, 1, 1, 1, 1); doc.AddPage(pg); // Write text in regular style tf.TextRise = 0f; doc.WriteText("Dettol® = C8H9ClO or Dettol", fntConsolas, tf); // Write superscript text tf.TextRise = 4f; doc.WriteText("®", fntConsolas, tf); tf.TextRise = 0f; doc.WriteText(" = C", fntConsolas, tf); // Write subscript textxt tf.TextRise = -3f; doc.WriteText("8", fntConsolas, tf); // reset tf.TextRise = 0; doc.WriteText("H", fntConsolas, tf); // subscript again tf.TextRise = -3f; doc.WriteText("9", fntConsolas, tf); // res... all right, you get the idea! tf.TextRise = 0; doc.WriteText("ClO", fntConsolas, tf); doc.Save(@"test.pdf"); doc.Close();
Hopefully, you will be using the TextRise
as part of some text-processing routine, not hand-coding each bit like this.
---o0O0o---
Our .NET Developer Tools | |
---|---|
Gnostice Document Studio .NETMulti-format document-processing component suite for .NET developers. |
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
Our Delphi/C++Builder developer tools | |
---|---|
Gnostice Document Studio DelphiMulti-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms. |
eDocEngine VCLA Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools. |
PDFtoolkit VCLA Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents. |
Our Java developer tools | |
---|---|
Gnostice Document Studio JavaMulti-format document-processing component suite for Java developers. |
PDFOne (for Java)A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications. |
Our Platform-Agnostic Cloud and On-Premises APIs | |
---|---|
StarDocsCloud-hosted and On-Premises REST-based document-processing and document-viewing APIs |
Privacy | Legal | Feedback | Newsletter | Blog | Resellers | © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved. |