Ebh_Finans
December 13, 2006, 10:07:57
I try to print a RTF document loaded into a ServerTextControl. It is two pages containing images and text. The only output on the paper is one image, not positioned properly. The rest is blank.
I'm using a trial version of TxTextControl version 13.0
Am I missing some initialization?
Here is the print code:
private static ServerTextControl serverText = new ServerTextControl();
static void Main(string[] args)
{
string printerName = @"..";
string fileName = @"..";
serverText.Create();
serverText.Load(fileName, StreamType.RichTextFormat);
PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += new PrintPageEventHandler(printDocument_PrintPage);
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = printerName;
printDocument.PrinterSettings = printerSettings;
PageSettings pageSettings = new PageSettings(printerSettings);
printDocument.DefaultPageSettings = pageSettings;
printDocument.Print();
}
private static int currentPage = 1;
static void printDocument_PrintPage(object sender, PrintPageEventArgs e)
{
serverText.Print(currentPage, e);
currentPage++;
e.HasMorePages = currentPage <= serverText.Pages;
}
I'm using a trial version of TxTextControl version 13.0
Am I missing some initialization?
Here is the print code:
private static ServerTextControl serverText = new ServerTextControl();
static void Main(string[] args)
{
string printerName = @"..";
string fileName = @"..";
serverText.Create();
serverText.Load(fileName, StreamType.RichTextFormat);
PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += new PrintPageEventHandler(printDocument_PrintPage);
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = printerName;
printDocument.PrinterSettings = printerSettings;
PageSettings pageSettings = new PageSettings(printerSettings);
printDocument.DefaultPageSettings = pageSettings;
printDocument.Print();
}
private static int currentPage = 1;
static void printDocument_PrintPage(object sender, PrintPageEventArgs e)
{
serverText.Print(currentPage, e);
currentPage++;
e.HasMorePages = currentPage <= serverText.Pages;
}