PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

PdfSharp DrawString() format escaping
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2171
Page 1 of 1

Author:  abam [ Fri Oct 19, 2012 12:21 pm ]
Post subject:  PdfSharp DrawString() format escaping

Is there a way to escape to a different format with DrawString?

For example I might want to italicize v in the following:

string s = "A mathematical expression with a variable, \EscapeFormat{v} = \u03C1 ";
document.DrawString(s, point, format, escapeFormat[1]);

The unicode character specification goes fine with
XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode);

But the question is: is there a way to escape to other formats using DrawString?
Are there other methods that would let me do that, or do I need to invent an escape mechanism myself?

/regards

Author:  Thomas Hoevel [ Mon Oct 22, 2012 7:55 am ]
Post subject:  Re: PdfSharp DrawString() format escaping

Hi!
abam wrote:
Are there other methods that would let me do that, or do I need to invent an escape mechanism myself?
I'm afraid with PDFsharp you have to do the escaping yourself.
With MigraDoc, you can use AddFormattedText - or use the MDDDL format.
http://www.pdfsharp.net/wiki/MigraDocDDL.ashx

AFAIK you can read paragraphs from MDDDL, so your strings would have to be MDDDL paragraphs to keep parsing simple.
Or use your own escaping and convert the string to an MDDDL paragraph.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/