DocRaptor Home

How to Make a PDF or Excel Document

Examples & Agents by Programming Languages > Making Documents with .NET

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)



Command line:

nuget.exe install DocRaptor

Package Manager Console:

Install-Package DocRaptor

NuGet Package Manager (UI): Go to Tools —> NuGet Package Manager —> Manage NuGet Packages for Solution...

Search for DocRaptor, and select and install "DocRaptor by Expected Behavior".

Download DLLs: get DocRaptor.dll from GitHub


See examples for runnable examples with file output, error handling, etc.

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 (note: this field is currently required, so just provide an empty string if URL is provided)
      // DocumentUrl: "",  // 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: ""                               // pretend URL when using document_content - http or https prefix is required
      // )

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

Docs created like this are limited to 60 seconds to render, check out the async example which allows 10 minutes.

Ready to get started? Try DocRaptor for free with unlimited test documents.