Show / Hide Table of Contents

Class ExportPDFOperation

An Operation which exports a source PDF file to a supported format specified by ExportPDFTargetFormat

For the image target formats (JPEG and PNG), the resulting file is a ZIP archive containing one image per page of the source PDF file. Each image file name ends with "_<unpadded_page_index>". For example, a PDF file with 15 pages will generate 15 image files. The first file's name ends with "_1" and the last file's name ends with "_15".

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

Sample Usage:

ClientContext context = ClientContext.CreateFromFile(Directory.GetCurrentDirectory() + "/dc-services-sdk-config.json");
ExportPDFOperation exportPdfOperation = ExportPDFOperation.CreateNew(ExportPDFTargetFormat.DOCX);
exportPdfOperation.setInput(FileRef.CreateFromLocalFile("exportPdfInput.pdf",
                                                          "application/pdf"));
FileRef result = exportPdfOperation.Execute(context);   
result.SaveAs("ExportPDFOutput.docx");

Methods

CreateNew(ExportPDFTargetFormat)

Constructs a ExportPDFOperation instance.

Declaration
public static ExportPDFOperation CreateNew(ExportPDFTargetFormat exportPdfTargetFormat)
Parameters
Type Name Description
ExportPDFTargetFormat exportPdfTargetFormat

target format

Returns
Type Description
ExportPDFOperation

a new ExportPDFOperation 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 file; see class-level docs for format-specific considerations

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 specified 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

SetInput(FileRef)

Sets an input PDF file (media type "application/pdf").

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

an input PDF file

Implements

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