This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| previewFilePromise.then(adobeViewer => { | |
| adobeViewer.getAPIs().then(apis => { | |
| apis.getSelectedContent() | |
| .then(result => console.log(result)) | |
| .catch(error => console.log(error)); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Adobe Document Cloud PDF Embed API Sample</title> | |
| <meta charset="utf-8"/> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> | |
| <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1"/> | |
| </head> | |
| <body style="margin: 0px"> | |
| <div id="adobe-dc-view"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fields = ["dc:title", "dc:creator", "xmp:CreateDate"]; | |
| const includeRawStream = true; | |
| previewFilePromise.then(adobeViewer => { | |
| adobeViewer.getAPIs().then(apis => { | |
| apis.getXMPMetadata(fields, includeRawStream) | |
| .then(result => console.log(result)) | |
| .catch(error => console.log(error)); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="./json.js'></script>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <body onload = "initial()"> | |
| <script src="./json.js"></script> | |
| <script type="text/javascript"> | |
| /* | |
| The initial() function merges information from the JSON you pass during document generation. | |
| */ | |
| // Converts numbers into currency | |
| function currencyFormat(num) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try { | |
| // Initial setup, create credentials instance. | |
| const credentials = DCServicesSdk.Credentials | |
| .serviceAccountCredentialsBuilder() | |
| .fromFile("dc-services-sdk-credentials.json") | |
| .build(); | |
| // Create an ExecutionContext using credentials and create a new operation instance. | |
| const executionContext = DCServicesSdk.ExecutionContext.create(credentials), | |
| htmlToPDFOperation = DCServicesSdk.CreatePDF.Operation.createNew(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const setCustomOptions = (htmlToPDFOperation) => { | |
| // Define the page layout, in this case an 8 x 11.5 inch page (effectively portrait orientation). | |
| const pageLayout = new DCServicesSdk.CreatePDF.options.PageLayout(); | |
| pageLayout.setPageSize(8, 11.5); | |
| //Set the dataToMerge field that needs to be populated in the HTML before its conversion. | |
| const dataToMerge = { | |
| "invoiceNo":"123456", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try { | |
| // Initial setup, create credentials instance. | |
| const credentials = DCServicesSdk.Credentials | |
| .serviceAccountCredentialsBuilder() | |
| .fromFile("dc-services-sdk-credentials.json") | |
| .build(); | |
| //Create an ExecutionContext using credentials and create a new operation instance. | |
| const executionContext = DCServicesSdk.ExecutionContext.create(credentials), | |
| exportPDF = DCServicesSdk.ExportPDF, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const DCServicesSdk = require('@adobe/dc-services-node-sdk'); | |
| try { | |
| // Initial setup, create credentials instance. | |
| const credentials = DCServicesSdk.Credentials | |
| .serviceAccountCredentialsBuilder() | |
| .fromFile("dc-services-sdk-credentials.json") | |
| .build(); | |
| // Create an ExecutionContext using credentials and create a new operation instance. | |
| const executionContext = DCServicesSdk.ExecutionContext.create(credentials), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| adobeDCView.registerCallback( | |
| /* Type of call back */ | |
| AdobeDC.View.Enum.CallbackType.EVENT_LISTENER, | |
| /* call back function */ | |
| function(event) { | |
| console.log(event); | |
| }, | |
| { | |
| enablePDFAnalytics: true, | |
| } |