TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Export To PDF In SharePoint
Guest User
May 05, 2017
33.5
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
This blog helps you to export to PDF in SharePoint.
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
Next Recommended Reading
Introduction To SharePoint 2016 Add-ins (aka apps)