You can learn more install options here.
The API client library si common for all Pdfcrowd converters.
Authentication is needed in order to use the Pdfcrowd API. The credentials used for accessing the API are your Pdfcrowd username and the API key. You can find the API key in your account page.
using System; using System.IO; public class ApiTest { public static void Main() { try { // create the API client instance pdfcrowd.PdfToPdfClient client = new pdfcrowd.PdfToPdfClient( "username", "apikey"); // configure the conversion client.addPdfFile("/path/to/cover.pdf"); client.addPdfFile("/path/to/proposal.pdf"); client.addPdfFile("/path/to/price.pdf"); client.addPdfFile("/path/to/contact.pdf"); // run the conversion and write the result to a file client.convertToFile("offer.pdf"); } catch(pdfcrowd.Error why) { // report the error to the standard error stream System.Console.Error.WriteLine("Pdfcrowd Error: " + why); } } }
using System; using System.IO; public class ApiTest { public static void Main() { try { // create the API client instance pdfcrowd.PdfToPdfClient client = new pdfcrowd.PdfToPdfClient( "username", "apikey"); // configure the conversion client.addPdfFile("/path/to/cover.pdf"); client.addPdfFile("/path/to/proposal.pdf"); client.addPdfFile("/path/to/price.pdf"); client.addPdfFile("/path/to/contact.pdf"); // create output file for conversion result FileStream output_file = new FileStream("offer.pdf", FileMode.CreateNew); // run the conversion and store the result into a pdf variable byte[] pdf = client.convert(); // write the pdf the into the output file output_file.Write(pdf, 0, pdf.Length); // close the output file output_file.Close(); } catch(pdfcrowd.Error why) { // report the error to the standard error stream System.Console.Error.WriteLine("Pdfcrowd Error: " + why); } } }
using System; using System.IO; public class ApiTest { public static void Main() { try { // create the API client instance pdfcrowd.PdfToPdfClient client = new pdfcrowd.PdfToPdfClient( "username", "apikey"); // configure the conversion client.addPdfFile("/path/to/cover.pdf"); client.addPdfFile("/path/to/proposal.pdf"); client.addPdfFile("/path/to/price.pdf"); client.addPdfFile("/path/to/contact.pdf"); // create output stream for conversion result FileStream output_stream = new FileStream("offer.pdf", FileMode.CreateNew); // run the conversion and write the result into the output stream client.convertToStream(output_stream); // close the output stream output_stream.Close(); } catch(pdfcrowd.Error why) { // report the error to the standard error stream System.Console.Error.WriteLine("Pdfcrowd Error: " + why); } } }
using System; using System.IO; public class ApiTest { public static void Main() { try { // create the API client instance pdfcrowd.PdfToPdfClient client = new pdfcrowd.PdfToPdfClient( "username", "apikey"); // configure the conversion client.addPdfRawData(File.ReadAllBytes("/path/to/cover.pdf")); client.addPdfRawData(File.ReadAllBytes("/path/to/proposal.pdf")); client.addPdfRawData(File.ReadAllBytes("/path/to/price.pdf")); client.addPdfRawData(File.ReadAllBytes("/path/to/contact.pdf")); // run the conversion and write the result to a file client.convertToFile("offer.pdf"); } catch(pdfcrowd.Error why) { // report the error to the standard error stream System.Console.Error.WriteLine("Pdfcrowd Error: " + why); } } }
using System; using System.IO; public class ApiTest { public static void Main() { try { // create the API client instance pdfcrowd.PdfToPdfClient client = new pdfcrowd.PdfToPdfClient( "username", "apikey"); // configure the conversion client.addPdfRawData(File.ReadAllBytes("/path/to/cover.pdf")); client.addPdfFile("/path/to/proposal.pdf"); client.addPdfRawData(File.ReadAllBytes("/path/to/price.pdf")); client.addPdfFile("/path/to/contact.pdf"); // run the conversion and write the result to a file client.convertToFile("offer.pdf"); } catch(pdfcrowd.Error why) { // report the error to the standard error stream System.Console.Error.WriteLine("Pdfcrowd Error: " + why); } } }
using System; using System.IO; public class ApiTest { public static void Main() { try { // create the API client instance pdfcrowd.PdfToPdfClient client = new pdfcrowd.PdfToPdfClient( "username", "apikey"); // configure the conversion client.setDebugLog(true); client.addPdfRawData(File.ReadAllBytes("/path/to/cover.pdf")); client.addPdfRawData(File.ReadAllBytes("/path/to/proposal.pdf")); // run the conversion and write the result to a file client.convertToFile("offer.pdf"); // print URL to the debug log System.Console.WriteLine("Debug log url: " + client.getDebugLogUrl()); // print the number of available conversion credits in your account System.Console.WriteLine("Remaining credit count: " + client.getRemainingCreditCount()); // print the number of credits consumed by the conversion System.Console.WriteLine("Consumed credit count: " + client.getConsumedCreditCount()); // print the unique ID of the conversion System.Console.WriteLine("Job id: " + client.getJobId()); // print the total number of pages in the output document System.Console.WriteLine("Page count: " + client.getPageCount()); // print the size of the output in bytes System.Console.WriteLine("Output size: " + client.getOutputSize()); } catch(pdfcrowd.Error why) { // report the error to the standard error stream System.Console.Error.WriteLine("Pdfcrowd Error: " + why); } } }
Conversion from PDF to PDF.
public PdfToPdfClient(string userName, string apiKey)
Parameter | Description | Default |
---|---|---|
userName |
Your username at Pdfcrowd.
|
|
apiKey |
Your API key.
|
public PdfToPdfClient setAction(string action)
Parameter | Description | Default |
---|---|---|
action |
Allowed values:
|
join |
public byte[] convert()
public void convertToStream(Stream outStream)
Parameter | Description | Default |
---|---|---|
outStream |
The output stream that will contain the output PDF.
|
public void convertToFile(string filePath)
Parameter | Description | Default |
---|---|---|
filePath |
The output file path.
The string must not be empty.
|
public PdfToPdfClient addPdfFile(string filePath)
Parameter | Description | Default |
---|---|---|
filePath |
The file path to a local PDF file.
The file must exist and not be empty.
|
public PdfToPdfClient addPdfRawData(byte[] pdfRawData)
Parameter | Description | Default |
---|---|---|
pdfRawData |
The raw PDF data.
The input data must be PDF content.
|
public PdfToPdfClient setDebugLog(bool debugLog)
Parameter | Description | Default |
---|---|---|
debugLog |
Set to true to enable the debug logging.
|
false |
public string getDebugLogUrl()
public int getRemainingCreditCount()
public int getConsumedCreditCount()
public string getJobId()
public int getPageCount()
public int getOutputSize()
public PdfToPdfClient setUseHttp(bool useHttp)
Parameter | Description | Default |
---|---|---|
useHttp |
Set to true to use HTTP.
|
false |
public PdfToPdfClient setUserAgent(string userAgent)
Parameter | Description | Default |
---|---|---|
userAgent |
The user agent string.
|
pdfcrowd_dotnet_client/4.3 (http://pdfcrowd.com) |
public PdfToPdfClient setProxy(string host, int port, string userName, string password)
Parameter | Description | Default |
---|---|---|
host |
The proxy hostname.
|
|
port |
The proxy port.
|
|
userName |
The username.
|
|
password |
The password.
|
public PdfToPdfClient setRetryCount(int retryCount)
Parameter | Description | Default |
---|---|---|
retryCount |
Number of retries wanted.
|
1 |
try { // call the API } catch(pdfcrowd.Error why) { // print error System.Console.Error.WriteLine("Pdfcrowd Error: " + why); // print just error code System.Console.Error.WriteLine("Pdfcrowd Error Code: " + why.getCode()); // print just error message System.Console.Error.WriteLine("Pdfcrowd Error Message: " + why.getMessage()); // or handle the error by your way }