将文件导出为pdf. [英] export files to pdf.

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

问题描述

伙计们.

我将文件导出为pdf时遇到问题.


我有此代码.

hi guys.

i have a problem in exporting my files to pdf.


i have this code.

Protected Sub btnReportPDF_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReportPDF.Click
        Response.ContentType = "application/pdf"
        Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf")
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Dim sw As New StringWriter()
        Dim hw As New HtmlTextWriter(sw)
        GridView1.AllowPaging = False
        GridView1.DataBind()
        GridView1.RenderControl(hw)
        Dim sr As New StringReader(sw.ToString())
        Dim pdfDoc1 As New Document(PageSize.A3, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 0.0F)
        Dim htmlparser As New HTMLWorker(pdfDoc1)
        PdfWriter.GetInstance(pdfDoc1, Response.OutputStream)
        pdfDoc1.Open()
        htmlparser.Parse(sr)
        pdfDoc1.Close()
        Response.Write(pdfDoc1)
        Response.End()
    End Sub 



而且我在这方面有问题.



and i have a problem in this line.

Line 697:        Dim pdfDoc1 As New Document(PageSize.A3, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 0.0F)
Overload resolution failed because no accessible 'New' accepts this number of arguments.

我希望您能在此问题上为我提供帮助

谢谢!
天哪.

-chaosgray-

i hope you can help me in this matter

thank you!
godbless.

-chaosgray-

推荐答案

该错误表示所说的内容.你是程序员吗?您是否检查过Document类期望什么参数?我肯定知道您输入的参数数量错误.
The error means what is says. Are you a programmer ? Have you checked what arguments the Document class expects ? I know for sure you have the wrong number of arguments.


从异常来看,这仅意味着您需要检查该行上的参数数量.
Judging from the exception, it simply means that you need to check on the number of arguments on that line. Probably a Google[^] on the error might help.


这篇关于将文件导出为pdf.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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