The GraphicsProxy adds too much space between each line for multi-line strings. I'm using version 17.2.20172.2006.
Passing in string "a\r\nb" ends up looking like "a\r\n\r\nb" (Shown in PDF). The method in question is below. Any ideas?
public void DrawString(string s, System.Drawing.Font font, System.Drawing.Brush brush, float x, float y, System.Drawing.StringFormat format)
if (s == null) throw new ArgumentNullException("s");
if (font == null) throw new ArgumentNullException("font");
if (brush == null) throw new ArgumentNullException("brush");
_graphics.Font = GetFont(font);
_graphics.Brush = GetBrush(brush);
float h = _memoryGraphics.MeasureString(s, font).Height;
CharBuffer cb = new CharBuffer();
foreach (char ch in s)
if (ch == '\r') continue;
if (ch == '\n')
if (cb.Count > 0)
_graphics.DrawString(x, y, cb.ToString());
y += h;
if (cb.Count > 0) _graphics.DrawString(x, y, cb.ToString());
Thank you for posting to our forum.
I followed the steps you suggested and was unable to reproduce the behavior you're describing.
I have created a sample of the document engine for a single text element. To the text element, i applied the textpattern which has a property called interval which manages the space. When I do not set the interval I was not getting any exact line space in the text but when I set it , (as demonstrated in the sample ) it does provide the extra line space, which is expected.
So I would like to know if you did set the interval property and that is why getting extra line space?
I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, then the change in behavior is due to differences in your environment from mine and these differences can be anything from operating system version to the specific version of the Infragistics DLL versions used. My test was performed using version 17.2.20172.2006. Please provide more details about your machine and version of the assemblies that you are referencing so that I can modify the environment that I am testing in to match yours.
If the project does show the product feature working correctly, then more information will be needed to reproduce the issue in a sample that can be used for debugging. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing. This can be done by either making the sample that I provided more like your application or by isolating the behavior from your application by removing dependencies on any third parties or databases.
Please let me know if I can provide any further assistance.
Sincerely,Divya JainAssociate Software Developer
I'm not using the Section to add text to the report. I am using the GraphicsProxy created via Canvas.CreateGraphics(). I attached a sample reproducing the problem.
Thanks for your help.
Just out of curiosity, why draw text into a canvas? You will lose a lot of functionality that way. Users will not be able to copy/paste the text, for example. It also won't show up in a search.I realize that does not address your question, of course. I've looked at your sample project and the behavior does seem odd, so we will probably need to write this up for developer review.
We use the Documents.Report object strictly as a tool for creating a pdf. We have our own reporting objects that handle drawing to a Graphics object. Our reporting objects were originally used for drawing to the screen graphics and printing graphics. A requirement was added to create a pdf. Our implementation uses the Canvas to create a Graphics object and the Graphics object is passed through the reporting objects that draw to it. At the end the Publish method is called on the Report object and we end up with a pdf through this simple implementation.
Thank you for the update.
I am able to reproduce the behavior you described using the sample you provided.
I have submitted this development issue for further investigation (256978) and have created a private case (CAS-197719-V2D2K6) where I will provide you further information and attached this development issue.
You can find this private case in your support-activity page.
I will also follow up on the thread with the development issue resolution after the development team has looked into it.
Meanwhile if you have any further question or concern on this matter please let me know.