ASP.net create pdf invoices using api

Murray Brown
Murray Brown used Ask the Experts™
on
Hi. I want to generate a pdf document on my ASP.net website. Is there a website with an api that I might use to create for instance a purchase order or invoice using VB.net
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Hi Murray,

I am tempted to throw some Api providers names here but any specific reason you don't want to do it in your own app.

Also, what format you are expecting? Will you submit HTML string and this Api will return PDF? Or there is some other scenario in your mind?

Regards,
Chinmay.
Senior Full Stack Developer
Distinguished Expert 2017
Commented:
I have used DocRaptor before (available from NuGet), and it worked really nicely. They have flexible pricing too. To see how easy it is to use DocRaptor in a .NET Application, see the Getting Started.

using DocRaptor.Client;
using DocRaptor.Model;
using DocRaptor.Api;
using System.IO;

class Example {
  static void Main(string[] args) {
    Configuration.Default.Username = "YOUR_API_KEY_HERE";
    DocApi docraptor = new DocApi();

    Doc doc = new Doc(
      Test: true,                                                    // test documents are free but watermarked
      DocumentContent: "<html><body>Hello World</body></html>",      // supply content directly
      // DocumentUrl: "http://docraptor.com/examples/invoice.html",  // or use a url
      Name: "docraptor-csharp.pdf",                                  // help you find a document later
      DocumentType: Doc.DocumentTypeEnum.Pdf                         // pdf or xls or xlsx
      // Javascript: true,                                           // enable JavaScript processing
      // PrinceOptions: new PrinceOptions(
      //   Media: "screen",                                          // use screen styles instead of print styles
      //   Baseurl: "http://hello.com"                               // pretend URL when using document_content
      // )
    );

    byte[] create_response = docraptor.CreateDoc(doc);
  }
}

Open in new window

Murray BrownASP.net/VSTO Developer

Author

Commented:
Hi Chinmay

My answer is yes to
"Will you submit HTML string and this Api will return PDF?"
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018
Commented:
Hi Murray,

I think then Dirk's answer is one option you can consider.

If you want an open source and / free solution then you can find these capabilities in PdfSharp library.

Regards,
Chinmay.
Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks very much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial