Adobe PDF Services API

PDF APIs with SDKs for Node.js, .Net, and Java to create, convert, OCR PDFs, and more. Contact Us

Create, secure, and export PDF documents

Create a PDF from Microsoft Office documents, protect the content, and export to other formats

Modify PDFs and optimize output

Programmatically alter a document, such as reordering, inserting, and rotating pages, as well as compressing the file

Leverage Adobe's cloud-based services

Access the same cloud-based APIs that power Adobe's end user applications to quickly deliver scalable, secure solutions

AWS Marketplace Partnership

We now offer all of our PDF Services APIs for purchase as a subscription in AWS console

Microsoft Power Automate Integration

Quickly automate document processes without writing any code using the new Adobe PDF Services Connector.

Key Features of Adobe PDF Services API

Extract PDF Content

PDF Content Extraction

Extract text, images, tables, and more from native and scanned PDFs into a structured JSON file. PDF Extract API leverages AI technology to accurately identify text objects and understand the natural reading order of different elements such as headings, lists, and paragraphs spanning multiple columns or pages. Extract font styles with identification of metadata such as bold and italic text and their position within your PDF. Extracted content is output in a structured JSON file format with tables in CSV or XLSX and images saved as PNG. See Documentation

Create PDF

Create a PDF File

Create PDFs from a variety of formats, including static and dynamic HTML; Microsoft Word, PowerPoint, and Excel; as well as text, image, and, Zip
Support for HTML to PDF, DOC to PDF, DOCX to PDF, PPT to PDF, PPTX to PDF, XLS to PDF, XLSX to PDF, TXT to PDF, RTF to PDF, BMP to PDF, JPEG to PDF, GIF to PDF, TIFF to PDF, PNG to PDF See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Document Generation

PDF and Word Document Generation with dynamic data

Generate PDF or Word documents from Microsoft Word templates and your data. Merge dynamic data with your custom templates to generate on brand contracts, proposals, invoices, NDAs, and more. Use our Word add-in to quickly create templates and add signatures with out of the box Adobe Sign integration. Learn more

Convert PDF

Convert a PDF file to other formats

Convert existing PDFs to popular formats, such as Microsoft Word, Excel, and PowerPoint, as well as text and image
Support for PDF to DOC, PDF to DOCX, PDF to JPEG, PDF to PNG, PDF to PPTX, PDF to RTF, PDF to XLSX See our public API Reference and quickly try our APIs using the Postman collections See Documentation

OCR a PDF File

Use built-in optical character recognition (OCR) to convert images to text and enable fully text searchable documents for archiving and creation of searchable indexes. See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Secure PDF

Secure a PDF file and set restrictions

Secure a PDF file with a password encrypt the document. Set an owner password and restrictions on certain features like printing, editing and copying in the PDF document to prevent end users from modifying it.
Support for AES-128 and AES-256 encryption on PDF files, with granular permissions for high and low quality printing and fill and sign form field restrictions. See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Remove PDF Password

Remove the Password from a PDF file

Remove password security from a PDF document. This can only be accomplished with the owner password of the document which must be passed in the operation. See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Split a PDF into multiple files

Split a PDF document into multiple smaller documents by simply specifying either the number of files, pages per file, or page ranges. See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Combine PDF

Combine multiple documents into a PDF file

Combine two or more documents into a single PDF file See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Compress PDF

Compress a PDF file

Reduce the size of PDF files by compressing to smaller sizes for lower bandwidth viewing, downloading, and sharing.
Support for multiple compression levels to retain the quality of images and graphics See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Reorder PDF Pages

Reorder Pages within PDF files

Reorder the pages of a PDF file to reorganize. See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Linearize PDF

Linearize a PDF File for Fast Web View

Optimize PDFs for quick viewing on the web, especially for mobile clients. Linearization allows your end users to view large PDF documents incrementally so that they can view pages much faster in lower bandwidth conditions. See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Insert PDF Pages

Insert a page into a PDF document

Insert one or more pages into an existing document See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Replace PDF Pages

Replace a page within a PDF file

Replace one or more pages with another page in an existing document See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Delete PDF Pages

Delete a page from a PDF file

Delete one or more pages from a document See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Rotate PDF Pages

Rotate a page in a PDF file

Rotate a page in an existing document See our public API Reference and quickly try our APIs using the Postman collections See Documentation

Create a PDF File

Create PDFs from a variety of formats, including static and dynamic HTML; Microsoft Word, PowerPoint, and Excel; as well as text, image, and, Zip
Support for HTML to PDF, DOC to PDF, DOCX to PDF, PPT to PDF, PPTX to PDF, XLS to PDF, XLSX to PDF, TXT to PDF, RTF to PDF, BMP to PDF, JPEG to PDF, GIF to PDF, TIFF to PDF, PNG to PDF

See our public API Reference and quickly try our APIs using the Postman collections

REST API Node.js .Net Java Python
curl --location --request POST 'https://cpf-stage-ue1.adobe.io/ops/:create' \ --header 'Accept: application/json, text/plain, /' \ --header 'Authorization: Bearer ' \ --header 'x-api-key: ' \ --form 'contentAnalyzerRequests=< \"cpf:engine\": < \"repo:assetId\": \"urn:aaid:cpf:58af6e2c-1f0c-400d-9188-078000185695\" >, \"cpf:inputs\": < \"documentIn\": < \"cpf:location\": \"fileInput1\", \"dc:format\": \"application/pdf\" >, \"params\": < \"cpf:inline\": < \"elementsToExtract\": [ \"text\", \"tables\" ], \"renditionsToExtract\": [ \"tables\", \"figures\"] >> >, \"cpf:outputs\": < \"elementsInfo\": < \"cpf:location\": \"jsonoutput\", \"dc:format\": \"application/json\" >, \"elementsRenditions\": < \"cpf:location\": \"fileoutpart\", \"dc:format\": \"text/directory\" >> >' \ --form 'fileInput1=@""' 
// Create an ExecutionContext using credentials const executionContext = PDFServicesSdk.ExecutionContext.create(credentials); // Create a new operation instance. const extractPDFOperation = PDFServicesSdk.ExtractPDF.Operation.createNew(), input = PDFServicesSdk.FileRef.createFromLocalFile( 'resources/extractPDFInput.pdf', PDFServicesSdk.ExtractPDF.SupportedSourceFormat.pdf ); // Set operation input from a source file. extractPDFOperation.setInput(input); // Build and set extractPDF options const options = new PDFServicesSdk.ExtractPDF.options.ExtractPdfOptions.Builder() .addElementsToExtract( PDFServicesSdk.ExtractPDF.options.ExtractElementType.TEXT) .addElementsToExtractRenditions( PDFServicesSdk.ExtractPDF.options.ExtractRenditionsElementType.FIGURES) .addCharInfo(true) .build() extractPDFOperation.setOptions(options); // Execute the operation and Save the result to the specified location. extractPDFOperation.execute(executionContext) .then(result => result.saveAsFile('output/extractPdf.zip')) 
//Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.Create(credentials); ExtractPDFOperation extractPdfOperation = ExtractPDFOperation.CreateNew(); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile(@"extractPDFInput.pdf"); extractPdfOperation.SetInputFile(sourceFileRef); // Build ExtractPDF options and set them into the operation ExtractPDFOptions extractPdfOptions = ExtractPDFOptions.ExtractPdfOptionsBuilder() .AddElementsToExtract(new List(new []< ExtractElementType.TEXT, ExtractElementType.TABLES>)) .AddElementsToExtractRenditions(new List (new [])) .AddAddCharInfo(true) .build(); extractPdfOperation.SetOptions(extractPdfOptions); // Execute the operation. FileRef result = extractPdfOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/ExtractTextTableInfoWithFiguresTablesRenditionsFromPDF.zip"); 
// Create an ExecutionContext using credentials and create a new operation instance ExecutionContext executionContext = ExecutionContext.create(credentials); ExtractPDFOperation extractPDFOperation = ExtractPDFOperation.createNew(); // Set operation input from a source file FileRef source = FileRef.createFromLocalFile("src/test/resources/extractPdfInput.pdf"); extractPDFOperation.setInputFile(source); // Build ExtractPDF options and set them into the operation ExtractPDFOptions extractPDFOptions = ExtractPDFOptions.extractPdfOptionsBuilder() .addElementsToExtract(Arrays.asList(PDFElementType.TEXT, PDFElementType.TABLES)) .addElementsToExtractRenditions(Arrays.asList(PDFElementType.TABLES, PDFElementType.FIGURES)) .addCharInfo(Boolean.TRUE) .build(); extractPDFOperation.setOptions(extractPDFOptions); // Execute the operation FileRef result = extractPDFOperation.execute(executionContext); // Save the result at the specified location result.saveAs("output/extractPdf.zip");
#Create an ExecutionContext using credentials and create a new operation instance. execution_context = ExecutionContext.create(credentials) extract_pdf_operation = ExtractPDFOperation.create_new() #Set operation input from a source file. source = FileRef.create_from_local_file(base_path + "/resources/extractPdfInput.pdf") extract_pdf_operation.set_input(source) # Build ExtractPDF options and set them into the operation extract_pdf_options: ExtractPDFOptions = ExtractPDFOptions.builder() \ .with_elements_to_extract([PDFElementType.TEXT, PDFElementType.TABLES]) \ .with_elements_to_extract_renditions([PDFElementType.TABLES, PDFElementType.FIGURES]) \ .with_get_char_info(True) \ .build() extract_pdf_operation.set_options(extract_pdf_options) #Execute the operation. result: FileRef = extract_pdf_operation.execute(execution_context) # Save the result to the specified location. result.save_as(base_path + "/output/extractPdf.zip")
REST API Node.js .Net Java
curl --location --request POST 'https://cpf-ue1.adobe.io/ops/:create?respondWith=%7B%22reltype%22%3A%20%22http%3A%2F%2Fns.adobe.com%2Frel%2Fprimary%22%7D' \ --header 'Authorization: Bearer ' \ --header 'Accept: application/json, text/plain, */*' \ --header 'x-api-key: ' \ --header 'Prefer: respond-async,wait=0' \ --form 'contentAnalyzerRequests=" < \"cpf:inputs\": < \"documentIn\": < \"cpf:location\": \"InputFile0\", \"dc:format\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" >>, \"cpf:engine\": < \"repo:assetId\": \"urn:aaid:cpf:Service-1538ece812254acaac2a07799503a430\" >, \"cpf:outputs\": < \"documentOut\": < \"cpf:location\": \"multipartLabelOut\", \"dc:format\": \"application/pdf\" >> >"' \ --form 'InputFile0=@""'
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), createPDF = PDFServicesSdk.CreatePDF, htmlToPDFOperation = createPDF.Operation.createNew(); // Set operation input from a source URL. const input = PDFServicesSdk.FileRef.createFromURL("https://www.adobe.io"); htmlToPDFOperation.setInput(input); // Provide any custom configuration options for the operation. const options = new createPDF.options.html.CreatePDFFromHtmlOptions.Builder() .includesHeaderFooter(true) .build(); htmlToPDFOperation.setOptions(options); // Execute the operation and Save the result to the specified location. htmlToPDFOperation.execute(executionContext) .then(result => result.saveAsFile('output/createPdfFromURLOutput.pdf'))
//Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.Create(credentials); CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.CreateNew(); // Set operation input from a source URL. FileRef source = FileRef.CreateFromURI(new Uri("https://www.adobe.io")); htmlToPDFOperation.SetInput(source); // Provide any custom configuration options for the operation. SetCustomOptions(htmlToPDFOperation); // Execute the operation. FileRef result = htmlToPDFOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/createPdfFromURLOutput.pdf"); 
//Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.createNew(); // Set operation input from a source file. FileRef source = FileRef.createFromURL(new URL("https://www.adobe.io")); htmlToPDFOperation.setInput(source); // Provide any custom configuration options for the operation. CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.htmlOptionsBuilder() .includeHeaderFooter(true) .build(); htmlToPDFOperation.setOptions(htmlToPdfOptions); // Provide any custom configuration options for the operation. setCustomOptions(htmlToPDFOperation); // Execute the operation. FileRef result = htmlToPDFOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/createPDFFromURLOutput.pdf"); 
Node.js .Net Java
// Create an ExecutionContext using // credentials and create a new // operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), exportPDF = PDFServicesSdk.ExportPDF, exportPdfOperation = exportPDF.Operation.createNew(exportPDF.SupportedTargetFormats.DOCX); // Set operation input from a source file const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/exportPDFInput.pdf'); exportPdfOperation.setInput(input); // Execute the operation and Save the result to the specified location. exportPdfOperation.execute(executionContext) .then(result => result.saveAsFile('output/exportPdfOutput.docx'))
// Create an ExecutionContext using // credentials and create a new // operation instance. ExecutionContext executionContext = ExecutionContext.Create(credentials); ExportPDFOperation exportPdfOperation = ExportPDFOperation.CreateNew( ExportPDFTargetFormat.DOCX ); // Set operation input from a local PDF file FileRef sourceFileRef = FileRef.CreateFromLocalFile(@"exportPdfInput.pdf"); exportPdfOperation.SetInput(sourceFileRef); // Execute the operation. FileRef result = exportPdfOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/exportPdfOutput.docx");
// Create an ExecutionContext using // credentials and create a new // operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); ExportPDFOperation exportPdfOperation = ExportPDFOperation .createNew(ExportPDFTargetFormat.DOCX); // Set operation input from a local PDF file FileRef sourceFileRef = FileRef .createFromLocalFile( "src/main/resources/exportPDFInput.pdf" ); exportPdfOperation.setInput(sourceFileRef); // Execute the operation. FileRef result = exportPdfOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/exportPdfOutput.docx");
Node.js .Net Java
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), ocrOperation = PDFServicesSdk.OCR.Operation.createNew(); // Set operation input from a source file. const input = PDFServicesSdk.FileRef.createFromLocalFile( 'resources/ocrInput.pdf', PDFServicesSdk.OCR.SupportedMediaTypes.pdf ); ocrOperation.setInput(input); // Execute the operation and Save the result to the specified location. ocrOperation.execute(executionContext) .then(result => result.saveAsFile('output/ocrOutput.pdf'));
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.Create(credentials); OCROperation ocrOperation = OCROperation.CreateNew(); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile(@"ocrInput.pdf"); ocrOperation.SetInput(sourceFileRef); // Execute the operation. FileRef result = ocrOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/ocrOperationOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); OCROperation ocrOperation = OCROperation.createNew(); // Set operation input from a source file. FileRef source = FileRef.createFromLocalFile( "src/main/resources/ocrInput.pdf" ); ocrOperation.setInput(source); // Execute the operation FileRef result = ocrOperation.execute(executionContext); // Save the result at the specified location result.saveAs("output/ocrOutput.pdf");
Node.js .Net Java
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), rotatePagesOperation = PDFServicesSdk.RotatePages.Operation.createNew(); // Set operation input from a source file. const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/rotatePagesInput.pdf'); rotatePagesOperation.setInput(input); // Sets angle by 90 degrees (in clockwise direction) for rotating the specified pages of the input PDF file. const firstPageRange = getFirstPageRangeForRotation(); rotatePagesOperation.setAngleToRotatePagesBy(PDFServicesSdk.RotatePages.Angle._90, firstPageRange); // Sets angle by 180 degrees (in clockwise direction) for rotating the specified pages of the input PDF file. const secondPageRange = getSecondPageRangeForRotation(); rotatePagesOperation.setAngleToRotatePagesBy(PDFServicesSdk.RotatePages.Angle._180,secondPageRange); // Execute the operation and Save the result to the specified location. rotatePagesOperation.execute(executionContext) .then(result => result.saveAsFile('output/rotatePagesOutput.pdf'));
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Create a new operation instance RotatePagesOperation rotatePagesOperation = RotatePagesOperation.CreateNew(); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile( @"rotatePagesInput.pdf" ); rotatePagesOperation.SetInput(sourceFileRef); // Sets angle by 90 degrees (in clockwise direction) for rotating the specified pages of the input PDF file. PageRanges firstPageRange = GetFirstPageRangeForRotation(); rotatePagesOperation.SetAngleToRotatePagesBy( Angle._90, firstPageRange ); // Sets angle by 180 degrees (in clockwise direction) for rotating the specified pages of the input PDF file. PageRanges secondPageRange = GetSecondPageRangeForRotation(); rotatePagesOperation .SetAngleToRotatePagesBy(Angle._180, secondPageRange); // Execute the operation. FileRef result = rotatePagesOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/rotatePagesOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); RotatePagesOperation rotatePagesOperation = RotatePagesOperation.createNew(); // Set operation input from a source file. FileRef source = FileRef.createFromLocalFile( "src/main/resources/rotatePagesInput.pdf" ); rotatePagesOperation.setInput(source); // Sets angle by 90 degrees (in clockwise direction) for rotating the specified pages of the input PDF file. PageRanges firstPageRange = getFirstPageRangeForRotation(); rotatePagesOperation.setAngleToRotatePagesBy( Angle._90, firstPageRange ); // Sets angle by 180 degrees (in clockwise direction) for rotating the specified pages of the input PDF file. PageRanges secondPageRange = getSecondPageRangeForRotation(); rotatePagesOperation .setAngleToRotatePagesBy( Angle._180, secondPageRange ); // Execute the operation. FileRef result = rotatePagesOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/rotatePagesOutput.pdf");
Node.js .Net Java
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), deletePagesOperation = PDFServicesSdk.DeletePages.Operation.createNew(); // Set operation input from a source file. const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/deletePagesInput.pdf'); deletePagesOperation.setInput(input); // Delete pages of the document (as specified by PageRanges). const pageRangesForDeletion = getPageRangesForDeletion(); deletePagesOperation.setPageRanges(pageRangesForDeletion); // Execute the operation and Save the result to the specified location. deletePagesOperation.execute(executionContext) .then(result => result.saveAsFile('output/deletePagesOutput.pdf'))
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Create a new operation instance DeletePagesOperation deletePagesOperation = DeletePagesOperation.CreateNew(); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile( @"deletePagesInput.pdf" ); deletePagesOperation.SetInput(sourceFileRef); // Delete pages of the document // (as specified by PageRanges). PageRanges pageRangeForDeletion = GetPageRangeForDeletion(); deletePagesOperation .SetPageRanges(pageRangeForDeletion); // Execute the operation. FileRef result = deletePagesOperation .Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/deletePagesOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); DeletePagesOperation deletePagesOperation = DeletePagesOperation.createNew(); // Set operation input from a source file. FileRef source = FileRef.createFromLocalFile( "src/main/resources/deletePagesInput.pdf" ); deletePagesOperation.setInput(source); // Delete pages of the document (as specified by PageRanges). PageRanges pageRangeForDeletion = getPageRangeForDeletion(); deletePagesOperation.setPageRanges(pageRangeForDeletion); // Execute the operation. FileRef result = deletePagesOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/deletePagesOutput.pdf");
Node.js .Net Java
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), replacePagesOperation = PDFServicesSdk.ReplacePages.Operation.createNew(); // Set operation base input from a source file. const baseInputFile = PDFServicesSdk.FileRef.createFromLocalFile('resources/baseInput.pdf'); replacePagesOperation.setBaseInput(baseInputFile); // Create a FileRef instance using a local file. const firstInputFile = PDFServicesSdk.FileRef.createFromLocalFile('resources/replacePagesInput1.pdf'), pageRanges = getPageRangesForFirstFile(); // Adds the pages (specified by the page ranges) of the input PDF file for replacing the page of the base PDF file. replacePagesOperation.addPagesForReplace(1, firstInputFile, pageRanges); // Create a FileRef instance using a local file. const secondInputFile = PDFServicesSdk.FileRef.createFromLocalFile('resources/replacePagesInput2.pdf'); // Adds all the pages of the input PDF file for replacing the page of the base PDF file. replacePagesOperation.addPagesForReplace(3, secondInputFile); // Execute the operation and Save the result to the specified location. replacePagesOperation.execute(executionContext) .then(result => result.saveAsFile('output/replacePagesOutput.pdf'))
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Create a new operation instance ReplacePagesOperation replacePagesOperation = ReplacePagesOperation.CreateNew(); // Set operation base input from a source file. FileRef baseSourceFile = FileRef.CreateFromLocalFile(@"baseInput.pdf"); replacePagesOperation.SetBaseInput(baseSourceFile); // Create a FileRef instance using a local file. FileRef firstInputFile = FileRef.CreateFromLocalFile( @"replacePagesInput1.pdf" ); PageRanges pageRanges = GetPageRangeForFirstFile(); // Adds the pages (specified by the page ranges) of the input PDF file for replacing the page of the base PDF file. replacePagesOperation .AddPagesForReplace(firstInputFile, pageRanges, 1); // Create a FileRef instance using a local file. FileRef secondInputFile = FileRef.CreateFromLocalFile( @"replacePagesInput2.pdf" ); // Adds all the pages of the input PDF file for replacing the page of the base PDF file. replacePagesOperation .AddPagesForReplace(secondInputFile, 3); // Execute the operation. FileRef result = replacePagesOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/replacePagesOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); ReplacePagesOperation replacePagesOperation = ReplacePagesOperation.createNew(); // Set operation base input from a source file. FileRef baseSourceFile = FileRef.createFromLocalFile( "src/main/resources/baseInput.pdf" ); replacePagesOperation.setBaseInput(baseSourceFile); // Create a FileRef instance using a local file. FileRef firstInputFile = FileRef.createFromLocalFile( "src/main/resources/replacePagesInput1.pdf" ); PageRanges pageRanges = getPageRangeForFirstFile(); // Adds the pages (specified by the page ranges) of the input PDF file for replacing the page of the base PDF file. replacePagesOperation.addPagesForReplace( firstInputFile, pageRanges, 1 ); // Create a FileRef instance using a local file. FileRef secondInputFile = FileRef.createFromLocalFile( "src/main/resources/replacePagesInput2.pdf" ); // Adds all the pages of the input PDF file for replacing the page of the base PDF file. replacePagesOperation .addPagesForReplace(secondInputFile, 3); // Execute the operation FileRef result = replacePagesOperation.execute(executionContext); // Save the result at the specified location result.saveAs("output/replacePagesOutput.pdf");
Node.js .Net Java
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), linearizePDF = PDFServicesSdk.LinearizePDF, linearizePDFOperation = linearizePDF.Operation.createNew(); // Set operation input from a source file. const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/linearizePDFInput.pdf'); linearizePDFOperation.setInput(input); // Execute the operation and Save the result to the specified location. linearizePDFOperation.execute(executionContext) .then(result => result.saveAsFile('output/linearizePDFOutput.pdf'))
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.Create(credentials); LinearizePDFOperation linearizePDFOperation = LinearizePDFOperation.CreateNew(); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile( @"linearizePDFInput.pdf" ); linearizePDFOperation.SetInput(sourceFileRef); // Execute the operation. FileRef result = linearizePDFOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/linearizePDFOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); LinearizePDFOperation linearizePDFOperation = LinearizePDFOperation.createNew(); // Set operation input from a source file. FileRef source = FileRef.createFromLocalFile( "src/main/resources/linearizePDFInput.pdf" ); linearizePDFOperation.setInput(source); // Execute the operation FileRef result = linearizePDFOperation.execute(executionContext); // Save the result at the specified location result.saveAs("output/linearizePDFOutput.pdf");
Node.js .Net Java
// 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/compressPDFInput.pdf'); compressPDFOperation.setInput(input); // Execute the operation and Save the result to the specified location. compressPDFOperation.execute(executionContext) .then(result => result.saveAsFile('output/compressPDFOutput.pdf'))
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.Create(credentials); CompressPDFOperation compressPDFOperation = CompressPDFOperation.CreateNew(); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile( @"compressPDFInput.pdf" ); compressPDFOperation.SetInput(sourceFileRef); // Execute the operation. FileRef result = compressPDFOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory .GetCurrentDirectory() + "/output/compressPDFOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); CompressPDFOperation compressPDFOperation = CompressPDFOperation.createNew(); // Set operation input from a source file. FileRef source = FileRef.createFromLocalFile( "src/main/resources/compressPDFInput.pdf "); compressPDFOperation.setInput(source); // Execute the operation FileRef result = compressPDFOperation.execute(executionContext); // Save the result at the specified location result.saveAs("output/compressPDFOutput.pdf");
Node.js .Net Java
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), reorderPagesOperation = PDFServicesSdk.ReorderPages.Operation.createNew(); // Set operation input from a source file, along with specifying the order of the pages for rearranging the pages in a PDF file. const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/reorderPagesInput.pdf'); const pageRanges = getPageRangeForReorder(); reorderPagesOperation.setInput(input); reorderPagesOperation.setPagesOrder(pageRanges); // Execute the operation and Save the result to the specified location. reorderPagesOperation.execute(executionContext) .then(result => result.saveAsFile('output/reorderPagesOutput.pdf'));
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Create a new operation instance ReorderPagesOperation reorderPagesOperation = ReorderPagesOperation.CreateNew(); // Set operation input from a source file, along with specifying the order of the pages for rearranging the pages in a PDF file. FileRef sourceFileRef = FileRef.CreateFromLocalFile(@"reorderPagesInput.pdf"); reorderPagesOperation.SetInput(sourceFileRef); PageRanges pageRanges = GetPageRangeForReorder(); reorderPagesOperation.SetPagesOrder(pageRanges); // Execute the operation. FileRef result = reorderPagesOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/reorderPagesOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); ReorderPagesOperation reorderPagesOperation = ReorderPagesOperation.createNew(); // Set operation input from a source file, along with specifying the order of the pages for rearranging the pages in a PDF file. FileRef source = FileRef.createFromLocalFile( "src/main/resources/reorderPagesInput.pdf" ); PageRanges pageRanges = getPageRangeForReorder(); reorderPagesOperation.setInput(source); reorderPagesOperation.setPagesOrder(pageRanges); // Execute the operation. FileRef result = reorderPagesOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/reorderPagesOutput.pdf");
Python .Net Java
#Update this code sample in _includes/code-sample.html on line 868 
// Update this code sample in _includes/code-sample.html on line 872 
// Update this code sample in _includes/code-sample.html on line 876 
REST API Node.js .Net Java
curl --location --request POST 'https://cpf-ue1.adobe.io/ops/:create?respondWith=%7B%22reltype%22%3A%20%22http%3A%2F%2Fns.adobe.com%2Frel%2Fprimary%22%7D' \ --header 'Authorization: Bearer ' \ --header 'Accept: application/json, text/plain, */*' \ --header 'x-api-key: ' \ --header 'Prefer: respond-async,wait=0' \ --form 'contentAnalyzerRequests="< \"cpf:inputs\": < \"documentsIn\": [< \"pageRanges\": < \"cpf:inline\": [< \"start\": 1, \"end\": 4 >] >, \"documentIn\": < \"cpf:location\": \"InputFile0\", \"dc:format\": \"application/pdf\" >>, < \"pageRanges\": < \"cpf:inline\": [< \"start\": 1, \"end\": 25 >] >, \"documentIn\": < \"cpf:location\": \"InputFile1\", \"dc:format\": \"application/pdf\" >>, < \"pageRanges\": < \"cpf:inline\": [< \"start\": 1 >, < \"end\": 25 >, < \"start\": 1, \"end\": 25 >] >, \"documentIn\": < \"cpf:location\": \"InputFile2\", \"dc:format\": \"application/pdf\" >>] >, \"cpf:engine\": < \"repo:assetId\": \"urn:aaid:cpf:Service-916ee91c156b42349a7847a7d564fb13\" >, \"cpf:outputs\": < \"documentOut\": < \"cpf:location\": \"OutputFile\", \"dc:format\": \"application/pdf\" >> >"' \ --form 'InputFile0=@""' \ --form 'InputFile1=@""' \ --form 'InputFile2=@""'
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create( credentials ), combineFilesOperation = PDFServicesSdk.CombineFiles.Operation.createNew(); // Set operation input from a source file. const combineSource1 = PDFServicesSdk.FileRef.createFromLocalFile( 'resources/combineFilesInput1.pdf' ), combineSource2 = PDFServicesSdk.FileRef.createFromLocalFile( 'resources/combineFilesInput2.pdf' ); combineFilesOperation.addInput( combineSource1 ); combineFilesOperation.addInput( combineSource2 ); // Execute the operation and Save the result to the specified location. combineFilesOperation.execute( executionContext ) .then(result => result.saveAsFile( 'output/combineFilesOutput.pdf' ));
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.Create( credentials ); CombineFilesOperation combineFilesOperation = CombineFilesOperation.CreateNew(); // Add operation input from source files. FileRef combineSource1 = FileRef .CreateFromLocalFile( @"combineFilesInput1.pdf" ); FileRef combineSource2 = FileRef .CreateFromLocalFile( @"combineFilesInput2.pdf" ); combineFilesOperation.AddInput( combineSource1 ); combineFilesOperation.AddInput( combineSource2 ); // Execute the operation. FileRef result = combineFilesOperation.Execute( executionContext ); // Save the result to the specified location. result.SaveAs( Directory.GetCurrentDirectory() + "/output/combineFilesOutput.pdf" );
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); ReorderPagesOperation reorderPagesOperation = ReorderPagesOperation.createNew(); // Set operation input from a source file, along with specifying the order of the pages for rearranging the pages in a PDF file. FileRef source = FileRef.createFromLocalFile( "src/main/resources/reorderPagesInput.pdf" ); PageRanges pageRanges = getPageRangeForReorder(); reorderPagesOperation.setInput(source); reorderPagesOperation.setPagesOrder(pageRanges); // Execute the operation. FileRef result = reorderPagesOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/reorderPagesOutput.pdf");
Node.js .Net Java
// Create an ExecutionContext using credentials const executionContext = PDFServicesSdk.ExecutionContext.create(credentials); // Create a new operation instance. const splitPDFOperation = PDFServicesSdk.SplitPDF.Operation.createNew(), input = PDFServicesSdk.FileRef.createFromLocalFile('resources/splitPDFInput.pdf', PDFServicesSdk.SplitPDF.SupportedSourceFormat.pdf); // Set operation input from a source file. splitPDFOperation.setInput(input); // Set the number of documents to split the input PDF file into. splitPDFOperation.setFileCount(2); // Execute the operation and Save the result to the specified location. splitPDFOperation.execute(executionContext) .then(result => < let saveFilesPromises = []; for(let i = 0; i < result.length; i++)< saveFilesPromises.push(result[i].saveAsFile(`output/splitPDFOutput_$.pdf`)); > return Promise.all(saveFilesPromises); >);
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Create a new operation instance SplitPDFOperation splitPDFOperation = SplitPDFOperation.CreateNew(); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile(@"splitPDFInput.pdf"); splitPDFOperation.SetInput(sourceFileRef); // Set the number of documents to split the input PDF file into. splitPDFOperation.SetFileCount(2); // Execute the operation. List result = splitPDFOperation.Execute(executionContext); // Save the result to the specified location. int index = 0; foreach (FileRef fileRef in result) < fileRef.SaveAs(Directory.GetCurrentDirectory() + "/output/splitPDFOutput_" + index + ".pdf"); index++; >
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); SplitPDFOperation splitPDFOperation = SplitPDFOperation.createNew(); // Set operation input from a source file. FileRef source = FileRef.createFromLocalFile("src/main/resources/splitPDFInput.pdf"); splitPDFOperation.setInput(source); // Set the number of documents to split the input PDF file into. splitPDFOperation.setFileCount(2); // Execute the operation. List result = splitPDFOperation.execute(executionContext); // Save the result to the specified location. int index = 0; for (FileRef fileRef : result) < fileRef.saveAs("output/splitPDFOutput_" + index + ".pdf"); index++; >
Node.js .Net Java
// Create an ExecutionContext using credentials and create a new operation instance. const executionContext = PDFServicesSdk.ExecutionContext.create(credentials), insertPagesOperation = PDFServicesSdk.InsertPages.Operation.createNew(); // Set operation base input from a source file. const baseInputFile = PDFServicesSdk.FileRef.createFromLocalFile('resources/baseInput.pdf'); insertPagesOperation.setBaseInput(baseInputFile); // Create a FileRef instance using a local file. const firstFileToInsert = PDFServicesSdk.FileRef.createFromLocalFile('resources/firstFileToInsertInput.pdf'), pageRanges = getPageRangesForFirstFile(); // Adds the pages (specified by the page ranges) // of the input PDF file to be // inserted at the specified page of the base PDF file. insertPagesOperation.addPagesToInsertAt(2, firstFileToInsert, pageRanges); // Create a FileRef instance using a local file. const secondFileToInsert = PDFServicesSdk.FileRef.createFromLocalFile('resources/secondFileToInsertInput.pdf'); // Adds all the pages of the input PDF file // to be inserted at the specified // page of the base PDF file. insertPagesOperation.addPagesToInsertAt(3, secondFileToInsert); // Execute the operation and Save the // result to the specified location. insertPagesOperation.execute(executionContext) .then(result => result.saveAsFile('output/insertPagesOutput.pdf'))
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Create a new operation instance InsertPagesOperation insertPagesOperation = InsertPagesOperation.CreateNew(); // Set operation base input from a source file. FileRef baseSourceFile = FileRef.CreateFromLocalFile(@"baseInput.pdf"); insertPagesOperation.SetBaseInput(baseSourceFile); // Create a FileRef instance using a local file. FileRef firstFileToInsert = FileRef.CreateFromLocalFile( @"firstFileToInsertInput.pdf" ); PageRanges pageRanges = GetPageRangeForFirstFile(); // Adds the pages (specified by the page ranges) of the input PDF file to be inserted at the specified page of the base PDF file. insertPagesOperation.AddPagesToInsertAt( firstFileToInsert, pageRanges, 2 ); // Create a FileRef instance using a local file. FileRef secondFileToInsert = FileRef .CreateFromLocalFile( @"secondFileToInsertInput.pdf" ); // Adds all the pages of the input PDF file to be inserted at the specified page of the base PDF file. insertPagesOperation .AddPagesToInsertAt(secondFileToInsert, 3); // Execute the operation. FileRef result = insertPagesOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/insertPagesOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); InsertPagesOperation insertPagesOperation = InsertPagesOperation.createNew(); // Set operation base input from a source file. FileRef baseSourceFile = FileRef.createFromLocalFile( "src/main/resources/baseInput.pdf" ); insertPagesOperation.setBaseInput(baseSourceFile); // Create a FileRef instance using a local file. FileRef firstFileToInsert = FileRef.createFromLocalFile( "src/main/resources/firstFileToInsertInput.pdf" ); PageRanges pageRanges = getPageRangeForFirstFile (); // Adds the pages (specified by the page ranges) of the input PDF file to be inserted at the specified page of the base PDF file. insertPagesOperation .addPagesToInsertAt(firstFileToInsert, pageRanges, 2); // Create a FileRef instance using a local file. FileRef secondFileToInsert = FileRef.createFromLocalFile( "src/main/resources/secondFileToInsertInput.pdf" ); // Adds all the pages of the input PDF file to be inserted at the specified page of the base PDF file. insertPagesOperation .addPagesToInsertAt(secondFileToInsert, 3); // Execute the operation. FileRef result = insertPagesOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/insertPagesOutput.pdf");
REST API Node.js .Net Java
curl --location --request POST 'https://cpf-ue1.adobe.io/ops/:create?respondWith=%7B%22reltype%22%3A%20%22http%3A%2F%2Fns.adobe.com%2Frel%2Fprimary%22%7D' \ --header 'Authorization: Bearer ' \ --header 'Accept: application/json, text/plain, */*' \ --header 'x-api-key: ' \ --header 'Prefer: respond-async,wait=0' \ --form 'contentAnalyzerRequests="< \"cpf:engine\":< \"repo:assetId\":\"urn:aaid:cpf:Service-52d5db6097ed436ebb96f13a4c7bf8fb\" >, \"cpf:inputs\":< \"documentIn\":< \"cpf:location\":\"InputFile0\", \"dc:format\":\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" >, \"params\":< \"cpf:inline\":< \"outputFormat\": \"pdf\", \"jsonDataForMerge\": < \"customerName\": \"Kane Miller\", \"customerVisits\": 100, \"itemsBought\": [ < \"name\": \"Sprays\", \"quantity\": 50, \"amount\": 100 >, < \"name\": \"Chemicals\", \"quantity\": 100, \"amount\": 200 >], \"totalAmount\": 300, \"previousBalance\": 50, \"lastThreeBillings\": [100, 200, 300], \"photograph\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP88h8AAu0B9XNPCQQAAAAASUVORK5CYII=\" > > > >, \"cpf:outputs\": < \"documentOut\":< \"cpf:location\":\"OutputFile\", \"dc:format\":\"application/pdf\" >> >"' \ --form 'InputFile0=@""'
// Setup input data for the document merge process const jsonString = fs.readFileSync('resources/salesOrder.json'), jsonDataForMerge = JSON.parse(jsonString); // Create an ExecutionContext using credentials const executionContext = PDFToolsSdk.ExecutionContext.create(credentials); // Create a new DocumentMerge options instance const documentMerge = PDFToolsSdk.DocumentMerge, documentMergeOptions = documentMerge.options, options = new documentMergeOptions.DocumentMergeOptions(jsonDataForMerge, documentMergeOptions.OutputFormat.PDF); // Create a new operation instance using the options instance const documentMergeOperation = documentMerge.Operation.createNew(options) // Set operation input document template from a source file. const input = PDFToolsSdk.FileRef.createFromLocalFile('resources/salesOrderTemplate.docx'); documentMergeOperation.setInput(input); // Execute the operation and Save the result to the specified location. documentMergeOperation.execute(executionContext) .then(result => result.saveAsFile('output/salesOrderOutput.pdf'))
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Setup input data for the document merge process var content = File.ReadAllText(@"salesOrder.json"); JObject jsonDataForMerge = JObject.Parse(content); // Create a new DocumentMerge Options instance DocumentMergeOptions documentMergeOptions = new DocumentMergeOptions(jsonDataForMerge, OutputFormat.PDF); // Create a new DocumentMerge Operation instance with the DocumentMerge Options instance DocumentMergeOperation documentMergeOperation = DocumentMergeOperation.CreateNew(documentMergeOptions); // Set the operation input document template from a source file. documentMergeOperation.SetInput(FileRef.CreateFromLocalFile(@"salesOrderTemplate.docx")); // Execute the operation. FileRef result = documentMergeOperation.Execute(executionContext); // Save the result to the specified location result.SaveAs(Directory.GetCurrentDirectory() + "/output/salesOrderOutput.pdf"); 
// Setup input data for the document merge process String content = new String(Files.readAllBytes(Paths.get("src/main/resources/salesOrder.json"))); JSONObject jsonDataForMerge = new JSONObject(content); // Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.create(credentials); //Create a new DocumentMergeOptions instance DocumentMergeOptions documentMergeOptions = new DocumentMergeOptions(jsonDataForMerge, OutputFormat.PDF); // Create a new DocumentMergeOperation instance with the DocumentMergeOptions instance DocumentMergeOperation documentMergeOperation = DocumentMergeOperation.createNew(documentMergeOptions); // Set the operation input document template from a source file. FileRef documentTemplate = FileRef.createFromLocalFile("src/main/resources/salesOrderTemplate.docx"); documentMergeOperation.setInput(documentTemplate); // Execute the operation FileRef result = documentMergeOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/salesOrderOutput.pdf"); 
Node.js .Net Java
// Create an ExecutionContext using credentials const executionContext = PDFServicesSdk.ExecutionContext.create(credentials); // Create new permissions instance and add the required permissions const protectPDF = PDFServicesSdk.ProtectPDF, protectPDFOptions = protectPDF.options, permissions = protectPDFOptions.Permissions.createNew(); permissions.addPermission(protectPDFOptions.Permission.PRINT_LOW_QUALITY); permissions.addPermission(protectPDFOptions.Permission.EDIT_DOCUMENT_ASSEMBLY); permissions.addPermission(protectPDFOptions.Permission.COPY_CONTENT); // Build ProtectPDF options by setting a User as well as an Owner/Permissions Password, Permissions, // Encryption Algorithm (used for encrypting the PDF file) and specifying the type of content to encrypt. const options = new protectPDFOptions.PasswordProtectOptions.Builder() .setUserPassword("openpassword") .setOwnerPassword("permissionspassword") .setPermissions(permissions) .setEncryptionAlgorithm(protectPDFOptions.EncryptionAlgorithm.AES_256) .setContentEncryption(protectPDFOptions.ContentEncryption.ALL_CONTENT_EXCEPT_METADATA) .build(); // Create a new operation instance. const protectPDFOperation = protectPDF.Operation.createNew(options); // Set operation input from a source file. const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/protectPDFInput.pdf'); protectPDFOperation.setInput(input); // Execute the operation and Save the result to the specified location. protectPDFOperation.execute(executionContext) .then(result => result.saveAsFile('output/protectPDFOutput.pdf'))
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Create new permissions instance and add the required permissions Permissions permissions = Permissions.CreateNew(); permissions.AddPermission(Permission.PRINT_LOW_QUALITY); permissions.AddPermission(Permission.EDIT_DOCUMENT_ASSEMBLY); permissions.AddPermission(Permission.COPY_CONTENT); // Build ProtectPDF options by setting a User as well as Owner/Permissions Password, Permissions, // Encryption Algorithm (used for encrypting the PDF file) and specifying the type of content to encrypt. ProtectPDFOptions protectPDFOptions = ProtectPDFOptions.PasswordProtectOptionsBuilder() .SetUserPassword("openpassword") .SetOwnerPassword("permissionspassword") .SetPermissions(permissions) .SetEncryptionAlgorithm(EncryptionAlgorithm.AES_256) .SetContentEncryption(ContentEncryption.ALL_CONTENT_EXCEPT_METADATA) .Build(); // Create a new operation instance ProtectPDFOperation protectPDFOperation = ProtectPDFOperation.CreateNew(protectPDFOptions); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile(@"protectPDFInput.pdf"); protectPDFOperation.SetInput(sourceFileRef); // Execute the operation. FileRef result = protectPDFOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/protectPDFOutput.pdf");
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.create(credentials); // Create new permissions instance and add the required permissions Permissions permissions = Permissions.createNew(); permissions.addPermission(Permission.PRINT_LOW_QUALITY); permissions.addPermission(Permission.EDIT_DOCUMENT_ASSEMBLY); permissions.addPermission(Permission.COPY_CONTENT); // Build ProtectPDF options by setting a User as well as Owner/Permissions Password, Permissions, // Encryption Algorithm (used for encrypting the PDF file) and specifying the type of content to encrypt. ProtectPDFOptions protectPDFOptions = ProtectPDFOptions.passwordProtectOptionsBuilder() .setOwnerPassword("openpassword") .setUserPassword("permissionspassword") .setPermissions(permissions) .setEncryptionAlgorithm(EncryptionAlgorithm.AES_256) .setContentEncryption(ContentEncryption.ALL_CONTENT_EXCEPT_METADATA) .build(); // Create a new operation instance. ProtectPDFOperation protectPDFOperation = ProtectPDFOperation.createNew(protectPDFOptions); // Set operation input from a source file. FileRef source = FileRef.createFromLocalFile("src/main/resources/protectPDFInput.pdf"); protectPDFOperation.setInput(source); // Execute the operation FileRef result = protectPDFOperation.execute(executionContext); // Save the result at the specified location result.saveAs("output/protectPDFOutput.pdf");
Node.js .Net Java
// Create an ExecutionContext using credentials const executionContext = PDFServicesSdk.ExecutionContext.create(credentials); // Create a new operation instance. const removeProtectionOperation = PDFServicesSdk.RemoveProtection.Operation.createNew(), input = PDFServicesSdk.FileRef.createFromLocalFile( 'resources/removeProtectionInput.pdf', PDFServicesSdk.RemoveProtection.SupportedSourceFormat.pdf); // Set operation input from a source file. removeProtectionOperation.setInput(input); // Set the password for removing security from a PDF document. removeProtectionOperation.setPassword("password"); // Execute the operation and Save the result to the specified location. removeProtectionOperation.execute(executionContext) .then(result => result.saveAsFile('output/removeProtectionOutput.pdf'))
// Create an ExecutionContext using credentials. ExecutionContext executionContext = ExecutionContext.Create(credentials); // Create a new operation instance RemoveProtectionOperation removeProtectionOperation = RemoveProtectionOperation.CreateNew(); // Set operation input from a source file. FileRef sourceFileRef = FileRef.CreateFromLocalFile(@"removeProtectionInput.pdf"); removeProtectionOperation.SetInput(sourceFileRef); // Set the password for removing security from a PDF document. removeProtectionOperation.SetPassword("password"); // Execute the operation. FileRef result = removeProtectionOperation.Execute(executionContext); // Save the result to the specified location. result.SaveAs(Directory.GetCurrentDirectory() + "/output/removeProtectionOutput.pdf");
// Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); RemoveProtectionOperation removeProtectionOperation = RemoveProtectionOperation.createNew(); // Set operation input from a source file. FileRef source = FileRef.createFromLocalFile("src/main/resources/removeProtectionInput.pdf"); removeProtectionOperation.setInput(source); // Set the password for removing security from a PDF document. removeProtectionOperation.setPassword("password"); // Execute the operation. FileRef result = removeProtectionOperation.execute(executionContext); // Save the result to the specified location. result.saveAs("output/removeProtectionOutput.pdf");
Node.js .Net Java
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), pdfPropertiesOperation = PDFServicesSdk.PDFProperties.Operation.createNew(); // Set operation input from a source file. const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/pdfPropertiesInput.pdf'); pdfPropertiesOperation.setInput(input); // Provide any custom configuration options for the operation. const options = new PDFServicesSdk.PDFProperties.options.PDFPropertiesOptions.Builder() .includePageLevelProperties(true) .build(); pdfPropertiesOperation.setOptions(options); // Execute the operation and log the JSON Object. pdfPropertiesOperation.execute(executionContext) .then(result => console.log("The resultant json object is : " + JSON.stringify(result))) 
// Initial setup, create credentials instance Credentials credentials = Credentials.ServiceAccountCredentialsBuilder() .FromFile(Directory.GetCurrentDirectory() + "/pdfservices-api-credentials.json") .Build(); // Create an ExecutionContext using credentials and create a new operation instance ExecutionContext executionContext = ExecutionContext.Create(credentials); PDFPropertiesOperation pdfPropertiesOperation = PDFPropertiesOperation.CreateNew(); // Provide an input FileRef for the operation FileRef source = FileRef.CreateFromLocalFile(@"pdfPropertiesInput.pdf"); pdfPropertiesOperation.SetInput(source); // Build PDF Properties options to include page level properties and set them into the operation PDFPropertiesOptions pdfPropertiesOptions = PDFPropertiesOptions.PDFPropertiesOptionsBuilder() .IncludePageLevelProperties(true) .Build(); pdfPropertiesOperation.SetOptions(pdfPropertiesOptions); // Execute the operation and return JSON Object JObject result = pdfPropertiesOperation.Execute(executionContext); 
// Initial setup, create credentials instance. Credentials credentials = Credentials.serviceAccountCredentialsBuilder() .fromFile("pdfservices-api-credentials.json") .build(); //Create an ExecutionContext using credentials and create a new operation instance. ExecutionContext executionContext = ExecutionContext.create(credentials); PDFPropertiesOperation pdfPropertiesOperation = PDFPropertiesOperation.createNew(); // Provide an input FileRef for the operation FileRef source = FileRef.createFromLocalFile("src/main/resources/pdfPropertiesInput.pdf"); pdfPropertiesOperation.setInputFile(source); // Build PDF Properties options to include page level properties and set them into the operation PDFPropertiesOptions pdfPropertiesOptions = PDFPropertiesOptions.PDFPropertiesOptionsBuilder() .includePageLevelProperties(true) .build(); pdfPropertiesOperation.setOptions(pdfPropertiesOptions); // Execute the operation and return JSON Object JSONObject result = pdfPropertiesOperation.execute(executionContext); 
<div style="height: 360px; width: 500px;">   
JavaScript
document.addEventListener("adobe_dc_view_sdk.ready", function() < var adobeDCView = new AdobeDC.View(", divId: "adobe-dc-view">); adobeDCView.previewFile(< content: >, metaData: >, ); >);
JavaScript
adobeDCView.registerCallback( /* Type of call back */ AdobeDC.View.Enum.CallbackType.EVENT_LISTENER, /* call back function */ function(event) < console.log(event); >, < enablePDFAnalytics: true >);
JavaScript
const profile = < userProfile: < name: '', firstName: '', lastName: '', email: '' > >; adobeDCView.registerCallback( AdobeDC.View.Enum.CallbackType.GET_USER_PROFILE_API, function() < return new Promise((resolve, reject) =>< resolve(< code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS, data: profile >); >); > );
JavaScript
const saveOptions = < autoSaveFrequency: , enableFocusPolling: , showSaveButton: > adobeDCView.registerCallback( AdobeDC.View.Enum.CallbackType.SAVE_API, function(metadata, content, options) < return new Promise((resolve, reject) => < resolve(< code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS, data: < metaData: > >); >); >, saveOptions);
   

Adobe PDF Extract API

A new web service that allows you to unlock content structure and table data from any PDF document with machine learning

Leverage Adobe Sensei for a rich understanding of content structure with higher quality input to other systems

Easily Extract content to JSON format for further processing into other applications or databases Identify more document elements than OCR with extraction of headings, paragraphs, lists, and more

Start Modifying PDFs in a few Minutes

Start your free 6-month trial today with 1,000 PDF transactions

Obtain free credentials Get started Download ready to run samples for Node.js, Java, and .NET Node.js Java .Net Add credentials to your code and run!
API Reference See documentation

Use Cases for PDF Services API

Report Creation and Editing

Create and embed reports for internal or external consumption, sharing, and review.

Search and Indexing

Create searchable indexes from digital documents to quickly locate critical content for compliance and other downstream processing.

Digital Content Publishing

Publish whitepapers and marketing content with end-user interactivity, security controls, and analytics.

Job Posting

Automate job posting with supporting documents such as PDF brochures, relevant job supplements, and company details.

Learn about our PDF Embed API to embed high-fidelity PDFs and control appearance, enable collaboration, and see analytics

We're ready to help

Have questions about the Document Services APIs? Contact us