问题描述
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader
(Content-Disposition,attachment; filename = iTextSharpExample。 pdf);
HttpContext.Current.Response.Charset =;
HttpContext.Current.Response.ContentType =application / pdf;
StringWriter stringwrite = new StringWriter();
HtmlTextWriter htmlwrite = new HtmlTextWriter(stringwrite);
dvText.RenderControl(htmlwrite);
StringReader sr = new StringReader(stringwrite.ToString());
文件pdfDoc =新文件(PageSize.A4,50,50,25,25);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc,Response.OutputStream);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
什么我试过了:
我正在尝试下载带有照片的身份证的pdf文件,但没有打开pdf它的显示错误无法加载PDF文档。
您已经在 []
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader
("Content-Disposition", "attachment;filename=iTextSharpExample.pdf");
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/pdf";
StringWriter stringwrite = new StringWriter();
HtmlTextWriter htmlwrite = new HtmlTextWriter(stringwrite);
dvText.RenderControl(htmlwrite);
StringReader sr = new StringReader(stringwrite.ToString());
Document pdfDoc = new Document(PageSize.A4, 50, 50, 25, 25);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
What I have tried:
I am trying to download pdf file of ID Card with photo but not open the pdf its shoing error "Failed to load PDF document."
这篇关于我正在尝试下载带有照片的身份证的pdf文件,但没有打开pdf,其显示错误“无法加载PDF文档。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!