iTextsharp - draw a line at the end and start of a page with tables

后端 未结 2 1933
無奈伤痛
無奈伤痛 2021-01-29 02:54

Selecting records from a table I create iTextsharp\'s Tables one for every first letter of the records

On the picture a table for the \"G\" letter:

\"G\" is a ro

2条回答
  •  梦毁少年i
    2021-01-29 03:51

    I found the solution, no new class required

    Dim heightActualLetter, verticalSpaceAvailable As Integer
    heightActualLetter = table.TotalHeight
    verticalSpaceAvailable = pdfWrite.GetVerticalPosition(False) - pdfDoc.BottomMargin
    If heightActualLetter > verticalSpaceAvailable Then
    
        Dim finalLine As PdfContentByte
        finalLine = pdfWrite.DirectContent
    
        Dim curY As Int32
        curY = pdfWrite.GetVerticalPosition(False)
    
        finalLine.SetLineWidth(0.5)
        finalLine.MoveTo(xStart, curY)
        finalLine.LineTo(xEnd + 1, curY)
        finalLine.Stroke()
    End If
    

    I don´t know why I need the +1 on xEnd + 1 but maybe is because of the other lines being 0.5 I need to rounded up

提交回复
热议问题