Html to PDF with page break

Last post 05-17-2007, 8:00 AM by rompre. 6 replies.
Sort Posts: Previous Next
  •  02-14-2006, 11:29 PM 15933

    Html to PDF with page break

    Is there a way to specify page breaks when using the save to pdf feature?  It just makes one really long page.
     
    Thanks,
    Zach
  •  02-15-2006, 2:46 PM 15967 in reply to 15933

    Re: Html to PDF with page break

    Adam...any thoughts?
     
    Also, I'm trying to get the pdf as a stream without having to save to a file.  I have tried the following:

    Dim test As New CuteEditor.Convertor.PDF.HTML2PDF("<b>test</b>")

    But when I try to access the PDF property it throws an error.  Am I doing something wrong?

    Many Thanks,
    Zach Parrish
     
  •  02-15-2006, 2:53 PM 15969 in reply to 15967

    Re: Html to PDF with page break

    Zach,
     
    I am discussing this issue with the developer who is responsible for the PDF part. And will post an update soon.

    >>Dim test As New CuteEditor.Convertor.PDF.HTML2PDF("<b>test</b>")

    >>But when I try to access the PDF property it throws an error.  Am I doing something wrong?

    Try:

    Dim test As New CuteEditor.Convertor.PDF.HTML2PDF("<html><body><b>test</b></body></html>")







     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  02-15-2006, 3:12 PM 15972 in reply to 15969

    Re: Html to PDF with page break

    Thanks Adam.  Keep me posted.
     
    I tried your suggestion above and it no longer throws an error.  It will now save the file properly if I call the Save() function, but the PDF property is empty.  Is there just not a way to get the pdf without saving it to disk first?
     
    Thank You,
    Zach
  •  02-15-2006, 3:19 PM 15973 in reply to 15972

    Re: Html to PDF with page break

    Zach,
     

    t= "<html><body>" + yourstring+ "</body></html>";
    CuteEditor.Convertor.PDF.HTML2PDF html2pdf = new CuteEditor.Convertor.PDF.HTML2PDF(t);
    html2pdf.Render();
    html2pdf.Save(yourpath);
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  02-15-2006, 3:33 PM 15974 in reply to 15973

    Re: Html to PDF with page break

    Right, that works fine, but I'm wanting to serve a pdf without having to save it to the hard drive.  I have a report that generates dynamically, and I would like a create pdf button that just takes that html and creates a byte array or something that I can just response.write to the client without having to save it.
     
    Thanks,
    Zach
  •  05-17-2007, 8:00 AM 29761 in reply to 15974

    Re: Html to PDF with page break

    The initial post is old, but try this :

    HttpContext
    .Current.Response.ClearContent();
    HttpContext.Current.Response.ClearHeaders();
    HttpContext.Current.Response.ContentType = "application/pdf";
    HttpContext.Current.Response.AppendHeader("content-disposition", "attachment; filename=" + fileName);
     
    System.IO.MemoryStream stmMemory = new System.IO.MemoryStream();
     

    CuteEditor.Convertor.PDF.HTML2PDF convertor = new CuteEditor.Convertor.PDF.HTML2PDF(Server.HtmlDecode(this.RTE.XHTML));

    convertor.RenderSinglePageContent = false;
    convertor.Render();

    convertor.Save(stmMemory);
     

    stmMemory.WriteTo(HttpContext.Current.Response.OutputStream);
    stmMemory.Close();
    stmMemory.Dispose();

    Response.End();
View as RSS news feed in XML