DocRaptor.Api.DocApi.CreateDoc C# (CSharp) Method

CreateDoc() public method

Creates a document synchronously.
Thrown when fails to make API call
public CreateDoc ( Doc doc ) : byte[]
doc Doc The document to be created.
return byte[]
        public byte[] CreateDoc (Doc doc)
        {
             ApiResponse<byte[]> localVarResponse = CreateDocWithHttpInfo(doc);
             return localVarResponse.Data;
        }

Usage Example

Beispiel #1
0
    static void Main(string[] args)
    {
        try {
          Configuration.Default.Username = "******"; // this key works for test documents
          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);
          File.WriteAllBytes("/tmp/docraptor-csharp.pdf", create_response);
          Console.WriteLine("Wrote PDF to /tmp/docraptor-csharp.pdf");
        } catch (DocRaptor.Client.ApiException error) {
          Console.WriteLine(error);
        }
    }
All Usage Examples Of DocRaptor.Api.DocApi::CreateDoc