Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fredrik Esseen 608 posts 904 karma points
    Jun 24, 2009 @ 11:01
    Fredrik Esseen
    0

    Hi!

    I want to take the information from a field and dynamically create a pdf.

    Is it possible to use some sort of application and integrate that with Umbraco or has someone created a package with this?

  • rorythecheese 110 posts 56 karma points
    Jun 24, 2009 @ 11:59
    rorythecheese
    0

    Don't think there's a package yet, not that i've seen anyway. 

    Should be able to use this along with the umbraco api to do it though -> http://www.pdfsharp.com/PDFsharp/

  • Daniel.S 50 posts 135 karma points
    Jun 25, 2009 @ 06:08
    Daniel.S
    0

    I did a bit of Googling, but couldn't find the article I was looking before. Someone's done it before, as far as I recall.

    There's also this: http://fonet.codeplex.com/

  • Daniel.S 50 posts 135 karma points
    Jun 25, 2009 @ 06:08
    Daniel.S
    0

    Damn this non-editable post forum..... I meant "the article I was looking for"

  • Fredrik Esseen 608 posts 904 karma points
    Jun 25, 2009 @ 08:11
    Fredrik Esseen
    5

    Solved it!

    I use iTextSharp and HtmlToPdfBuilder: http://somewebguy.wordpress.com/2009/05/08/itextsharp-simplify-your-html-to-pdf-creation/

    Then its easy to, for instance attach it to a button. My Template then look like this:

    <%@ Import Namespace="PdfSharp" %>
    <%@ Import Namespace="PdfSharp.Pdf" %>
    <%@ Import Namespace="PdfSharp.Drawing" %>
    <%@ Import Namespace="PdfSharp.Pdf.IO" %>
    <%@ Import Namespace="System.Diagnostics" %>
    <%@ Import Namespace="umbraco.BusinessLogic" %>
    <%@ Import Namespace="umbraco.presentation.nodeFactory" %>
    <%@ Import Namespace="PDFBuilder" %>
    <%@ Import Namespace="System.IO" %>

    <%@ Master Language="C#" MasterPageFile="/masterpages/CWS_Master.master" AutoEventWireup="true" %>
    <script runat="server">

    protected void PdfButton_Click(object sender, EventArgs e)
     {

    Node currentNode = Node.GetCurrent();
    String bodyText = currentNode.GetProperty("bodyText").Value;


        HtmlToPdfBuilder builder = new HtmlToPdfBuilder(iTextSharp.text.PageSize.LETTER);
            HtmlPdfPage first = builder.AddPage();
            first.AppendHtml(bodyText);

            string Filename = "test.pdf";

            byte[] thePdf = builder.RenderPdf();
            File.WriteAllBytes(Server.MapPath("~/Images/Pdf/" + Filename),thePdf);
       Response.ContentType = "application/pdf";
       
       Response.AddHeader("Content-Disposition", "attachment;test.pdf");
      
      this.EnableViewState = false;

    Response.WriteFile(Server.MapPath("~/Images/Pdf/" +Filename));
                            Response.Flush();
                            Response.Close();

    }
    </script>

     

  • Fredrik Esseen 608 posts 904 karma points
    Jun 25, 2009 @ 08:12
    Fredrik Esseen
    0

    And yes; editing posts is a must!

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Jun 25, 2009 @ 09:33
    Warren Buckley
    102

    I am not sure if you can mark your own post as solved, but any bugs/features regarding the our.umbraco site please use the new forums - but check to see if there is an existing topic already.

  • Tommy Poulsen 514 posts 708 karma points
    Sep 15, 2009 @ 21:35
    Tommy Poulsen
    0

    Although this item is already solved, for the record I made a PdfCreator package now for doing similar functionality using iTextSharp. You can check it out here.

    >Tommy

  • Fredrik Esseen 608 posts 904 karma points
    Sep 16, 2009 @ 08:35
    Fredrik Esseen
    0

    And now there is this example http://www.nibble.be/?p=72.

    Maybe ABCpdf is better to use as its easier to layout images? That was my biggest problem using ITextSharp!

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    May 10, 2010 @ 15:16
  • Graham Carr 277 posts 389 karma points
    Mar 14, 2013 @ 15:33
    Graham Carr
    0

    This is for Tommy who created the PDFCreator package (here). I have successfully installed it and have it configured, however the file that is created has only the following error message within it:

    Error! Could not find file 'C:\Windows\Temp\tmpYY.tmp'.

    Do you have any idea as to what the issue may be?

  • Graham Carr 277 posts 389 karma points
    Mar 14, 2013 @ 16:00
    Graham Carr
    0

    I have managed to sort this error out, the nodeId that was being passed in was empty. However I am now receiving the following error messages and am not sure at all as to why this is happening:

    Error! Illegal characters in path.

     

  • gfjump 1 post 21 karma points
    Jul 03, 2013 @ 10:22
    gfjump
    0

    you can take a look at rasteredge's pdf add-on to see if it can integrate with the forum and creat dynamic pdf vb.net. i hope it will work for you.

Please Sign in or register to post replies

Write your reply to:

Draft