This page describes how to use the Pdfcrowd online API to join multiple PDF files or update PDF attributes
in .NET.
The API is user-friendly and can be integrated into your application with just a few lines of code.
Here are .NET examples for quickly getting started with the API.
See more examples.
usingSystem;usingSystem.IO;publicclassApiTest{publicstaticvoidMain(){try{// create the API client instancepdfcrowd.PdfToPdfClientclient=newpdfcrowd.PdfToPdfClient("demo","ce544b6ea52a5621fb9d55f8b542d14d");// configure the conversionclient.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 fileclient.convertToFile("offer.pdf");}catch(pdfcrowd.Errorwhy){System.Console.Error.WriteLine("Pdfcrowd Error: "+why);throw;}}}
usingSystem;usingSystem.IO;publicclassApiTest{publicstaticvoidMain(){try{// create the API client instancepdfcrowd.PdfToPdfClientclient=newpdfcrowd.PdfToPdfClient("demo","ce544b6ea52a5621fb9d55f8b542d14d");// configure the conversionclient.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 fileclient.convertToFile("offer.pdf");}catch(pdfcrowd.Errorwhy){System.Console.Error.WriteLine("Pdfcrowd Error: "+why);throw;}}}
usingSystem;usingSystem.IO;publicclassApiTest{publicstaticvoidMain(){try{// create the API client instancepdfcrowd.PdfToPdfClientclient=newpdfcrowd.PdfToPdfClient("demo","ce544b6ea52a5621fb9d55f8b542d14d");// configure the conversionclient.addPdfFile("/path/to/proposal.pdf");client.setPageWatermark("/path/to/watermark.pdf");// run the conversion and write the result to a fileclient.convertToFile("company_offer.pdf");}catch(pdfcrowd.Errorwhy){System.Console.Error.WriteLine("Pdfcrowd Error: "+why);throw;}}}
Authentication
The credentials to access the API are your Pdfcrowd username and the API key.
You can try out the API without registering using the following demo
credentials:
It is recommended that you implement error handling to catch errors
that the API may return, see the example code below. A list of status
codes and their description can be found
here.
try{// call the API }catch(pdfcrowd.Errorwhy){// print the errorSystem.Console.Error.WriteLine("Pdfcrowd Error: "+why);// print the error codeSystem.Console.Error.WriteLine("Pdfcrowd Error Code: "+why.getCode());// print the error messageSystem.Console.Error.WriteLine("Pdfcrowd Error Message: "+why.getMessage());}