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

Truncating ampersands & and others
https://forum.pdfsharp.net/viewtopic.php?f=2&t=14
Page 1 of 1

Author:  robtester [ Wed Nov 01, 2006 9:40 pm ]
Post subject:  Truncating ampersands & and others

I have found that the XGraphicsRdfRenderer.DrawString() truncates strings when the string includes an & symbol( at the &). It also will remove + character from a string (I am sure there are others characters that give strange behavior as well). Is there a way to get these symbols to display on the PDF? What is the list of special characters that will not display?

Rob.

Author:  Stefan Lange [ Thu Nov 02, 2006 9:06 pm ]
Post subject: 

Hello,

the class XGraphicsPdfRenderer is not intended for beeing used directly in your code (it was public, but this was a mistake). Use only class XGraphics for drawing.

However, I cannot duplicate your observation. Please tell me more details.

>>What is the list of special characters that will not display?
By design there are no such characters.

Regards
Stefan Lange

Author:  robtester [ Thu Nov 02, 2006 9:18 pm ]
Post subject:  Truncating ampersands & and others

Actually, we are not calling the renderer directly. We traced the call back from XGraphics.DrawString. Given the snippet of code below if we try to draw the a string that contains "Hello & World" the pdf will contain "Hello". If we try "Hello + World" we get "Hello World". If we try "Hello World" we get "Hello World".

XGraphics gfx=XGraphics.FromPdfPage(doc.AddPage(new PdfPage()))

XStringFormat format = new XStringFormat();

format.Alignment=XStringAlignment.Center;
format.LineAlignment=XLineAlignment.Near;

gfx.DrawString(title1,
new XFont("Verdana",12,XFontStyle.Italic),
XBrushes.Black,
new XRect(TITLE_BOX_X,TITLE_BOX_Y,TITLE_BOX_WIDTH,TITLE_BOX_HEIGHT)
,format);

Author:  Stefan Lange [ Thu Nov 02, 2006 10:09 pm ]
Post subject: 

I believe you, but I have no idea. I tried the "Hello, World" sample and it works. There is no code that eats up special characters.

Please mail me the PDF file that your sample produces.

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