新聞中心
VB.net2010 窗體中文本框以及圖片框中內(nèi)容保存為pdf文件
我一般都用aspose.word.dll來(lái)完成
我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、站前ssl等。為數(shù)千家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的站前網(wǎng)站制作公司
先把文本框類容和圖片存到word里面,然后把word專程pdf
這種方法很靈活也很生動(dòng),比直接生成pdf好多了
給你的附件有vb.net的例子還有aspose.word的dll檔案
例子是從官網(wǎng)下的,我就是用這些例子學(xué)的,很簡(jiǎn)單。現(xiàn)在我很多項(xiàng)目需要生成pdf都是用這個(gè)完成的。
VB.net點(diǎn)擊按鈕后截圖,截取被當(dāng)前窗體擋住的圖像作為窗體背景(窗體默認(rèn)無(wú)邊框樣式)
'沒(méi)辦法,需的把窗口隱藏一下,還的隱藏后延遲一下再截圖。
Dim?WithEvents?Timer1?As?New?Timer?With?{.Interval?=?30,?.Enabled?=?False}
Dim?Imgrect?As?Rectangle
Dim?img?As?Bitmap
Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click
Imgrect?=?Me.RectangleToScreen(Me.ClientRectangle)
img?=?New?Bitmap(Imgrect.Width,?Imgrect.Height)
Me.Hide()
Timer1.Start()
End?Sub
Private?Sub?Timer1_Tick(ByVal?sender?As?Object,?ByVal?e?As?System.EventArgs)?Handles?Timer1.Tick
Timer1.Stop()
Graphics.FromImage(img).CopyFromScreen(Imgrect.X,?Imgrect.Y,?0,?0,?Imgrect.Size)
Me.BackgroundImage?=?img
Me.Show()
End?Sub
vb.net 導(dǎo)出PDF
利用DataWindow.net在 vb.net 下導(dǎo)出PDF格式文件
利用datawindow.net,導(dǎo)出PDF文件,實(shí)現(xiàn)前提:
1.安裝Acrobat Distiller虛擬打印機(jī),注意要用datawindow.net提供的打印驅(qū)動(dòng),在c:\program files\sybase\datawindow.net2.0\driver中,在文章最后,我會(huì)提供一個(gè)靜態(tài)安裝虛擬打印機(jī)的批處理文件,方便安裝。
2.安裝Ghostscript 7.05 ,在網(wǎng)上找,免費(fèi)的。
3.導(dǎo)出PDF文件前,一要指定虛擬打印機(jī)名,其次導(dǎo)出格式為PDF(Export.PDF.Method=Distill!),另外還要指定 PDF.Distill.CustomPostScript=Yes。
具體代碼如下:
''' summary
''' 導(dǎo)出文件
''' /summary
''' param name="sender"/param
''' param name="e"/param
''' remarks/remarks
Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click
Try
Dim strFilename, strPrinter As String
Dim saveDg As New SaveFileDialog
strPrinter = Me.dwPrint.Describe("DataWindow.Print.PrinterName")
saveDg.FileName = Me.dwPrint.Tag.ToString
saveDg.Filter = "Pdf文件|*.pdf|Excel文件|*.xls|所有文件|*.*"
If saveDg.ShowDialog = Windows.Forms.DialogResult.OK Then
strFilename = saveDg.FileName
If strFilename.IndexOf(".pdf") 0 Then
Me.dwPrint.Modify("DataWindow.Print.PrinterName='Acrobat Distiller'")
Me.dwPrint.Modify("DataWindow.Export.PDF.Method=Distill!")
Me.dwPrint.Modify("DataWindow.Export.PDF.Distill.CustomPostScript=Yes")
Me.dwPrint.SaveAs(strFilename, Sybase.DataWindow.FileSaveAsType.Pdf, True)
ElseIf strFilename.IndexOf(".xls") 0 Then
Me.dwPrint.SaveAs(strFilename, Sybase.DataWindow.FileSaveAsType.Excel, True)
End If
Me.dwPrint.Modify("DataWindow.Print.PrinterName='" + strPrinter + "'")
MessageBox.Show("導(dǎo)出成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
4 批處理文件(實(shí)現(xiàn)靜默安裝)
vb.net 2008 如何將指定的窗體截圖并保存
INTOUCH自帶的就有,打印屏幕的命令
自己寫(xiě)個(gè)時(shí)間條件運(yùn)行那命令就可以了
PRINTSCREEN這個(gè)命令 具體怎么用 看下幫助
希望我的回答對(duì)你有所幫助
如有其他問(wèn)題,可以繼續(xù)追問(wèn),您的采納是我前進(jìn)的動(dòng)力!
本文題目:vb.net截圖pdf,vb截圖代碼
網(wǎng)址分享:http://ef60e0e.cn/article/hcoied.html