PDFBucket package allows you to integrate easily with the PDFBucket service. Tested against 4.5, 4.5.1, 4.5.2, 4.6 and 4.6.1 .NET Framework versions.
To install PDFBucket nuget package, run the following command in the Package Manager Console.
Install-Package PDFBucket
To encrypt a URL in your code instantiate a PDFBucket object and use its GenerateUrl
method.
The new pdfBucket will use PDF_BUCKET_API_KEY
, PDF_BUCKET_API_SECRET
, PDF_BUCKET_API_HOST
(default is api.pdfbucket.io
) ENV vars:
using PdfBucket;
...
PDFBucket pdfBucket = new PDFBucket.Builder().Build();
You can also set any the api params, overwriting then ENV VARS like this:
PDFBucket otherPDFBucket = new PDFBucket.Builder()
.SetApiKey("ABCDEFGHIJKLMNO")
.SetApiSecret("1234567890ABCDE")
.SetApiHost("api.example.com")
.Build();
And you get the encryptedUrl using the GenerateUrl
method:
var EncryptedUrl = pdfBucket.GenerateUrl("http://example.com", "portrait", "A4", "0", "1");
Also you can pass the plain URL to PDFBucket:
var PlainUrl = pdfBucket.GeneratePlainUrl("http://example.com", "portrait", "A4", "0", "1");
- Possible values for orientation: "landscape", "portrait"
- Possible values for page size: "Letter", "A4"
- Possible values for margin: https://developer.mozilla.org/en-US/docs/Web/CSS/margin#Formal_syntax
- Possible values for zoom: https://developer.mozilla.org/en-US/docs/Web/CSS/@viewport/zoom#Formal_syntax