Create PDF
Create a PDF
Use the sample below to create PDFs from Microsoft Office documents (Word, Excel and PowerPoint) and other supported file formats. While the example shows .docx file conversion, the SDK supports the following formats:
- Microsoft Word (DOC, DOCX)
- Microsoft PowerPoint (PPT, PPTX)
- Microsoft Excel (XLS, XLSX)
- Text (TXT, RTF)
- Image (BMP, JPEG, GIF, TIFF, PNG)
If a Microsoft Word/PowerPoint input file has an embedded TrueType font, the output pdf will also contain the same embedded TrueType font. For more information, refer Benefits of embedding custom fonts.
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples2// Run the sample:3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.createpdf.CreatePDFFromDOCX45public class CreatePDFFromDOCX {67 // Initialize the logger.8 private static final Logger LOGGER = LoggerFactory.getLogger(CreatePDFFromDOCX .class);910 public static void main(String[] args) {1112 try {1314 // Initial setup, create credentials instance.15 Credentials credentials = Credentials.serviceAccountCredentialsBuilder()16 .fromFile("pdfservices-api-credentials.json").build();1718 //Create an ExecutionContext using credentials and create a new operation instance.19 ExecutionContext executionContext = ExecutionContext.create(credentials);20 CreatePDFOperation createPdfOperation = CreatePDFOperation.createNew();2122 // Set operation input from a source file.23 FileRef source = FileRef.createFromLocalFile("src/main/resources/createPDFInput.docx");24 createPdfOperation.setInput(source);2526 // Execute the operation.27 FileRef result = createPdfOperation.execute(executionContext);2829 // Save the result to the specified location.30 result.saveAs("output/createPDFFromDOCX.pdf");3132 } catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {33 LOGGER.error("Exception encountered while executing34 operation", ex);35 }36 }37}
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_net_samples2// Run the sample:3// cd CreatePDFFromDocx/4// dotnet run CreatePDFFromDocx.csproj56namespace CreatePDFFromDocx7 {8 class Program9 {10 private static readonly ILog log = LogManager.GetLogger(typeof(Program));11 static void Main()12 {13 //Configure the logging14 ConfigureLogging();15 try16 {17 // Initial setup, create credentials instance.18 Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()19 .FromFile(Directory.GetCurrentDirectory() + "/pdfservices-api-credentials.json")20 .Build();2122 //Create an ExecutionContext using credentials and create a new operation instance.23 ExecutionContext executionContext = ExecutionContext.Create(credentials);24 CreatePDFOperation createPdfOperation = CreatePDFOperation.CreateNew();2526 // Set operation input from a source file.27 FileRef source = FileRef.CreateFromLocalFile(@"createPdfInput.docx");28 createPdfOperation.SetInput(source);2930 // Execute the operation.31 FileRef result = createPdfOperation.Execute(executionContext);3233 // Save the result to the specified location.34 result.SaveAs(Directory.GetCurrentDirectory() + "/output/createPdfOutput.pdf");35 }36 catch (ServiceUsageException ex)37 {38 log.Error("Exception encountered while executing operation", ex);39 }40 // Catch more errors here. . .41 }4243 static void ConfigureLogging()44 {45 ILoggerRepository logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());46 XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));47 }48 }49 }
Copied to your clipboard1// Get the samples from http://www.adobe.com/go/pdftoolsapi_node_sample2// Run the sample:3// node src/createpdf/create-pdf-from-docx.js45const PDFservicesSdk = require('@adobe/pdfservices-node-sdk');67 try {8 // Initial setup, create credentials instance.9 const credentials = PDFServicesSdk.Credentials10 .serviceAccountCredentialsBuilder()11 .fromFile("pdfservices-api-credentials.json")12 .build();1314 // Create an ExecutionContext using credentials and create a new operation instance.15 const executionContext = PDFServicesSdk.ExecutionContext.create(credentials),16 createPdfOperation = PDFServicesSdk.CreatePDF.Operation.createNew();1718 // Set operation input from a source file.19 const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/createPDFInput.docx');20 createPdfOperation.setInput(input);2122 // Execute the operation and Save the result to the specified location.23 createPdfOperation.execute(executionContext)24 .then(result => result.saveAsFile('output/createPDFFromDOCX.pdf'))25 .catch(err => {26 if(err instanceof PDFServicesSdk.Error.ServiceApiError27 || err instanceof PDFServicesSdk.Error.ServiceUsageError) {28 console.log('Exception encountered while executing operation', err);29 } else {30 console.log('Exception encountered while executing operation', err);31 }32 });33 } catch (err) {34 console.log('Exception encountered while executing operation', err);35 }
Copied to your clipboard1// Please refer our REST API docs for more information2// https://documentcloud.adobe.com/document-services/index.html#post-createPDF34curl --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' \5--header 'Authorization: Bearer {{Placeholder for token}}' \6--header 'Accept: application/json, text/plain, */*' \7--header 'x-api-key: {{Placeholder for client_id}}' \8--header 'Prefer: respond-async,wait=0' \9--form 'contentAnalyzerRequests="{10 \"cpf:inputs\": {11 \"documentIn\": {12 \"cpf:location\": \"InputFile0\",13 \"dc:format\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"14 }15 },16 \"cpf:engine\": {17 \"repo:assetId\": \"urn:aaid:cpf:Service-1538ece812254acaac2a07799503a430\"18 },19 \"cpf:outputs\": {20 \"documentOut\": {21 \"cpf:location\": \"multipartLabelOut\",22 \"dc:format\": \"application/pdf\"23 }24 }25}"' \26--form 'InputFile0=@"{{Placeholder for input file (absolute path)}}"'
Create PDF with DocumentLanguage
Use the sample below to create PDFs with supported documentLanguage from Microsoft Office documents (Word, Excel and PowerPoint). The example shows .docx file conversion with english as the language of the input file, the SDK supports the following formats:
- Microsoft Word (DOC, DOCX)
- Microsoft PowerPoint (PPT, PPTX)
- Microsoft Excel (XLS, XLSX)
- Text (TXT, RTF)
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples2// Run the sample:3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.createpdf.CreatePDFFromDOCXWithOptions45public class CreatePDFFromDOCXWithOptions {67 // Initialize the logger.8 private static final Logger LOGGER = LoggerFactory.getLogger(CreatePDFFromDOCXWithOptions.class);910 public static void main(String[] args) {1112 try {1314 // Initial setup, create credentials instance.15 Credentials credentials = Credentials.serviceAccountCredentialsBuilder()16 .fromFile("pdfservices-api-credentials.json")17 .build();1819 //Create an ExecutionContext using credentials and create a new operation instance.20 ExecutionContext executionContext = ExecutionContext.create(credentials);21 CreatePDFOperation createPdfOperation = CreatePDFOperation.createNew();2223 // Set operation input from a source file.24 FileRef source = FileRef.createFromLocalFile("src/main/resources/createPDFInput.docx");25 createPdfOperation.setInput(source);2627 // Provide any custom configuration options for the operation.28 setCustomOptions(createPdfOperation);2930 // Execute the operation.31 FileRef result = createPdfOperation.execute(executionContext);3233 // Save the result to the specified location.34 result.saveAs("output/createPDFFromDOCXWithOptionsOutput.pdf");3536 } catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {37 LOGGER.error("Exception encountered while executing operation", ex);38 }39 }4041 private static void setCustomOptions(CreatePDFOperation createPdfOperation) {42 // Select the documentLanguage for input file.43 SupportedDocumentLanguage documentLanguage = SupportedDocumentLanguage.EN_US;4445 // Set the desired Word-to-PDF conversion options.46 CreatePDFOptions wordOptions = CreatePDFOptions.wordOptionsBuilder().47 withDocumentLanguage(documentLanguage).48 build();4950 createPdfOperation.setOptions(wordOptions);51 }52 }
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_net_samples2// Run the sample:3// cd CreatePDFFromDocxWithOptions/4// dotnet run CreatePDFFromDocxWithOptions.csproj56namespace CreatePDFFromDocxWithOptions7 {8 class Program9 {10 private static readonly ILog log = LogManager.GetLogger(typeof(Program));11 static void Main()12 {13 //Configure the logging14 ConfigureLogging();15 try16 {17 // Initial setup, create credentials instance.18 Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()19 .FromFile(Directory.GetCurrentDirectory() + "/pdfservices-api-credentials.json")20 .Build();2122 //Create an ExecutionContext using credentials and create a new operation instance.23 ExecutionContext executionContext = ExecutionContext.Create(credentials);24 CreatePDFOperation createPdfOperation = CreatePDFOperation.CreateNew();2526 // Set operation input from a source file.27 FileRef source = FileRef.CreateFromLocalFile(@"createPdfInput.docx");28 createPdfOperation.SetInput(source);2930 //Provide any custom conifguration option for the operation.31 SetCustomOptions(createPdfOperation);3233 // Execute the operation.34 FileRef result = createPdfOperation.Execute(executionContext);3536 // Save the result to the specified location.37 result.SaveAs(Directory.GetCurrentDirectory() + "/output/createPDFFromDOCXWithOptionsOutput.pdf");38 }39 catch (ServiceUsageException ex)40 {41 log.Error("Exception encountered while executing operation", ex);42 }43 // Catch more errors here. . .44 }4546 private static void SetCustomOptions(CreatePDFOperation createPdfOperation)47 {48 // Select the documentLanguage for input file.49 SupportedDocumentLanguage documentLanguage = SupportedDocumentLanguage.EN_US;5051 // Set the desired Word-to-PDF conversion options.52 CreatePDFOptions createPDFOptions = CreatePDFOptions.WordOptionsBuilder()53 .WithDocumentLanguage(documentLanguage)54 .Build();55 createPdfOperation.SetOptions(createPDFOptions);56 }5758 static void ConfigureLogging()59 {60 ILoggerRepository logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());61 XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));62 }63 }64 }
Copied to your clipboard1// Get the samples from http://www.adobe.com/go/pdftoolsapi_node_sample2// Run the sample:3// node src/createpdf/create-pdf-from-docx-with-options.js45const PDFServicesSdk = require('@adobe/pdfservices-node-sdk');67const setCustomOptions = (createPdfOperation) => {8 // Select the documentLanguage for input file.9 const documentLanguage = PDFServicesSdk.CreatePDF.options.word.SupportedDocumentLanguage.EN_US;1011 // Set the desired WORD-to-PDF conversion options with documentLanguage.12 const createPdfOptions = new PDFServicesSdk.CreatePDF.options.word.CreatePDFFromWordOptions.Builder()13 .withDocumentLanguage(documentLanguage).build();14 createPdfOperation.setOptions(createPdfOptions);15};1617try {18 // Initial setup, create credentials instance.19 const credentials = PDFServicesSdk.Credentials20 .serviceAccountCredentialsBuilder()21 .fromFile("pdfservices-api-credentials.json")22 .build();2324 // Create an ExecutionContext using credentials and create a new operation instance.25 const executionContext = PDFServicesSdk.ExecutionContext.create(credentials),26 createPdfOperation = PDFServicesSdk.CreatePDF.Operation.createNew();2728 // Set operation input from a source file.29 const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/createPDFInput.docx');30 createPdfOperation.setInput(input);3132 // Provide any custom configuration options for the operation.33 setCustomOptions(createPdfOperation);3435 // Execute the operation and Save the result to the specified location.36 createPdfOperation.execute(executionContext)37 .then(result => result.saveAsFile('output/createPDFFromDOCXWithOptionsOutput.pdf'))38 .catch(err => {39 if(err instanceof PDFServicesSdk.Error.ServiceApiError40 || err instanceof PDFServicesSdk.Error.ServiceUsageError) {41 console.log('Exception encountered while executing operation', err);42 } else {43 console.log('Exception encountered while executing operation', err);44 }45 });46} catch (err) {47 console.log('Exception encountered while executing operation', err);48}
Copied to your clipboard1// Please refer our REST API docs for more information2// https://documentcloud.adobe.com/document-services/index.html#post-createPDF34curl --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' \5--header 'Authorization: Bearer {{Placeholder for token}}' \6--header 'Accept: application/json, text/plain, */*' \7--header 'x-api-key: {{Placeholder for client_id}}' \8--header 'Prefer: respond-async,wait=0' \9--form 'contentAnalyzerRequests="{10 \"cpf:inputs\": {11 \"params\": {12 \"cpf:inline\": {13 \"wordFormatOptions\": {14 \"documentLanguage\": \"ja-JP\"15 }16 }17 },18 \"documentIn\": {19 \"cpf:location\": \"InputFile0\",20 \"dc:format\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"21 }22 },23 \"cpf:engine\": {24 \"repo:assetId\": \"urn:aaid:cpf:Service-1538ece812254acaac2a07799503a430\"25 },26 \"cpf:outputs\": {27 \"documentOut\": {28 \"cpf:location\": \"multipartLabelOut\",29 \"dc:format\": \"application/pdf\"30 }31 }32}"' \33--form 'InputFile0=@"{{Placeholder for input file (absolute path)}}"'
Create a PDF from static HTML
The sample below creates a PDF file from a static HTML file. The file must be local. Since HTML/web pages typically contain external assets, the input file must be a zip file containing an index.html at the top level of the archive as well as any dependencies such as images, css files, and so on.
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples2// Run the sample:3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.createpdf.CreatePDFFromStaticHTML45public class CreatePDFFromStaticHTML {67 // Initialize the logger.8 private static final Logger LOGGER = LoggerFactory.getLogger(CreatePDFFromStaticHTML.class);910 public static void main(String[] args) {1112 try {1314 // Initial setup, create credentials instance.15 Credentials credentials = Credentials.serviceAccountCredentialsBuilder()16 .fromFile("pdfservices-api-credentials.json")17 .build();1819 //Create an ExecutionContext using credentials and create a new operation instance.20 ExecutionContext executionContext = ExecutionContext.create(credentials);21 CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.createNew();2223 // Set operation input from a source file.24 FileRef source = FileRef.createFromLocalFile("src/main/resources/createPDFFromStaticHtmlInput.zip");25 htmlToPDFOperation.setInput(source);2627 // Provide any custom configuration options for the operation.28 setCustomOptions(htmlToPDFOperation);2930 // Execute the operation.31 FileRef result = htmlToPDFOperation.execute(executionContext);3233 // Save the result to the specified location.34 result.saveAs("output/createPDFFromStaticHtmlOutput.pdf");3536 } catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {37 LOGGER.error("Exception encountered while executing operation", ex);38 }39 }4041 private static void setCustomOptions(CreatePDFOperation htmlToPDFOperation) {42 // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation).43 PageLayout pageLayout = new PageLayout();44 pageLayout.setPageSize(8, 11.5);4546 // Set the desired HTML-to-PDF conversion options.47 CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.htmlOptionsBuilder()48 .includeHeaderFooter(true)49 .withPageLayout(pageLayout)50 .build();51 htmlToPDFOperation.setOptions(htmlToPdfOptions);52 }53 }
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_net_samples2// Run the sample:3// cd CreatePDFFromStaticHtml/4// dotnet run CreatePDFFromStaticHtml.csproj56namespace CreatePDFFromStaticHtml7 {8 class Program9 {10 private static readonly ILog log = LogManager.GetLogger(typeof(Program));11 static void Main()12 {13 //Configure the logging14 ConfigureLogging();15 try16 {17 // Initial setup, create credentials instance.18 Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()19 .FromFile(Directory.GetCurrentDirectory() + "/pdfservices-api-credentials.json")20 .Build();2122 //Create an ExecutionContext using credentials and create a new operation instance.23 ExecutionContext executionContext = ExecutionContext.Create(credentials);24 CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.CreateNew();2526 // Set operation input from a source file.27 FileRef source = FileRef.CreateFromLocalFile(@"createPDFFromStaticHtmlInput.zip");28 htmlToPDFOperation.SetInput(source);2930 // Provide any custom configuration options for the operation.31 SetCustomOptions(htmlToPDFOperation);3233 // Execute the operation.34 FileRef result = htmlToPDFOperation.Execute(executionContext);3536 // Save the result to the specified location.37 result.SaveAs(Directory.GetCurrentDirectory() + "/output/createPdfFromStaticHtmlOutput.pdf");38 }39 catch (ServiceUsageException ex)40 {41 log.Error("Exception encountered while executing operation", ex);42 }43 // Catch more errors here. . .44 }4546 private static void SetCustomOptions(CreatePDFOperation htmlToPDFOperation)47 {48 // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation).49 PageLayout pageLayout = new PageLayout();50 pageLayout.SetPageSize(8, 11.5);5152 // Set the desired HTML-to-PDF conversion options.53 CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.HtmlOptionsBuilder()54 .IncludeHeaderFooter(true)55 .WithPageLayout(pageLayout)56 . Build();57 htmlToPDFOperation.SetOptions(htmlToPdfOptions);58 }5960 static void ConfigureLogging()61 {62 ILoggerRepository logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());63 XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));64 }65 }66 }
Copied to your clipboard1// Get the samples from http://www.adobe.com/go/pdftoolsapi_node_sample2// Run the sample:3// node src/createpdf/create-pdf-from-static-html.js45const PDFServicesSdk = require('@adobe/pdfservices-node-sdk');67 const setCustomOptions = (htmlToPDFOperation) => {8 // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation).9 const pageLayout = new PDFServicesSdk.CreatePDF.options.html.PageLayout();10 pageLayout.setPageSize(8, 11.5);1112 // Set the desired HTML-to-PDF conversion options.13 const htmlToPdfOptions = new PDFServicesSdk.CreatePDF.options.html.CreatePDFFromHtmlOptions.Builder()14 .includesHeaderFooter(true)15 .withPageLayout(pageLayout)16 .build();17 htmlToPDFOperation.setOptions(htmlToPdfOptions);18 };192021 try {22 // Initial setup, create credentials instance.23 const credentials = PDFServicesSdk.Credentials24 .serviceAccountCredentialsBuilder()25 .fromFile("pdfservices-api-credentials.json")26 .build();2728 // Create an ExecutionContext using credentials and create a new operation instance.29 const executionContext = PDFServicesSdk.ExecutionContext.create(credentials),30 htmlToPDFOperation = PDFServicesSdk.CreatePDF.Operation.createNew();3132 // Set operation input from a source file.33 const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/createPDFFromStaticHtmlInput.zip');34 htmlToPDFOperation.setInput(input);3536 // Provide any custom configuration options for the operation.37 setCustomOptions(htmlToPDFOperation);3839 // Execute the operation and Save the result to the specified location.40 htmlToPDFOperation.execute(executionContext)41 .then(result => result.saveAsFile('output/createPdfFromStaticHtmlOutput.pdf'))42 .catch(err => {43 if(err instanceof PDFServicesSdk.Error.ServiceApiError44 || err instanceof PDFServicesSdk.Error.ServiceUsageError) {45 console.log('Exception encountered while executing operation', err);46 } else {47 console.log('Exception encountered while executing operation', err);48 }49 });50 } catch (err) {51 console.log('Exception encountered while executing operation', err);52 }
Copied to your clipboard1// Please refer our REST API docs for more information2// https://documentcloud.adobe.com/document-services/index.html#post-htmlToPDF34curl --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' \5--header 'Authorization: Bearer {{Placeholder for token}}' \6--header 'Accept: application/json, text/plain, */*' \7--header 'x-api-key: {{Placeholder for client_id}}' \8--header 'Prefer: respond-async,wait=0' \9--form 'contentAnalyzerRequests="{10 \"cpf:inputs\": {11 \"params\": {12 \"cpf:inline\": {13 \"print\": {14 \"includeHeaderFooter\": true15 },16 \"pageLayout\": {17 \"pageHeight\": 8.5,18 \"pageWidth\": 1119 },20 \"json\": \"{\\\"k1\\\": \\\"v1\\\", \\\"k2\\\": \\\"v2\\\"}\"21 }22 },23 \"documentIn\": {24 \"cpf:location\": \"InputFile0\",25 \"dc:format\": \"application/zip\"26 }27 },28 \"cpf:engine\": {29 \"repo:assetId\": \"urn:aaid:cpf:Service-e2ee120a2b06427cb449592f5db967e7\"30 },31 \"cpf:outputs\": {32 \"documentOut\": {33 \"cpf:location\": \"multipartLabelOut\",34 \"dc:format\": \"application/pdf\"35 }36 }37}"' \38--form 'InputFile0=@"{{Placeholder for input file (absolute path)}}"'
Create a PDF from static HTML with inline CSS
The sample below creates a PDF file from a static HTML file with inline CSS. The file must be local.
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples2// Run the sample:3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.createpdf.CreatePDFFromHTMLWithInlineCSS45 public class CreatePDFFromHTMLWithInlineCSS {67 // Initialize the logger.8 private static final Logger LOGGER = LoggerFactory.getLogger(CreatePDFFromStaticHTML.class);910 public static void main(String[] args) {1112 try {1314 // Initial setup, create credentials instance.15 Credentials credentials = Credentials.serviceAccountCredentialsBuilder()16 .fromFile("pdfservices-api-credentials.json")17 .build();1819 //Create an ExecutionContext using credentials and create a new operation instance.20 ExecutionContext executionContext = ExecutionContext.create(credentials);21 CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.createNew();2223 // Set operation input from a source file.24 FileRef source = FileRef.createFromLocalFile("src/main/resources/createPDFFromHTMLWithInlineCSSInput.html");25 htmlToPDFOperation.setInput(source);2627 // Provide any custom configuration options for the operation.28 setCustomOptions(htmlToPDFOperation);2930 // Execute the operation.31 FileRef result = htmlToPDFOperation.execute(executionContext);3233 // Save the result to the specified location.34 result.saveAs("output/createPDFFromHTMLWithInlineCSSOutput.pdf");3536 } catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {37 LOGGER.error("Exception encountered while executing operation", ex);38 }39 }4041 private static void setCustomOptions(CreatePDFOperation htmlToPDFOperation) {42 // Define the page layout, in this case an 20 x 25 inch page (effectively portrait orientation).43 PageLayout pageLayout = new PageLayout();44 pageLayout.setPageSize(20, 25);4546 // Set the desired HTML-to-PDF conversion options.47 CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.htmlOptionsBuilder()48 .includeHeaderFooter(true)49 .withPageLayout(pageLayout)50 .build();51 htmlToPDFOperation.setOptions(htmlToPdfOptions);52 }53 }
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_net_samples2// Run the sample:3// cd CreatePDFFromHTMLWithInlineCSS/4// dotnet run CreatePDFFromHTMLWithInlineCSS.csproj56namespace CreatePDFFromHTMLWithInlineCSS7 {8 class Program9 {10 private static readonly ILog log = LogManager.GetLogger(typeof(Program));11 static void Main()12 {13 //Configure the logging14 ConfigureLogging();15 try16 {17 // Initial setup, create credentials instance.18 Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()19 .FromFile(Directory.GetCurrentDirectory() + "/pdfservices-api-credentials.json")20 .Build();2122 //Create an ExecutionContext using credentials and create a new operation instance.23 ExecutionContext executionContext = ExecutionContext.Create(credentials);24 CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.CreateNew();2526 // Set operation input from a source file.27 FileRef source = FileRef.CreateFromLocalFile(@"createPDFFromHTMLWithInlineCSSInput.html");28 htmlToPDFOperation.SetInput(source);2930 // Provide any custom configuration options for the operation.31 SetCustomOptions(htmlToPDFOperation);3233 // Execute the operation.34 FileRef result = htmlToPDFOperation.Execute(executionContext);3536 // Save the result to the specified location.37 result.SaveAs(Directory.GetCurrentDirectory() + "/output/createPDFFromHTMLWithInlineCSSOutput.pdf");38 }39 catch (ServiceUsageException ex)40 {41 log.Error("Exception encountered while executing operation", ex);42 }43 // Catch more errors here. . .44 }4546 private static void SetCustomOptions(CreatePDFOperation htmlToPDFOperation)47 {48 // Define the page layout, in this case an 20 x 25 inch page (effectively portrait orientation).49 PageLayout pageLayout = new PageLayout();50 pageLayout.SetPageSize(20, 25);5152 // Set the desired HTML-to-PDF conversion options.53 CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.HtmlOptionsBuilder()54 .IncludeHeaderFooter(true)55 .WithPageLayout(pageLayout)56 . Build();57 htmlToPDFOperation.SetOptions(htmlToPdfOptions);58 }5960 static void ConfigureLogging()61 {62 ILoggerRepository logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());63 XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));64 }65 }66 }
Copied to your clipboard1// Get the samples from http://www.adobe.com/go/pdftoolsapi_node_sample2// Run the sample:3// node src/create-pdf-from-html-with-inline-css.js45const PDFServicesSdk = require('@adobe/pdfservices-node-sdk');67const setCustomOptions = (htmlToPDFOperation) => {8 // Define the page layout, in this case an 20 x 25 inch page (effectively portrait orientation).9 const pageLayout = new PDFServicesSdk.CreatePDF.options.html.PageLayout();10 pageLayout.setPageSize(20, 25);1112 // Set the desired HTML-to-PDF conversion options.13 const htmlToPdfOptions = new PDFServicesSdk.CreatePDF.options.html.CreatePDFFromHtmlOptions.Builder()14 .includesHeaderFooter(true)15 .withPageLayout(pageLayout)16 .build();17 htmlToPDFOperation.setOptions(htmlToPdfOptions);18};192021try {22 // Initial setup, create credentials instance.23 const credentials = PDFServicesSdk.Credentials24 .serviceAccountCredentialsBuilder()25 .fromFile("pdfservices-api-credentials.json")26 .build();2728 // Create an ExecutionContext using credentials and create a new operation instance.29 const executionContext = PDFServicesSdk.ExecutionContext.create(credentials),30 htmlToPDFOperation = PDFServicesSdk.CreatePDF.Operation.createNew();3132 // Set operation input from a source file.33 const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/createPDFFromHTMLWithInlineCSSInput.html');34 htmlToPDFOperation.setInput(input);3536 // Provide any custom configuration options for the operation.37 setCustomOptions(htmlToPDFOperation);3839 // Execute the operation and Save the result to the specified location.40 htmlToPDFOperation.execute(executionContext)41 .then(result => result.saveAsFile('output/createPDFFromHTMLWithInlineCSSOutput.pdf'))42 .catch(err => {43 if(err instanceof PDFServicesSdk.Error.ServiceApiError44 || err instanceof PDFServicesSdk.Error.ServiceUsageError) {45 console.log('Exception encountered while executing operation', err);46 } else {47 console.log('Exception encountered while executing operation', err);48 }49 });50} catch (err) {51 console.log('Exception encountered while executing operation', err);52}
Copied to your clipboard1// Please refer our REST API docs for more information2// https://documentcloud.adobe.com/document-services/index.html#post-htmlToPDF34curl --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' \5--header 'Authorization: Bearer {{Placeholder for token}}' \6--header 'Accept: application/json, text/plain, */*' \7--header 'x-api-key: {{Placeholder for client_id}}' \8--header 'Prefer: respond-async,wait=0' \9--form 'contentAnalyzerRequests="{10 \"cpf:inputs\": {11 \"params\": {12 \"cpf:inline\": {13 \"print\": {14 \"includeHeaderFooter\": true15 },16 \"pageLayout\": {17 \"pageHeight\": 8.5,18 \"pageWidth\": 1119 },20 \"json\": \"{\\\"k1\\\": \\\"v1\\\", \\\"k2\\\": \\\"v2\\\"}\"21 }22 },23 \"documentIn\": {24 \"cpf:location\": \"InputFile0\",25 \"dc:format\": \"application/zip\"26 }27 },28 \"cpf:engine\": {29 \"repo:assetId\": \"urn:aaid:cpf:Service-e2ee120a2b06427cb449592f5db967e7\"30 },31 \"cpf:outputs\": {32 \"documentOut\": {33 \"cpf:location\": \"multipartLabelOut\",34 \"dc:format\": \"application/pdf\"35 }36 }37}"' \38--form 'InputFile0=@"{{Placeholder for input file (absolute path)}}"'
Create a PDF File From HTML specified via URL
The sample below creates a PDF file from a HTML file specified via URL.
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples2// Run the sample:3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.createpdf.CreatePDFFromURL45 public class CreatePDFFromURL {67 // Initialize the logger.8 private static final Logger LOGGER = LoggerFactory.getLogger(CreatePDFFromStaticHTML.class);910 public static void main(String[] args) {1112 try {1314 // Initial setup, create credentials instance.15 Credentials credentials = Credentials.serviceAccountCredentialsBuilder()16 .fromFile("pdfservices-api-credentials.json")17 .build();1819 //Create an ExecutionContext using credentials and create a new operation instance.20 ExecutionContext executionContext = ExecutionContext.create(credentials);21 CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.createNew();2223 // Set operation input from a source URL.24 FileRef source = FileRef.createFromURL(new URL("https://www.adobe.io"));25 htmlToPDFOperation.setInput(source);2627 // Provide any custom configuration options for the operation.28 setCustomOptions(htmlToPDFOperation);2930 // Execute the operation.31 FileRef result = htmlToPDFOperation.execute(executionContext);3233 // Save the result to the specified location.34 result.saveAs("output/createPDFFromURLOutput.pdf");3536 } catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {37 LOGGER.error("Exception encountered while executing operation", ex);38 }39 }4041 private static void setCustomOptions(CreatePDFOperation htmlToPDFOperation) {42 // Define the page layout, in this case an 20 x 25 inch page (effectively portrait orientation).43 PageLayout pageLayout = new PageLayout();44 pageLayout.setPageSize(20, 25);4546 // Set the desired HTML-to-PDF conversion options.47 CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.htmlOptionsBuilder()48 .includeHeaderFooter(true)49 .withPageLayout(pageLayout)50 .build();51 htmlToPDFOperation.setOptions(htmlToPdfOptions);52 }53 }
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_net_samples2// Run the sample:3// cd CreatePDFFromURL/4// dotnet run CreatePDFFromURL.csproj56namespace CreatePDFFromURL7{8 class Program9 {10 private static readonly ILog log = LogManager.GetLogger(typeof(Program));11 static void Main()12 {13 //Configure the logging14 ConfigureLogging();15 try16 {17 // Initial setup, create credentials instance.18 Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()19 .FromFile(Directory.GetCurrentDirectory() + "/pdfservices-api-credentials.json")20 .Build();2122 //Create an ExecutionContext using credentials and create a new operation instance.23 ExecutionContext executionContext = ExecutionContext.Create(credentials);24 CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.CreateNew();2526 // Set operation input from a source URL.27 FileRef source = FileRef.CreateFromURI(new Uri("https://www.adobe.io"));28 htmlToPDFOperation.SetInput(source);2930 // Provide any custom configuration options for the operation.31 SetCustomOptions(htmlToPDFOperation);3233 // Execute the operation.34 FileRef result = htmlToPDFOperation.Execute(executionContext);3536 // Save the result to the specified location.37 result.SaveAs(Directory.GetCurrentDirectory() + "/output/createPdfFromURLOutput.pdf");38 }39 catch (ServiceUsageException ex)40 {41 log.Error("Exception encountered while executing operation", ex);42 }43 // Catch more errors here. . .44 }4546 private static void SetCustomOptions(CreatePDFOperation htmlToPDFOperation)47 {48 // Define the page layout, in this case an 20 x 25 inch page (effectively portrait orientation).49 PageLayout pageLayout = new PageLayout();50 pageLayout.SetPageSize(20, 25);5152 // Set the desired HTML-to-PDF conversion options.53 CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.HtmlOptionsBuilder()54 .IncludeHeaderFooter(true)55 .WithPageLayout(pageLayout)56 . Build();57 htmlToPDFOperation.SetOptions(htmlToPdfOptions);58 }5960 static void ConfigureLogging()61 {62 ILoggerRepository logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());63 XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));64 }65}66}
Copied to your clipboard1// Get the samples from http://www.adobe.com/go/pdftoolsapi_node_sample2// Run the sample:3// node src/create-pdf-from-url.js4const PDFServicesSdk = require('@adobe/pdfservices-node-sdk');56const setCustomOptions = (htmlToPDFOperation) => {7 // Define the page layout, in this case an 20 x 25 inch page (effectively portrait orientation).8 const pageLayout = new PDFServicesSdk.CreatePDF.options.html.PageLayout();9 pageLayout.setPageSize(20, 25);1011 // Set the desired HTML-to-PDF conversion options.12 const htmlToPdfOptions = new PDFServicesSdk.CreatePDF.options.html.CreatePDFFromHtmlOptions.Builder()13 .includesHeaderFooter(true)14 .withPageLayout(pageLayout)15 .build();16 htmlToPDFOperation.setOptions(htmlToPdfOptions);17};181920try {21 // Initial setup, create credentials instance.22 const credentials = PDFServicesSdk.Credentials23 .serviceAccountCredentialsBuilder()24 .fromFile("pdfservices-api-credentials.json")25 .build();2627 // Create an ExecutionContext using credentials and create a new operation instance.28 const executionContext = PDFServicesSdk.ExecutionContext.create(credentials),29 htmlToPDFOperation = PDFServicesSdk.CreatePDF.Operation.createNew();3031 // Set operation input from a source file.32 const input = PDFServicesSdk.FileRef.createFromURL(33 "https://www.adobe.io"34 );35 htmlToPDFOperation.setInput(input);3637 // Provide any custom configuration options for the operation.38 setCustomOptions(htmlToPDFOperation);3940 // Execute the operation and Save the result to the specified location.41 htmlToPDFOperation.execute(executionContext)42 .then(result => result.saveAsFile('output/createPdfFromURLOutput.pdf'))43 .catch(err => {44 if(err instanceof PDFServicesSdk.Error.ServiceApiError45 || err instanceof PDFServicesSdk.Error.ServiceUsageError) {46 console.log('Exception encountered while executing operation', err);47 } else {48 console.log('Exception encountered while executing operation', err);49 }50 });51} catch (err) {52 console.log('Exception encountered while executing operation', err);53}
Copied to your clipboard1// Please refer our REST API docs for more information2// https://documentcloud.adobe.com/document-services/index.html#post-htmlToPDF34curl --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' \5--header 'Authorization: Bearer {{Placeholder for token}}' \6--header 'Accept: application/json, text/plain, */*' \7--header 'x-api-key: {{Placeholder for client_id}}' \8--header 'Prefer: respond-async,wait=0' \9--form 'contentAnalyzerRequests="{10 \"cpf:inputs\": {11 \"params\": {12 \"cpf:inline\": {13 \"print\": {14 \"includeHeaderFooter\": true15 },16 \"pageLayout\": {17 \"pageHeight\": 8.5,18 \"pageWidth\": 1119 },20 \"json\": \"{\\\"k1\\\": \\\"v1\\\", \\\"k2\\\": \\\"v2\\\"}\"21 }22 },23 \"inputUrl\": \"{{Placeholder for inputUrl}}\"24 },25 \"cpf:engine\": {26 \"repo:assetId\": \"urn:aaid:cpf:Service-e2ee120a2b06427cb449592f5db967e7\"27 },28 \"cpf:outputs\": {29 \"documentOut\": {30 \"cpf:location\": \"multipartLabelOut\",31 \"dc:format\": \"application/pdf\"32 }33 }34}"'
Create a PDF from dynamic HTML
To support workflows with dynamic data, CreatePDFFromDynamicHTML
creates PDFs from dynamic HTML. It's a common scenario for enterprise to
provide end users with an HTML template with form fields. This API
allows you to capture the users unique data entries and then save it as
PDF. Collected data is stored in a JSON file, and the source HTML file
must include <script src='./json.js' type='text/javascript'></script>
.
Refer to the API docs for usage.
The sample CreatePDFFromDynamicHTML
converts a zip file, containing
the input HTML file and its resources, along with the input data to a
PDF file. The input data is used by the JavaScript in the HTML file to
manipulate the HTML DOM, thus effectively updating the source HTML file.
This mechanism can be used to provide data to the template HTML
dynamically prior to PDF conversion.
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples2// Run the sample:3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.createpdf.CreatePDFFromDynamicHTML4 public class CreatePDFFromDynamicHTML {56 // Initialize the logger.7 private static final Logger LOGGER = LoggerFactory.getLogger(CreatePDFFromDynamicHTML.class);89 public static void main(String[] args) {1011 try {1213 // Initial setup, create credentials instance.14 Credentials credentials = Credentials.serviceAccountCredentialsBuilder()15 .fromFile("pdfservices-api-credentials.json")16 .build();1718 //Create an ExecutionContext using credentials and create a new operation instance.19 ExecutionContext executionContext = ExecutionContext.create(credentials);20 CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.createNew();2122 // Set operation input from a source file.23 FileRef source = FileRef.createFromLocalFile("src/main/resources/createPDFFromDynamicHtmlInput.zip");24 htmlToPDFOperation.setInput(source);2526 // Provide any custom configuration options for the operation.27 setCustomOptions(htmlToPDFOperation);2829 // Execute the operation.30 FileRef result = htmlToPDFOperation.execute(executionContext);3132 // Save the result to the specified location.33 result.saveAs("output/createPDFFromDynamicHtmlOutput.pdf");3435 } catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {36 LOGGER.error("Exception encountered while executing operation", ex);37 }38 }3940 private static void setCustomOptions(CreatePDFOperation htmlToPDFOperation) {41 // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation).42 PageLayout pageLayout = new PageLayout();43 pageLayout.setPageSize(8, 11.5);4445 //Set the dataToMerge field that needs to be populated in the HTML before its conversion46 JSONObject dataToMerge = new JSONObject();47 dataToMerge.put("title","Create, Convert PDFs and More!");48 dataToMerge.put("sub_title","Easily integrate PDF actions within your document workflows.");4950 // Set the desired HTML-to-PDF conversion options.51 CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.htmlOptionsBuilder()52 .includeHeaderFooter(true)53 .withPageLayout(pageLayout)54 .withDataToMerge(dataToMerge)55 .build();56 htmlToPDFOperation.setOptions(htmlToPdfOptions);57 }58 }
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_net_samples2// Run the sample:3// cd CreatePDFFromDynamicHtml/4// dotnet run CreatePDFFromDynamicHtml.csproj56 namespace CreatePDFFromDynamicHtml7 {8 class Program9 {10 private static readonly ILog log = LogManager.GetLogger(typeof(Program));11 static void Main()12 {13 //Configure the logging14 ConfigureLogging();15 try16 {17 // Initial setup, create credentials instance.18 Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()19 .FromFile(Directory.GetCurrentDirectory() + "/pdfservices-api-credentials.json")20 .Build();2122 //Create an ExecutionContext using credentials and create a new operation instance.23 ExecutionContext executionContext = ExecutionContext.Create(credentials);24 CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.CreateNew();2526 // Set operation input from a source file.27 FileRef source = FileRef.CreateFromLocalFile(@"createPDFFromDynamicHtmlInput.zip");28 htmlToPDFOperation.SetInput(source);2930 // Provide any custom configuration options for the operation.31 SetCustomOptions(htmlToPDFOperation);3233 // Execute the operation.34 FileRef result = htmlToPDFOperation.Execute(executionContext);3536 // Save the result to the specified location.37 result.SaveAs(Directory.GetCurrentDirectory() + "/output/createPdfFromDynamicHtmlOutput.pdf");38 }39 catch (ServiceUsageException ex)40 {41 log.Error("Exception encountered while executing operation", ex);42 }43 // errors continued. . .44 }4546 private static void SetCustomOptions(CreatePDFOperation htmlToPDFOperation)47 {48 // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation).49 PageLayout pageLayout = new PageLayout();50 pageLayout.SetPageSize(8, 11.5);5152 //Set the dataToMerge field that needs to be populated in the HTML before its conversion53 JObject dataToMerge = new JObject54 {55 { "title", "Create, Convert PDFs and More!" },56 { "sub_title", "Easily integrate PDF actions within your document workflows." }57 };5859 // Set the desired HTML-to-PDF conversion options.60 CreatePDFOptions htmlToPdfOptions = CreatePDFOptions.HtmlOptionsBuilder()61 .IncludeHeaderFooter(true)62 .WithPageLayout(pageLayout)63 .WithDataToMerge(dataToMerge)64 .Build();65 htmlToPDFOperation.SetOptions(htmlToPdfOptions);66 }6768 static void ConfigureLogging()69 {70 ILoggerRepository logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());71 XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));72 }73 }74 }
Copied to your clipboard1// Get the samples from http://www.adobe.com/go/pdftoolsapi_node_sample2// Run the sample:3// node src/createpdf/create-pdf-from-dynamic-html.js45const PDFServicesSdk = require('@adobe/pdfservices-node-sdk');67 const setCustomOptions = (htmlToPDFOperation) => {8 // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation).9 const pageLayout = new PDFServicesSdk.CreatePDF.options.html.PageLayout();10 pageLayout.setPageSize(8, 11.5);11 //Set the dataToMerge field that needs to be populated in the HTML before its conversion.12 const dataToMerge = {13 "title":"Create, Convert PDFs and More!",14 "sub_title": "Easily integrate PDF actions within your document workflows."15 };16 // Set the desired HTML-to-PDF conversion options.17 const htmlToPdfOptions = new PDFServicesSdk.CreatePDF.options.html.CreatePDFFromHtmlOptions.Builder()18 .includesHeaderFooter(true)19 .withPageLayout(pageLayout)20 .withDataToMerge(dataToMerge)21 .build();22 htmlToPDFOperation.setOptions(htmlToPdfOptions);23 };242526 try {27 // Initial setup, create credentials instance.28 const credentials = PDFServicesSdk.Credentials29 .serviceAccountCredentialsBuilder()30 .fromFile("pdfservices-api-credentials.json")31 .build();3233 // Create an ExecutionContext using credentials and create a new operation instance.34 const executionContext = PDFServicesSdk.ExecutionContext.create(credentials),35 htmlToPDFOperation = PDFServicesSdk.CreatePDF.Operation.createNew();3637 // Set operation input from a source file.38 const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/createPDFFromDynamicHtmlInput.zip');39 htmlToPDFOperation.setInput(input);4041 // Provide any custom configuration options for the operation.42 setCustomOptions(htmlToPDFOperation);4344 // Execute the operation and Save the result to the specified location.45 htmlToPDFOperation.execute(executionContext)46 .then(result => result.saveAsFile('output/createPdfFromDynamicHtmlOutput.pdf'))47 .catch(err => {48 if(err instanceof PDFServicesSdk.Error.ServiceApiError49 || err instanceof PDFServicesSdk.Error.ServiceUsageError) {50 console.log('Exception encountered while executing operation', err);51 } else {52 console.log('Exception encountered while executing operation', err);53 }54 });55 } catch (err) {56 console.log('Exception encountered while executing operation', err);57 }
Copied to your clipboard1// Please refer our REST API docs for more information2// https://documentcloud.adobe.com/document-services/index.html#post-htmlToPDF34curl --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' \5--header 'Authorization: Bearer {{Placeholder for token}}' \6--header 'Accept: application/json, text/plain, */*' \7--header 'x-api-key: {{Placeholder for client_id}}' \8--header 'Prefer: respond-async,wait=0' \9--form 'contentAnalyzerRequests="{10 \"cpf:inputs\": {11 \"params\": {12 \"cpf:inline\": {13 \"print\": {14 \"includeHeaderFooter\": true15 },16 \"pageLayout\": {17 \"pageHeight\": 8.5,18 \"pageWidth\": 1119 },20 \"json\": \"{\\\"k1\\\": \\\"v1\\\", \\\"k2\\\": \\\"v2\\\"}\"21 }22 },23 \"documentIn\": {24 \"cpf:location\": \"InputFile0\",25 \"dc:format\": \"application/zip\"26 }27 },28 \"cpf:engine\": {29 \"repo:assetId\": \"urn:aaid:cpf:Service-e2ee120a2b06427cb449592f5db967e7\"30 },31 \"cpf:outputs\": {32 \"documentOut\": {33 \"cpf:location\": \"multipartLabelOut\",34 \"dc:format\": \"application/pdf\"35 }36 }37}"' \38--form 'InputFile0=@"{{Placeholder for input file (absolute path)}}"'