Home > Blockchain >  itext7 in vb.net - Stamp rotated text on top of existing content
itext7 in vb.net - Stamp rotated text on top of existing content

Time:01-19

I have this code which places rotated text where I want it on a pdf:

 Public Sub edit_existing_pdf(inpdf As String, outpdf As String)

        Dim pdf As New PdfDocument(New PdfReader(inpdf), New PdfWriter(outpdf))

        Dim document As New Document(pdf)

        document.ShowTextAligned("This is some test text", 400, 750, TextAlignment.CENTER, VerticalAlignment.MIDDLE, 0.5F * CSng(Math.PI))

        document.Close()

    End Sub

It works fine on a 'blank' pdf, but it won't show when stamping on a pdf with existing content.

How can I set it to be 'over' stamped rather then 'under'?

CodePudding user response:

Final line of code as per mkl's help:

document.ShowTextAligned(New Paragraph("This is some test text").SetMultipliedLeading(1).SetMargin(0), 400, 750, 1, TextAlignment.CENTER, VerticalAlignment.MIDDLE, 0.5F * CSng(Math.PI))
  • Related