Show / Hide Table of Contents

Class CompressPDFJob

A job that reduces the size of a PDF file. Allows specifying CompressionLevel for compressing PDF

Inheritance
System.Object
PDFServicesJob
CompressPDFJob
Namespace: Adobe.PDFServicesSDK.pdfjobs.jobs
Assembly: Adobe.PDFServicesSDK.Doc.dll
Syntax
public class CompressPDFJob : PDFServicesJob
Examples

Sample Usage:

    using Stream inputStream = 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 asset = pdfServices.Upload(inputStream, PDFServicesMediaType.PDF.GetMIMETypeValue());
    CompressPDFJob compressPDFJob = new CompressPDFJob(asset);
    String location = pdfServices.Submit(compressPDFJob);
    PDFServicesResponse<CompressPDFResult> pdfServicesResponse =
        pdfServices.GetJobResult<CompressPDFResult>(location, typeof(CompressPDFResult));

    IAsset resultAsset = pdfServicesResponse.Result.Asset;
    StreamAsset streamAsset = pdfServices.GetContent(resultAsset);

Constructors

CompressPDFJob(IAsset)

Constructs a new CompressPDFJob instance.

Declaration
public CompressPDFJob(IAsset asset)
Parameters
Type Name Description
IAsset asset

The input IAsset for the job; can not be null.

Methods

SetOutput(IAsset)

Sets the output asset for the job.

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

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

Returns
Type Description
CompressPDFJob

CompressPDFJob instance

Remarks

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

SetParams(CompressPDFParams)

Sets the parameters for the job.

Declaration
public CompressPDFJob SetParams(CompressPDFParams compressPDFParams)
Parameters
Type Name Description
CompressPDFParams compressPDFParams

CompressPDFParams for the job.

Returns
Type Description
CompressPDFJob

CompressPDFJob instance

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