This is a DLL and NuGet package for using DocRaptor API to convert HTML to PDF and XLSX.
- .NET 4.0 or later
- Windows Phone 7.1 (Mango)
- RestSharp - 105.1.0 or later
- Json.NET - 12.0.3 or later
- JsonSubTypes - 1.6.0 or later
Command line:
nuget.exe install DocRaptor
Install-Package DocRaptor
Download DLLs: get DocRaptor.dll
from GitHub
using DocRaptor.Client;
using DocRaptor.Model;
using DocRaptor.Api;
using System.IO;
class Example {
static void Main(string[] args) {
DocApi docraptor = new DocApi();
docraptor.Configuration.Username = "YOUR_API_KEY_HERE"; // this key works for test documents
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[] createResponse = docraptor.CreateDoc(doc);
}
}
- Optionally store and get a URL for your converted document with document hosting
- View more code examples with error handling, asynchronous creation, file saving, and document hosting.
- Perfect your document styling with our style and formatting reference, and API reference. Easily add headers and footers, page breaks, page numbers, table of contents, and much more!
Stuck? We're experts at turning HTML into PDFs so please email us if you run into trouble.
The majority of the code in this repo is generated using openapi-generator on docraptor.yaml. You can modify this file and regenerate the client using script/generate_language
.
Don't let swagger downgrade RestSharp to 105.1.0; it will try.
- Pull latest master
- Merge feature branch(es) into master
script/test
- Increment version:
generator-config.json
DocRaptor.nuspec
- Run
script/generate_language
to update generated version numbers:
src/DocRaptor/Properties/AssemblyInfo.cs
src/DocRaptor/Client/Configuration.cs
(4 places)
- Update CHANGELOG.md
- Commit "Release vX.Y.Z"
- Push to GitHub
- Tag version:
git tag 'vX.Y.Z' && git push --tags
- Build package using
script/build
script/release
- Verify package release at https://www.nuget.org/packages
- Open https://github.com/DocRaptor/docraptor-csharp/tags and make a new release for the version. Use the git tag as the name, CHANGELOG entries as the description, and attach
bin/*.dll
andbin/*.xml
to the release - Refresh documentation on docraptor.com
This library follows Semantic Versioning 2.0.0.