Class ReplacePagesPDFJob
A job that allows specific pages in a PDF file to be replaced with pages from multiple PDF files.
For more complex use cases, refer the Combine
Namespace: Adobe.PDFServicesSDK.pdfjobs.jobs
Assembly: Adobe.PDFServicesSDK.Doc.dll
Syntax
public class ReplacePagesPDFJob : PDFServicesJob
Examples
Sample Usage:
using Stream baseInputStream = File.OpenRead("<SOURCE_PATH>");
using Stream inputStream1 = 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 asset1 = pdfServices.Upload(inputStream1, PDFServicesMediaType.PDF.GetMIMETypeValue());
PageRanges pageRanges = new PageRanges();
pageRanges.AddRange(1, 3);
pageRanges.AddSinglePage(4);
ReplacePagesParams replacePagesParams = ReplacePagesParams.replacePagesParamsBuilder(baseAsset)
.addPagesForReplace(asset1, pageRanges, 1)
.Build();
ReplacePagesPDFJob replacePagesPDFJob = new ReplacePagesPDFJob(replacePagesParams);
String location = pdfServices.Submit(replacePagesPDFJob);
PDFServicesResponse<ReplacePagesResult> pdfServicesResponse =
pdfServices.GetJobResult<ReplacePagesResult>(location, typeof(ReplacePagesResult));
IAsset resultAsset = pdfServicesResponse.Result.Asset;
StreamAsset streamAsset = pdfServices.GetContent(resultAsset);
Constructors
ReplacePagesPDFJob(ReplacePagesParams)
Constructs a new ReplacePagesPDFJob
instance.
Declaration
public ReplacePagesPDFJob(ReplacePagesParams replacePagesParams)
Parameters
Type | Name | Description |
---|---|---|
Replace |
replacePagesParams | Replace |
Methods
SetOutput(IAsset)
Sets the output asset for the job.
Declaration
public ReplacePagesPDFJob SetOutput(IAsset asset)
Parameters
Returns
Type | Description |
---|---|
Replace |
|
Remarks
External assets can be set as output only when input is external asset as well