使用点网中的abc pdf将word文档转换为pdf [英] convert word document to pdf using abc pdf in dot net

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

问题描述

嗨朋友们,



如何将 Word文档转换为pdf excel转换为pdf ,< b> ppt到pdf使用 ABC PDFin dot net.i尝试但是它抛出了一些例外。请任何人都可以帮助我。



错误是

应用程序抛出异常:无法调用成员ExportAsFixedFormat - 由于意外错误导致导出失败。

Hi Friends,

how to convert the Word document to pdf ,excel to pdf,ppt to pdf using ABC PDFin dot net.i tried but its threws some exception.please any one can help me.

the Error is
Application threw an exception: Failed to invoke member "ExportAsFixedFormat"--The export failed due to an unexpected error.

推荐答案

嗨.. 。

我已经将检索到的数据绑定到表单加载中的标签。那个表单有一个按钮,名称是print(对于pdf)。

在那个print_click事件中:

Hi...
Am have bind the retrieved data to lables in form load. That form having one button, name is print(for pdf).
In that print_click event:
Response.ContentType = "application/pdf";
           Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
           Response.Cache.SetCacheability(HttpCacheability.NoCache);
           StringWriter sw = new StringWriter();
           HtmlTextWriter hw = new HtmlTextWriter(sw);
           pnlPerson.RenderControl(hw);
           StringReader sr = new StringReader(sw.ToString());
           //Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
           Document pdfDoc = new Document(PageSize.A3, 100f, 10f, 10f, 10f);
           HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
           PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
           pdfDoc.Open();
           htmlparser.Parse(sr);
           pdfDoc.Close();
           Response.Write(pdfDoc);
           Response.End();



它只会打开pdf格式。

谢谢你。


It wil opened pdf format only.
Thank u.


public void ConvertWordtoPdf()
    {
        Doc objDoc = new Doc();
        XReadOptions xr = new XReadOptions();
        xr.ReadModule = ReadModuleType.MSOffice;
        objDoc.Read("D:\\User\\Keerthana\\test.doc", xr);
        //objDoc.Read(Server.MapPath("D:\\User\\Keerthana\\test.doc"),xr);
        objDoc.Save("D:\\User\\Keerthana\\Projects\\PDF\\WordDocumentToPdftest.pdf");
        objDoc.Clear();
        xr.Dispose();
        objDoc.Dispose()
}




public void ConvertPPTtoPdf()
   {
       Doc theDoc=new Doc();
       //string pathPPT = "D:/User/Keerthana/DSSI_PPT.pptx";
       //theDoc.Read(pathPPT);
       theDoc.Read("D:\\User\\Keerthana\\DSSI_PPT.pptx");
       theDoc.Save("D:\\User\\Keerthana\\Projects\\PDF\\PPTToPdfDocument.pdf");
       theDoc.Clear();
       theDoc.Dispose();
   }




public void ConvertExceltoPdf()
   {

       Doc theDoc = new Doc();
       theDoc.Read("D:\\User\\Keerthana\\Exceldoc.xls");
       theDoc.Save("D:\\User\\Keerthana\\Projects\\PDF\\ExcelToPdfDocument.pdf");
       theDoc.Clear();
       theDoc.Dispose();
   }


这篇关于使用点网中的abc pdf将word文档转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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