Skip to content

documentContent is required, but it shouldn't be #25

@JamesPaden

Description

@JamesPaden

I have to include a blank documentContent line, or an error is thrown :( it should be optional if I use documentUrl

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

class Example
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        // this key works in test mode!
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

        try
        {
            Doc doc = new Doc(
                name: "invoice",
                test: true, // test documents are free but watermarked
                documentType: Doc.DocumentTypeEnum.Pdf,
                documentContent: "", // the .NET agent requires documentContent be set
                documentUrl: "https://docraptor.com/samples/invoice.html" 
                // javascript: false, 
            );

            byte[] pdf = docraptor.CreateDoc(doc);
            File.WriteAllBytes("invoice.pdf", pdf);
            Console.WriteLine("Successfully created invoice.pdf!");
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions