Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

create a pdf with compression within 60 sec

Community Beginner ,
Jun 05, 2023 Jun 05, 2023

Is there any possible way to create a pdf with compression from html within 60 sec using javascript sdk

913
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2023 Jun 05, 2023

What SDK does you mean?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 06, 2023 Jun 06, 2023

I am using node sdk for create pdf and compression

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 06, 2023 Jun 06, 2023

This forum is for people using Acrobat.  Adobe product on desktop only. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 06, 2023 Jun 06, 2023

I am using acrobat pro for pdf create and compression

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2023 Jun 06, 2023

Node JS does not operate in the Acrobat environment. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 07, 2023 Jun 07, 2023

It sounds as if you are not using Acrobat, because you are using "node.js". But you say you are using Acrobat Pro. We would like to give good advice - perhaps you can post a few lines of code which run the compression.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 10, 2023 Jun 10, 2023
const PDFServicesSdk = require('@adobe/pdfservices-node-sdk');
try {
// Initial setup, create credentials instance.
const credentials = PDFServicesSdk.Credentials
.serviceAccountCredentialsBuilder()
.fromFile("../../pdfservices-api-credentials.json")
.build();

// Create an ExecutionContext using credentials and create a new operation instance.
const executionContext = PDFServicesSdk.ExecutionContext.create(credentials),
compressPDF = PDFServicesSdk.CompressPDF,
compressPDFOperation = compressPDF.Operation.createNew();

// Set operation input from a source file.
const input = PDFServicesSdk.FileRef.createFromLocalFile('../../resources/create2023-06-05T12-38-16.pdf');
compressPDFOperation.setInput(input);

// Provide any custom configuration options for the operation.
const options = new compressPDF.options.CompressPDFOptions.Builder()
.withCompressionLevel(PDFServicesSdk.CompressPDF.options.CompressionLevel.LOW)
.build();
compressPDFOperation.setOptions(options);

//Generating a file name
let outputFilePath = createOutputFilePath();

// Execute the operation and Save the result to the specified location.
compressPDFOperation.execute(executionContext)
.then(result => result.saveAsFile(outputFilePath))
.catch(err => {
if(err instanceof PDFServicesSdk.Error.ServiceApiError
|| err instanceof PDFServicesSdk.Error.ServiceUsageError) {
console.log('Exception encountered while executing operation', err);
} else {
console.log('Exception encountered while executing operation', err);
}
});

//Generates a string containing a directory structure and file name for the output file.
function createOutputFilePath() {
let date = new Date();
let dateString = date.getFullYear() + "-" + ("0" + (date.getMonth() + 1)).slice(-2) + "-" +
("0" + date.getDate()).slice(-2) + "T" + ("0" + date.getHours()).slice(-2) + "-" +
("0" + date.getMinutes()).slice(-2) + "-" + ("0" + date.getSeconds()).slice(-2);
return ("output/CompressPDFWithOptions/compress" + dateString + ".pdf");
}

} catch (err) {
console.log('Exception encountered while executing operation', err);
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2023 Jun 06, 2023

[MOVED TO THE ACROBAT SDK DISCUSSIONS]


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2023 Jun 10, 2023
LATEST

This has unfortunately been moved to the wrong forum. It is not about the Acrobat SDK although the OP believed it were so. This belongs in the Acrobat Services API forum. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines