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

Problems with Printing Tabs and crlf
https://forum.pdfsharp.net/viewtopic.php?f=2&t=564
Page 1 of 1

Author:  7of42 [ Fri Dec 05, 2008 11:10 am ]
Post subject:  Problems with Printing Tabs and crlf

Hello,

I have written an website where the user can edit small texts inside an asptextbox. I also enabled the textbox to use the tab-key inside the textbox. Trying to print these texts with pdfsharp I run into two Problems.

1) The crlf is ignored by the drawsting method
oGr.DrawString(sPrintString, fnV9, Brushes.Black, 20, iStart) simply writes one long line of text on the page.
I can solve these problem by spliting the text and print als n-Strings so this is my smaller problem.

2) The bigger problem is, the the size of the tabs is very small in the pdf output. So the print does not look like the text on the Website. I tryed to replace the tabs by spaces ( Chr(160) ) but if I use the messure string method I get a width of 0 for a space.
fsSize = oGr.MeasureString(Chr(160), fnV9, sfFormat)

I would be happy about every tip.

Thanks

7of42

Author:  Soldier-B [ Fri Dec 05, 2008 1:57 pm ]
Post subject: 

The space character is Chr(32) or the string literal " " not Chr(160).

As far as replacing tabs go, I would figure out how many spaces they use up (usually 4 or 5) and use Strings.StrDup(CharCount, " ").

Author:  7of42 [ Fri Dec 19, 2008 9:08 am ]
Post subject:  Thanks

Hello Soldier-B ,

thanks, for your help. It works now but it works not perfect.

Greetings

7of42

PS I don´t know why but I have not received an email when you answered my question.

Author:  Thomas Hoevel [ Thu Jan 08, 2009 10:01 am ]
Post subject:  Re: Thanks

Hello!
7of42 wrote:
PS I don´t know why but I have not received an email when you answered my question.

I receive these emails.
You can enable this option for any post. The default setting is in your profile.

Re: Formatting
PDFsharp is low level, MigraDoc is high level.
If you want to deal with Tabs you'd better use MigraDoc. Tabs work similar to those in Word: left, right, decimal, or center alignment, individual positions or default tabs.

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