function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tirantiran 

Javascript in PDF

Hello everyone.

 

I came acrosee a problem,that is:

 

I created a page,renderAs="pdf",then in components,i got all datas to the body part. So,the result is when i click un button in the opportunity,i can get a pdf.

 

But my chef ask me to add the javascript that can call a  mouse events when passing a url in the PDF.

 

I want to know that it is possible to implement this funtion or not? and how?

 

Thank u !

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You can't change anything in the body, as its not an HTML page, its a PDF.

All Answers

bob_buzzardbob_buzzard

You can't have javascript in a PDF, as that isn't part of PDF and thus won't be supported by the reader.

 

 

tirantiran

Thank ur anwer.

 

But when i passing the url,in the pdf,will show its address of url , it is possible to change the content in that part ?

bob_buzzardbob_buzzard

The URL is simply a locator for the PDF page.  The only thing you can change is the address.

tirantiran

 

that says i cannot change anything in the white part?

bob_buzzardbob_buzzard

You can't change anything in the body, as its not an HTML page, its a PDF.

This was selected as the best answer
miteshsuramiteshsura

Here is what I did and hope it helps someone:

 

Create a normail VF page with all JS logic you like. Have an iFrame that will point to the PDF page. This is even better, as you have more control over it, if you are passing parameters to embedded PDF page.