Show / Hide Table of Contents

Class CombineFilesOperation

Combines multiple PDF files into a single PDF file. Allows specifying which pages of the source files to combine.

Inheritance
System.Object
CombineFilesOperation
Implements
IOperation
Namespace: Adobe.DocumentCloud.Services.pdfops
Assembly: Adobe.DocumentCloud.Services.Doc.dll
Syntax
public class CombineFilesOperation : IOperation
Examples

Sample usage:

ClientContext context = ClientContext.CreateFromFile(Directory.GetCurrentDirectory() + "/dc-services-sdk-config.json");
CombineFilesOperation combineFilesOperation = CombineFilesOperation.CreateNew();
FileRef combineSource1 = FileRef.CreateFromLocalFile("combinePdfInput1.pdf", "application/pdf");
FileRef combineSource2 = FileRef.CreateFromLocalFile("combinePdfInput2.pdf", "application/pdf");
combineFilesOperation.AddInput(combineSource1);
combineFilesOperation.AddInput(combineSource2);
FileRef result = combineFilesOperation.Execute(context);
result.SaveAs("CombineFilesOutput.pdf");

Methods

AddInput(FileRef)

Specifies a PDF file (media type "application/pdf") to be combined with other files. All pages of this file will be added after the pages of any previously specified files.

For adding particular pages of a PDF file, use AddInput(FileRef, PageRanges)

Declaration
public void AddInput(FileRef sourceFileRef)
Parameters
Type Name Description
FileRef sourceFileRef

a PDF file to be combined

AddInput(FileRef, PageRanges)

Specifies particular pages of a PDF file (media type "application/pdf") to be combined with other files. The pages will be added after the pages of any previously specified files.

For adding all the pages of the file, consider AddInput(FileRef)

Declaration
public void AddInput(FileRef sourceFileRef, PageRanges pageRanges)
Parameters
Type Name Description
FileRef sourceFileRef

a PDF file

PageRanges pageRanges

page ranges of the PDF file to be combined

CreateNew()

Constructs a CombineFilesOperation instance

Declaration
public static CombineFilesOperation CreateNew()
Returns
Type Description
CombineFilesOperation

a new CombineFilesOperation instance

Execute(ClientContext)

Executes this operation synchronously using the supplied context and returns a new FileRef instance for the resulting file.

The resulting file may be stored in the system temporary directory. See FileRef for how temporary resources are cleaned up.

Declaration
public FileRef Execute(ClientContext context)
Parameters
Type Name Description
ClientContext context

the context in which to execute the operation

Returns
Type Description
FileRef

the resulting PDF file

Exceptions
Type Condition
ServiceApiException

if an API call results in an error response

SDKException

this is thrown for client-side errors

System.IO.FileNotFoundException

if the client conifg file or the input source does not exist in a path

System.IO.IOException

if there is an error in reading either the input source or the resulting file

System.ArgumentException

thrown when any of the inputs provided is not valid

System.InvalidOperationException

thrown when operation instance is invoked more than once

Implements

IOperation
Back to top Copyright © 2019 Adobe. All rights reserved.