Show / Hide Table of Contents

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 CombinePDFJob.

Inheritance
System.Object
PDFServicesJob
ReplacePagesPDFJob
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
ReplacePagesParams replacePagesParams

ReplacePagesPDFJob object containing the base PDF file and the pages to be replaced; can not be null.

Methods

SetOutput(IAsset)

Sets the output asset for the job.

Declaration
public ReplacePagesPDFJob SetOutput(IAsset asset)
Parameters
Type Name Description
IAsset asset

IAsset object representing the output asset; can not be null.

Returns
Type Description
ReplacePagesPDFJob

ReplacePagesPDFJob instance

Remarks

External assets can be set as output only when input is external asset as well

In This Article
  • Constructors
    • ReplacePagesPDFJob(ReplacePagesParams)
  • Methods
    • SetOutput(IAsset)
Back to top Copyright © 2020 Adobe. All rights reserved.