Dear all,
I am using below code to export List<string> array into PDF. But find that there is a issue as shown in the attached file. It shows different in length in the dotnet debugger and in the PDF. But they are same length when I paste them into notepad. Is there any way to show correctly in the PDF??
Infragistics.Documents.Report.Table.ITable table = section.AddTable();Infragistics.Documents.Report.Table.ITableRow row = table.AddRow(); cell = row.AddCell(); text = cell.AddText(); text.Style = style1; text.AddContent(printLine);..................................................................this.report.Publish(fileName, FileFormat.PDF);
Both Visual Studio and Notepad use a Fixed-Width font (Courier New, I think) by default.
PDF probably defaults to a variable-width font like MS Sans Serif.
So change your export code to use a fixed width font like Courier new so that all of the characters are the same width.
Dear Mike,
If the words are in chinese, then no fixed width font. Is there any tools or library in infragistics that I can use?? As we find that when print to Epson T88IVM thermal printer, the output is in align even with chinese non-fixed width font.
Hi,
The issue you are having does not appear to have anything to do with Infragistics or the controls, it's just a question of the behavior of the fonts you are using.
Are you sure there are no fixed-width fonts in Chinese? I could be wrong, I know very little about Chinese, but I find that hard to beleive.
Are you saying that the same PDF document prints correctly aligned when you print on a particular printer?
Is it possible to use below method to solve variable-length font problems?? Boss give me!!!
private void Form1_Paint(object sender, PaintEventArgs e){String drawString = "Sample Text";// Create font and brush.Font drawFont = new Font("Arial", 16);SolidBrush drawBrush = new SolidBrush(Color.Black);// Create point for upper-left corner of drawing.PointF drawPoint = new PointF(150.0F, 150.0F);// Draw string to screen.e.Graphics.DrawString(drawString, drawFont, drawBrush, drawPoint);}
I can't see any reason why this code would be any different than writing text using Arial in the usual way. Arial is not a fixed-width font, though - at least I don't think it is. So I don't see how this would help.