在VB.NET 2005中生成PDF

时间:2009-05-16 14:40:57

标签: vb.net pdf-generation

我在生成PDF文档时遇到问题,我想在PDF文档中显示的文本超出了PDF文档范围。如何调整文本以适合页面范围?

这是我的代码示例,其中显示了一些问题和答案:

    Dim PDF As PDFCreatorPilotLib.PDFDocument3
    ' create pdf library object
    PDF = New PDFCreatorPilotLib.PDFDocument3
    ' initialize PDF Engine
    PDF.StartEngine("demo@demo", "demo")
    ' set filename

    PDF.FileName = "TestVB.PDF"
    PDF.AutoLaunch = True ' auto-open generated pdf document

    ' start document generation
    PDF.BeginDoc()

    PDF.PDFPAGE_SetActiveFont("Verdana", True, False, False, False, 9, 0)
    PDF.PDFPAGE_TextOut(80, 270, 0, Label5.Text)
    PDF.PDFPAGE_TextOut(100, 270, 0, Questions1TextBox.Text)
    PDF.PDFPAGE_TextOut(80, 300, 0, Label3.Text)
    PDF.PDFPAGE_TextOut(100, 300, 0, Answers1TextBox.Text)

    PDF.PDFPAGE_TextOut(80, 330, 0, Label6.Text)
    PDF.PDFPAGE_TextOut(100, 330, 0, TextBox14.Text)
    PDF.PDFPAGE_TextOut(80, 360, 0, Label4.Text)
    PDF.PDFPAGE_TextOut(100, 360, 0, TextBox1.Text)

    PDF.PDFPAGE_TextOut(80, 390, 0, Label7.Text)
    PDF.PDFPAGE_TextOut(100, 390, 0, TextBox12.Text)
    PDF.PDFPAGE_TextOut(80, 420, 0, Label4.Text)
    PDF.PDFPAGE_TextOut(100, 420, 0, TextBox1.Text)

    ' finalize document generation
    PDF.EndDoc()
End Sub

0 个答案:

没有答案