How to set the page size to Envelope size with Landscape orientation?

前端 未结 2 679
-上瘾入骨i
-上瘾入骨i 2020-12-12 04:09

I have problem on creating .pdf file with the Page settings as Envelope ,landscape format.

Here is my Code to convert the asp page into pdf in Itextsharp

<         


        
2条回答
  •  时光说笑
    2020-12-12 04:47

    I want to generate multiple pdf by using this code but it is generating only one PDF ... then going to catch block, Please give solution of this problem.

    Response.ContentType = "application/pdf";
    Response.AddHeader("content-disposition", "attachment;filename=" + begin + ".pdf");
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    StringWriter sw = new StringWriter();
    HtmlTextWriter hw = new HtmlTextWriter(sw);
    Panel1.RenderControl(hw);
    StringReader sr = new StringReader(sw.ToString());
    Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
    HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
    PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
    pdfDoc.Open();
    htmlparser.Parse(sr);
    pdfDoc.Close();
    Response.Write(pdfDoc);
    Response.End();
    

提交回复
热议问题