我们从PrintDocument
保存pdf时,可以获得pdf格式的图像
这里我添加了一个图片框,按钮,打印文档,打印预览对话框
打印文件
代码:
Public Class Form2
Private Sub PrintDocument2_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument2.PrintPage
Dim XPos, YPos As Long
XPos = 300
YPos = 20
Dim MyFont As New Font("Arial", 18)
e.Graphics.DrawString("Stack Overflow is Best", MyFont, Brushes.Black, XPos + 30, YPos)
YPos += 50
YPos += 75
MyFont = New Font("Arial", 12)
e.Graphics.DrawImage(PictureBox2.Image, XPos - 200, YPos + 50, 300, 300)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PrintPreviewDialog2.ShowDialog()
End Sub
End Class
但当我保存该文件并打开它不包含图片。
1条答案
按热度按时间nwnhqdif1#
也许您可以将图像保存在本地,然后打印出来。