PDF embedded in page / dmx.parse inside a Javascript

Hello everyone,

I m using the Adobe PDF Embed Api to show a PDF inside a page in node.js.
I wrap the script in a function, that will start once the S3 download component returned the S3 address.

The only problem is that I cannot insert the address from the S3 download component inside of the script.

Here the lines of code concerning the URL

adobeDCView.previewFile({
			content:{location: {url: dmx.parse("content.serverconnect1.data.sign")}}, 
			metaData:{fileName: "TEST"}

I used the dmx.parse("content.serverconnect1.data.sign") but it doesn’t works…

any suggestions?

EDIT:

in the original script the URL is written like that:

content:{location: {url: "https://www.website.com/file.pdf" }},

Have you tried downloading the file from S3 to your server first, and only then sending its path to Adobe? In this case, you need to receive the file using a server-side extension and pass the path to it to the front

IF I put the S3 Keyname, it works correctly.
The problem is that I need it being dynamic so I must use a variable and cannot understand how to put a variable there.

Without seeing your structure, I can’t say for sure, but try something like

url : dmx.parse(‘data.url’, dmx.app.find(‘serverconnectname’)

Here the script:

  <script type="text/javascript">
                
              document.addEventListener("adobe_dc_view_sdk.ready", function(){ 
		var adobeDCView = new AdobeDC.View({clientId: "43ae7545da134fa985fade512f5a236d", divId: "adobe-dc-view"});
       
		adobeDCView.previewFile({
			content:{location: {url: dmx.parse("content.var1.value")}}, 
			metaData:{fileName: "CAUSACONNECT"}
		}, {});
	});
            
            </script>

How do you get the url value before writing it to the var1 variable and at what point do you write it there, based on what event? Maybe the value doesn’t have time to get there?

the code that Adobe give you is the following:

<div id="adobe-dc-view"></div>
<script src="https://acrobatservices.adobe.com/view-sdk/viewer.js"></script>
<script type="text/javascript">
	document.addEventListener("adobe_dc_view_sdk.ready", function(){ 
		var adobeDCView = new AdobeDC.View({clientId: "<YOUR_CLIENT_ID>", divId: "adobe-dc-view"});
		adobeDCView.previewFile({
			content:{location: {url: "https://acrobatservices.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf"}},
			metaData:{fileName: "Bodea Brochure.pdf"}
		}, {});
	});
</script>

What I did? I wrap it in a function so I will call it only when value updated in the var1:

`



`

Instead to content:{location: {url: “https://acrobatservices.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf”}}, I need to have the var1.value

Not shure, but maybe try that

url : dmx.parse(‘value’, dmx.app.find(‘var1’)

OK will try thank you !!!