Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Generating a PDF invoice from web data...

Options
  • 16-07-2012 8:39pm
    #1
    Closed Accounts Posts: 3,912 ✭✭✭


    Hi Folks,


    I've developed my website using ASP.NET 3.5 and C#. I sell specialised items to repeat/trade clients, and using a login page, I allow them access to their historical authorised transactions and web based queries (typically
    transactiosn awaiting authorisation by credit card).

    I display this data to my clients using a GridView & DetailsView at the moment, using an SQL query that pulls client data from my MS SQL 2008 DB depending on the UserID, transaction status, etc.

    All is going well there, but recently some of my clients have asked for me to put up functionality on the site that let's them print off an actual paper invoice in PDF format directly from the website.

    This will obviously involve generating a template of some sort and somehow importing data into the PDF template on a "per-transaction" basis. Just wondering can anyone point me in the right direction for this kind of a task?

    This is the best I can come up with on the web, just wondering is there anything less intricate out there?!?

    http://itextpdf.com/itext.php

    Many thanks for any help with this...

    HFC


Comments

  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    I wouldn't recommend using iTextSharp, it's very expensive for commercial use. I inherited a project that used iTextSharp and was quoted nearly €2,000 for a licence. Instead I modified the PDF generation code to use PDFsharp which is free for commercial use (MIT-license).


  • Registered Users Posts: 2,781 ✭✭✭amen


    Before any suggestions do your customers currently get an invoice when they make an order ? If so then all you need to do is store the invoice details and then when they click on the transaction display the original invoice.

    you could store the invoice details in the db and the template on disk and merge.

    I wouldn't let customers click on transactions and create invoices with items that may not be true invoices.


  • Closed Accounts Posts: 2,930 ✭✭✭COYW


    amen wrote: »
    I wouldn't let customers click on transactions and create invoices with items that may not be true invoices.

    Agree with you 100% on this. You would end up with a mess otherwise. On software, PDFsharp is the best/most affordable tool for the job. You would end up spending a fortune otherwise.

    OP, If it is feasible for you, you should consider creating the PDF invoice when the order is verified (i.e. you know it is a true invoice) and store it locally and then you can just present it to the user when they request it, as opposed to creating it on the fly per request.


  • Registered Users Posts: 1,082 ✭✭✭Feathers


    recently some of my clients have asked for me to put up functionality on the site that let's them print off an actual paper invoice in PDF format directly from the website.

    This will obviously involve generating a template of some sort and somehow importing data into the PDF template on a "per-transaction" basis. Just wondering can anyone point me in the right direction for this kind of a task?

    Can you just create a print.css stylesheet for the page & make it layout nicely on an A4 page? Then tell your clients (if they've bought a computer in the last 7 years or so) to choose File > Print > PDF > Save as PDF.


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    Feathers wrote: »
    tell your clients (if they've bought a computer in the last 7 years or so) to choose File > Print > PDF > Save as PDF.
    Never underestimate the lack of technical ability of a customer. The only browser on my system that comes close to having that sequence of commands is Chrome and at some point you'll surely have a customer who won't know to click the wrench icon on the top right of their browser window.


  • Advertisement
  • Registered Users Posts: 1,082 ✭✭✭Feathers


    Malice wrote: »
    Feathers wrote: »
    tell your clients (if they've bought a computer in the last 7 years or so) to choose File > Print > PDF > Save as PDF.
    Never underestimate the lack of technical ability of a customer. The only browser on my system that comes close to having that sequence of commands is Chrome and at some point you'll surely have a customer who won't know to click the wrench icon on the top right of their browser window.

    Definitely agree not to overestimate clients abilities. Meant more that if it was only one or two customers, it might save a lot of hassle if they were able to do it.

    That said also, tech savvy customers might want a signed PDF, so wouldn't work that way either ;)

    I'm pretty sure that I had this feature now via the print dialogue rather than the browser though, on both Mac and Windows... Possibly it's because I've the full Acrobat that it's installed some extra postscript stuff


  • Moderators, Technology & Internet Moderators Posts: 1,334 Mod ✭✭✭✭croo


    I've used iText on open source projects, java based with desktop & web UI, and it works well.


  • Closed Accounts Posts: 376 ✭✭sawfish


    Feathers wrote: »
    I'm pretty sure that I had this feature now via the print dialogue rather than the browser though, on both Mac and Windows... Possibly it's because I've the full Acrobat that it's installed some extra postscript stuff

    Yeah Saving a webpage as/printing to PDF is only available generally with Acrobat Pro and most people won`t have this.


  • Registered Users Posts: 2,081 ✭✭✭GetWithIt


    PDFsharp ftw.


  • Registered Users Posts: 9,557 ✭✭✭DublinWriter


    Also take a look as the Aspose .NET range of products - they have a component that can generate PDFs from scratch without having Acrobat installed. They aren't cheap, but their products are rock solid and used extensively by blue-chips for in house-systems.


  • Advertisement
  • Registered Users Posts: 6 sprat


    Hi there,

    it depends on what you want to do. From personal experience, I can recommed iTextSharp and NFop, both are ports from Java, available at Source Forge.

    iTextSharp is great if you need extensive, low level manipulation capabilities of the pdf, there is a real good book out there explaining the whole API.

    NFop is a xsl-fo engine, basically you provide an xml input, and xsl-fo (that's a subset of xsl) and voile you have a pdf. The documentation for NFop is not specially good, and if you need a sophisticated design there are some features missing, they are in the xsl-fo specification but they're not supported here. But hey it's free.

    For me, both of them have worked pretty well. Ie. I generate reports with them, on the fly from a web app., the main pdf is created with NFop, if needed with iText I add custom fields like an embedded digital signature.

    The curve for integrating any of them is low, iwith NFop, one day to generate basic PDFs plus another couple of days to figure out how to make the xsl-fo do what I wanted (due to to lack of good documentation), with iText was even easier.

    Feel free to PM me if I can help you.


    Cheers.




    Hi Folks,


    I've developed my website using ASP.NET 3.5 and C#. I sell specialised items to repeat/trade clients, and using a login page, I allow them access to their historical authorised transactions and web based queries (typically
    transactiosn awaiting authorisation by credit card).

    I display this data to my clients using a GridView & DetailsView at the moment, using an SQL query that pulls client data from my MS SQL 2008 DB depending on the UserID, transaction status, etc.

    All is going well there, but recently some of my clients have asked for me to put up functionality on the site that let's them print off an actual paper invoice in PDF format directly from the website.

    This will obviously involve generating a template of some sort and somehow importing data into the PDF template on a "per-transaction" basis. Just wondering can anyone point me in the right direction for this kind of a task?

    This is the best I can come up with on the web, just wondering is there anything less intricate out there?!?

    http://itextpdf.com/itext.php

    Many thanks for any help with this...

    HFC


Advertisement