Class InsertPagesPDFJob
A job that can be used to insert pages of multiple PDF files into a base PDF file.
For more complex use cases, refer the CombinePDFJob.
Namespace: Adobe.PDFServicesSDK.pdfjobs.jobs
Assembly: Adobe.PDFServicesSDK.Doc.dll
Syntax
public class InsertPagesPDFJob : PDFServicesJob
Examples
Sample Usage:
using Stream baseInputStream = File.OpenRead("<SOURCE_PATH>");
using Stream firstInputStreamToInsert = File.OpenRead("<SOURCE_PATH>");
using Stream secondInputStreamToInsert = File.OpenRead("<SOURCE_PATH>");
ICredentials credentials = new ServicePrincipalCredentials(
Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_ID"),
Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_SECRET"));
PDFServices pdfServices = new PDFServices(credentials);
IAsset baseAsset = pdfServices.Upload(baseInputStream, PDFServicesMediaType.PDF.GetMIMETypeValue());
IAsset firstAssetToInsert = pdfServices.Upload(firstInputStreamToInsert, PDFServicesMediaType.PDF.GetMIMETypeValue());
IAsset secondAssetToInsert = pdfServices.Upload(secondInputStreamToInsert, PDFServicesMediaType.PDF.GetMIMETypeValue());
PageRanges pageRanges = new PageRanges();
pageRanges.AddRange(1, 3);
pageRanges.AddSinglePage(4);
InsertPagesParams insertPagesParams = InsertPagesParams.InsertPagesParamsBuilder(baseAsset)
.AddPagesToInsertAt(firstAssetToInsert, pageRanges, 2)
.AddPagesToInsertAt(secondAssetToInsert, 3)
.Build();
InsertPagesPDFJob insertPagesPDFJob = new InsertPagesPDFJob(insertPagesParams);
String location = pdfServices.Submit(insertPagesPDFJob);
PDFServicesResponse<InsertPagesResult> pdfServicesResponse =
pdfServices.GetJobResult<InsertPagesResult>(location, typeof(InsertPagesResult));
IAsset resultAsset = pdfServicesResponse.Result.Asset;
StreamAsset streamAsset = pdfServices.GetContent(resultAsset);
Constructors
InsertPagesPDFJob(InsertPagesParams)
Constructs a new InsertPagesPDFJob
instance.
Declaration
public InsertPagesPDFJob(InsertPagesParams insertPagesParams)
Parameters
Type | Name | Description |
---|---|---|
InsertPagesParams | insertPagesParams | The input InsertPagesParams object containing the input files and the page numbers to insert at; can not be null. |
Methods
SetOutput(IAsset)
Sets the output asset for the job.
Declaration
public InsertPagesPDFJob SetOutput(IAsset asset)
Parameters
Type | Name | Description |
---|---|---|
IAsset | asset | IAsset object representing the output asset; can not be null. |
Returns
Type | Description |
---|---|
InsertPagesPDFJob |
|
Remarks
External assets can be set as output only when input is external asset as well