PdfMergeClient Class |
Namespace: SelectPdf.Api
The PdfMergeClient type exposes the following members.
Name | Description | |
---|---|---|
![]() | PdfMergeClient |
Construct the Pdf Merge Client.
|
Name | Description | |
---|---|---|
![]() | addFile(String) |
Add local PDF document to the list of input files.
|
![]() | addFile(String, String) |
Add local PDF document to the list of input files.
|
![]() | addUrlFile(String) |
Add remote PDF document to the list of input files.
|
![]() | addUrlFile(String, String) |
Add remote PDF document to the list of input files.
|
![]() | getNumberOfPages |
Get the number of pages processed from the PDF document.
|
![]() | save |
Merge all specified input pdfs and return the resulted PDF.
|
![]() | saveAsync |
Merge all specified input pdfs and return the resulted PDF. An asynchronous call is used.
|
![]() | saveToFile |
Merge all specified input pdfs and writes the resulted PDF to a local file.
|
![]() | saveToFileAsync |
Merge all specified input pdfs and writes the resulted PDF to a local file. An asynchronous call is used.
|
![]() | saveToStream |
Merge all specified input pdfs and writes the resulted PDF to a specified stream.
|
![]() | saveToStreamAsync |
Merge all specified input pdfs and writes the resulted PDF to a specified stream. An asynchronous call is used.
|
![]() | setCustomParameter |
Set a custom parameter. Do not use this method unless advised by SelectPdf.
|
![]() | setDocAddCreationDate |
Add the date and time when the PDF document was created to the PDF document information. The default value is False.
|
![]() | setDocAuthor |
Set the name of the PDF document author.
|
![]() | setDocKeywords |
Set the PDF document keywords.
|
![]() | setDocSubject |
Set the subject of the PDF document.
|
![]() | setDocTitle |
Set the PDF document title.
|
![]() | setOwnerPassword |
Set PDF owner password.
|
![]() | setTimeout |
Set the maximum amount of time (in seconds) for this job.
|
![]() | setUserPassword |
Set PDF user password.
|
![]() | setViewerCenterWindow |
Set a flag specifying whether to position the document's window in the center of the screen. The default value is False.
|
![]() | setViewerDisplayDocTitle |
Set a flag specifying whether the window's title bar should display the document title taken from document information. The default value is False.
|
![]() | setViewerFitWindow |
Set a flag specifying whether to resize the document's window to fit the size of the first displayed page. The default value is False.
|
![]() | setViewerHideMenuBar |
Set a flag specifying whether to hide the pdf viewer application's menu bar when the document is active. The default value is False.
|
![]() | setViewerHideToolbar |
Set a flag specifying whether to hide the pdf viewer application's tool bars when the document is active. The default value is False.
|
![]() | setViewerHideWindowUI |
Set a flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed.
The default value is False.
|
![]() | setViewerPageLayout |
Set the page layout to be used when the document is opened in a PDF viewer. The default value is PageLayout.OneColumn.
|
![]() | setViewerPageMode |
Set the document page mode when the pdf document is opened in a PDF viewer. The default value is PageMode.UseNone.
|
using System; using SelectPdf.Api; namespace SelectPdf.Api.Tests { class Program { static void Main(string[] args) { string testUrl = "https://selectpdf.com/demo/files/selectpdf.pdf"; string testPdf = "Input.pdf"; string localFile = "Result.pdf"; string apiKey = "Your API key here"; Console.WriteLine("This is SelectPdf-{0}.", ApiClient.CLIENT_VERSION); try { PdfMergeClient client = new PdfMergeClient(apiKey); // set parameters - see full list at https://selectpdf.com/pdf-merge-api/ client // specify the pdf files that will be merged (order will be preserved in the final pdf) .addFile(testPdf) // add PDF from local file .addUrlFile(testUrl) // add PDF From public url // .addFile(testPdf, "pdf_password") // add PDF (that requires a password) from local file // .addUrlFile(testUrl, "pdf_password") // add PDF (that requires a password) from public url ; Console.WriteLine("Starting pdf merge ..."); // merge pdfs to local file client.saveToFile(localFile); // merge pdfs to memory // byte[] pdf = client.save(); Console.WriteLine("Finished! Number of pages: {0}.", client.getNumberOfPages()); // get API usage UsageClient usageClient = new UsageClient(apiKey); UsageInformation usage = usageClient.getUsage(false); Console.WriteLine("Conversions remained this month: {0}.", usage.Available); } catch (Exception ex) { Console.WriteLine("An error occurred: " + ex.Message); } } } }