将文本框值转换为vb.net中的pdf文档 [英] To convert text box value to a pdf Document in vb.net

查看:124
本文介绍了将文本框值转换为vb.net中的pdf文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过点击按钮获取文本框的一些字符串输入到pdf文档







i从网上获取代码


Im trying to get some string input of a textbox to a pdf document on a button click



i got a code from net

Dim pdf As PdfDocument = New PdfDocument
       pdf.Info.Title = "My First PDF"
       Dim pdfPage As PdfPage = pdf.AddPage
       Dim graph As XGraphics = XGraphics.FromPdfPage(pdfPage)
       Dim font As XFont = New XFont("Verdana", 20, XFontStyle.Bold)
       graph.DrawString(Convert.ToString(txtdata.Text), font, XBrushes.Black, _
       New XRect(0, 0, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center)
       Dim pdfFilename As String = "firstpage.pdf"
       pdf.Save(pdfFilename)
       Process.Start(pdfFilename)







pdf文件的输出只是一行(其他数据被修剪)...不是段落格式... 。



我的(txtdata.text)可能包含至少2页的文字..



还有其他方法吗?如果有的话请一步一步格式化。



提前感谢您



[注:否需要水晶报告]




the output of pdf file is just in a single line (other data got trimmed)...not in paragraph format....

My (txtdata.text) may contain at least 2 pages of text ..

is there any other way ?? if so please provide me step by step format.

thanking you in advance

[Note: no need of crystal report]

推荐答案

这篇关于将文本框值转换为vb.net中的pdf文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆