Converting My Web Content To Pdf Using Download Button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Converting My Web Content To Pdf Using Download Button

I've made my web page now i want to add a download button that will download the content in pdf. How to implement this?

5th Feb 2019, 6:41 PM
Aftab Siddique
Aftab Siddique - avatar
9 Answers
+ 7
I think it is related to how data in pages is handled. They are probably kept in a database. If they are so you can easily collect the necessary data and make pdf from them. Making the pdf depends on the server side programming language. You could make a search based on your server side programming language to learn how to do it.
6th Feb 2019, 1:22 PM
Yusuf
Yusuf - avatar
+ 4
You will probably have to find a javascript library with this kind of functionality. I remember seeing a library where I work that is called pdf.js. I'm not sure how it works with downloading though.
6th Feb 2019, 12:49 AM
Zeke Williams
Zeke Williams - avatar
+ 4
ok i'll see.
6th Feb 2019, 1:30 AM
Aftab Siddique
Aftab Siddique - avatar
+ 4
I think the idle of C# which is Visual Studio is really easy to develop a website from scratch. Actually, many things are easy to done in Visual Studio. Since C# is natively supported in Visual Studio, C# is a good choice as a server side programming language. But in order to develop a website, you should learn to program in C# language. This could be hard it depends on your previous programming language knowledge. If you learnt Python like languages, then it will not be easy to learn. If you learnt C like languages, then you have already know the %50 of the C# language. If you say I want to learn the language which is easy to learn then you should go with Python. After that you will probably learn Django. There are another languages too, Php, Java, Ruby etc. But preparing the server environment could be hard in some of them.
6th Feb 2019, 9:30 PM
Yusuf
Yusuf - avatar
+ 2
What will be the best server based language for a beginner?
6th Feb 2019, 4:28 PM
Aftab Siddique
Aftab Siddique - avatar
+ 2
You can use this library if you want to create PDF files out of html code https://github.com/MrRio/jsPDF the documentation is easy to read and follow and it has a lot of examples. You can also print all page conent using window.print(); method which opens a print dialog of the browser which you can choose to download as pdf or print the page. Just add this code to an onclick event handler and it should work.
7th Feb 2019, 11:45 PM
Mahmoud Mokhtar
Mahmoud Mokhtar - avatar
0
Alright! I know python like 10-20% so i think i can learn python without much difficulty.
7th Feb 2019, 1:46 AM
Aftab Siddique
Aftab Siddique - avatar
0
WOW! Thanks man it helped a lot.
8th Feb 2019, 2:15 AM
Aftab Siddique
Aftab Siddique - avatar
- 1
a
6th Feb 2019, 4:12 AM
もみ もみじ