ASP.NET - Distortion when outputting text and drawing lines

  • Hi,

    We are having problems with wPDF 2.3.1441.28155 & wPDFControl02 2.9.4.3 in ASP.NET 1.1. I have included a simple example below that exhibits the error.

    We are trying to print a report with grid lines around the text giving the look of a table. We can, separately, print the text correctly and print the grid lines correctly. However, when we try to print the two together the page becomes distorted. The height of the output text increases and the width decreases, as if the resolution is changing.

    If the line to draw has no dimensions the error does not occur: lPrinter.Canvas.Drawline(lPen, 1, 1, 1, 1). The problem occurs using TextOut or DrawString.

    Help would be appreciated.
    <pre>
    ---------------------------------------------------------
    procedure CreatePdf;
    const
    cFileName = 'C:\Inetpub\wwwroot\wPdfTest\wPdfTest.pdf';
    var
    lPrinter: wPDF.PDFControl;
    lPen: &Pen;
    lBrush: &SolidBrush;
    i: Integer;
    begin
    lPrinter:= wPDF.PDFControl.Create;
    lPrinter.SetLicense('X', 'X', 0);
    lPrinter.InfoTitle:= 'wPDF Test';
    lPrinter.FileName:= cFileName;
    if not lPrinter.BeginDoc then
    begin
    raise exception.Create('Cannot begin doc');
    end
    else
    begin
    lPrinter.StartPage;
    lPen:= &Pen.Create(Color.Black, 1);
    lBrush:= &SolidBrush.Create(Color.Black);
    for i:= 1 to 40 do
    begin
    lPrinter.Canvas.DrawLine(lPen, 1, 1, 10, 1);
    lPrinter.TextOut('I am item ' + i.ToString, 10, i*12);
    //lPrinter.Canvas.DrawString('I am item ' + i.ToString, lPrinter.Font.Font, lBrush, 10, i*12);
    end;

    lPrinter.EndPage;
    lPrinter.EndDoc;
    end;

    HttpContext.Current.Response.Write('<br>PDF generated: ' + cFileName);
    end;

    ---------------------------------------------------------
    </pre>