I am newbie in web development. I have a html page where there is some article having text and some pictures. I want to make the content of that html page into pdf and download it using "download as pdf" button. How can convert the html page into pdf and download that page using nodejs. A sample code or demonstration will be great help.
A general solution to what you are asking for is to use a headless browser, like PhantomJS, running on your backend to render the requested page, then export it as a PDF, before finally stream it to user's download request.
An example on how to render and export a webpage to PDF can be found here.
Related
I wan´t to download the html code of facebook, but when I open the file the page opens but without the graphic design. Any suggestions would be grat!
We have an app which launches Electron browser. In the Electron browser we load a third party website which has a link.
When we view this site in the Chrome or IE browsers, clicking on this link it renders a PDF in an iFrame but for electron browser it shows a save file dialogue. We want to display this PDF in the electron browser just the same way it works for Chrome and IE. As it is a third party website we don't have control over rendering or loading PDF file or we are not getting any events related with loading of this PDF.
For this scenario, if there is no way to display PDF in electron then it is OK to block it so the Save file dialogue will not show.(This app is actually in the KIOSK so we don't want to save a file if it doesn't render in browser.)
Thanks in advance for your comments!
Here is a discussion on an issue almost identical to yours. The answer does a decent job explaining why the download option is appearing. As for preventing the pdf from being downloaded, try using the <embed> tag as it detects compatibility. So embed the pdf using that tag and then load the html into the <iframe>. Here is some example code and description of how to set that up.
I need to write a parser which will collect data from a website which was developed using ReactJS. The problem is when open source code (Ctrl+U) I don't see anything in the code but if I inspect an element a can see full webpage in for instance google inspector (Ctrl+Shift+I)
Do you how can can download html code from the inspector?
I can not speak for React, but with angular if you locally host the site (ng serve) you will not be able to ctrl+u. However, if it's hosted somewhere you can ie: https://angular.io/
I really wish to embed HTML page in my github page, but according to this webpage, it doesn't work well
Yet, when I go to this github webpage, it has INTERACTIVE HTML perfectly encoded, i.e the map
I have struggled to embed this html page into a github page I've created
When I copy and paste the HTML source code, it disappears when I publish the page.
Question
How to embed the html page in the GitHub page?
Thanks for any help!
I want to open up a pdf page on a web page on click of an icon and I want that page to be opened on the same page. I tried to use - pdf.js, but I am facing problem in running helloworld of pdf.js. So how do I use odf.js locally?
Link referred: https://github.com/mozilla/pdf.js/tree/master/examples/helloworld
Thanks
Probably not the issue you are experiencing but you will want to turn off web workers if you're using PDF.JS in multiple instances on the same page.
PDFJS.disableWorker = true;
it does not work with file://, you need to upload the files to your webserver, because AJAX just works with a webserver and not on the clientside