1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Generate PDF ?

Generate PDF ?

4 posts, 0 answered
  1. Mark
    Mark avatar
    86 posts
    Registered:
    08 Feb 2010
    22 Apr 2010
    Link to this post
    Hi

    I need to create a user control which generates a PDF file
    are is this possible with a standard v3.2 SP2 sitefinity installation (i.e. are there any DLL's i can use or any .net stuff i can use)

    I dont have access to dump DLL's into the bin folder, so ideally i need to just be able to upload a ASCX usercontrol

    what would you suggest I do

    Thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    22 Apr 2010
    Link to this post
    Hi Dave,

    There are no built-in methods that you can use to generate a PDF file. You need to use standard ASP.NET methods or external class library

    pseudo code

    Page page = this.Page;
        page.SetRenderMethodDelegate(new RenderMethod(this.PdfExportRenderPage));
        page.PreRender += new EventHandler(page_PreRender);
     
    private void PdfExportRenderPage(HtmlTextWriter nullWriter, Control page)
    {
        HtmlForm result = null;
        result = this.Page.Form;
        result.SetRenderMethodDelegate(new RenderMethod(this.PdfExportRenderForm));
        HtmlTextWriter dummyWriter = new HtmlTextWriter(TextWriter.Null);
        result.RenderControl(dummyWriter);
    }
     
    private void PdfExportRenderForm(HtmlTextWriter nullWriter, Control form)
    {
     
        Page page = this.Page;
        HttpResponse response = page.Response;
        string contentType = "application/pdf";
        string fileExtension = ".pdf";
        XmlDocument doc = new XmlDocument();
        string xml = "test";
    }


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Mark
    Mark avatar
    86 posts
    Registered:
    08 Feb 2010
    22 Apr 2010
    Link to this post
    Thanks Ivan

    If I was able to put a DLL into the Bin folder on the server, which component would you suggest?

    There wont be a new build of the site so it will have to be a simple copy DLL to bin, and upload ascx and ascx.vb

    Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    22 Apr 2010
    Link to this post
    Hi Dave,

    You could take a look at http://www.codeproject.com and http://www.developerfusion.com for some third party class libraries.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 0 answered