Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Export To PDF In SharePoint
WhatsApp
Guest User
8y
34.7
k
0
0
25
Blog
Create a Web page retrieving content from the various lists.
Add a button called Export to PDF in an HTML file.
Set the onclick event for the button, as shown below.
<div>
<br>
<input type=
"button"
id=
"exporttopdf"
value=
"Export to PDF"
onclick=
"exportSelectedItemsToPdf();"
style=
"display:none;"
/>
<span> </span><input type=
"button"
value=
"Print"
id=
"print"
style=
"display:none"
onclick=
"PrintElem(this);"
/>
</div>
Here is the function representing linked to that button and gets executed when triggered.
function
exportSelectedItemsToPdf() {
var
documentPDF =
new
jsPDF();
var
caseid = $(
"#caseid_lb"
).text();
var
specialElementHandlers = {
'#editor'
:
function
(element, renderer) {
return
true
;
}
};
documentPDF.fromHTML($(
'#tab-5'
).html(), 15, 15, {
'width'
: 600,
'elementHandlers'
: specialElementHandlers
});
documentPDF.save(
'Case Id - '
+ caseid +
'.pdf'
);
}
Click the button for the result.
Here is the PDF, which gets downloaded.
Here is the PDF document when opened.
SharePoint
People also reading
Membership not found