none
Webpage to PDF RRS feed

  • Question

  • Hi,

    I want to convert webpage to PDF on button click. WHich will open the page in new window with PDF toolbars using client side.

    Please help for the same.

    Thanks,

    Rohit

    Friday, February 10, 2017 3:14 PM

All replies

  • Hi rohit,

    I suggest you can use JavaScript code to save the web page to PDF, here is a code snippet for your reference:

    <html>
    <head>
    <title>Save the page as .PDF format-Prittytimes.com</title>
    <script>
    function forprint(){
    if (!window.print){
    
    return
    }
    window.print()
    }
    </script>
    <style>
    h2
    {
    	color:#C03;
    	font-size:18px; 
    	font-family:"Courier New", Courier, monospace;
    }
    p
    {
    	font-family:"Courier New", Courier, monospace;
    	font-size:15px;
    	color:#066;
    	text-align:justify;
    }
    a
    {
    	text-decoration:none;
    	font-size:20px; 
    }
    
    </style>
    </head>
    
    <body>
    <div style="width:1000px; border:2px #A514BF dashed; margin:0 auto; padding:10px;">
    	<h2>The HTML</h2>
    		<img src="http://prittytimes.com/wp-content/uploads/2015/07/html.jpg">
    		<p>Live HTML compiler using PHP is very simple one like as w3schools editor. In here we are going to run the textarea code in the iframe.
    			Main difference from w3schools try editor,the w3schools try editor used asp.net but, here PHP with iframe is used.
    			Visitors are need to edit their code for their own need, and they want to check it lively HTML live compiler support this operation.
    		</p>
    		<h2>jQuery</h2>
    			<img src="http://prittytimes.com/wp-content/uploads/2015/10/html-css-jquery.png">
    			<p>Here I am going to tell you interesting topic regarding google map application in web development. Most of the website need googlemap location while we are entering location name, for that we have one solution. Here I explain,when we are entering the location name in input type you will get the map for that particular location by using jquery. It’s very simple and can use in your web development application, this will helps for all the e-commerce site.I hope this concept is really helpful for all developer.</p>
    		<h2>CSS</h2>
    			<img src="http://prittytimes.com/wp-content/uploads/2015/10/csshtml.jpg">
    					<p>Responsive menus are built to work with desktop browsers as well as touch and mobile devices.
    					In here the dropdown menu also available in all device using pure CSS. A pure CSS responsive menu created that automatically changes to a toggleable dropdown menu at a specified breakpoint based on CSS3 media queries.
    					If you are having trouble getting your website menu working on an iPhone, iPad, or Android device, then check out these menus.</p>
    			
    		
    </div>
    		<div align="center">
    				<a href="javascript:forprint()">
    					<img src="http://www.iconarchive.com/download/i18772/iconshock/real-vista-text/print.ico" style="border:0; align:middle;width:5%"> Click here to Print the Page</a>
    		</div>
    </body>
    </html>

    More information:

    Save the HTML or PHP webpage as PDF – JAVASCRIPT

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, February 13, 2017 3:35 AM
  • Thanks for reply but it is for Print option. I want webpage open as pdf with PDF toolbar in browser using jquery/javascript.

    Regards,

    Rohit

    Monday, February 13, 2017 1:14 PM
  • Hi rohit,

    Please use the JSPDF JavaScript library to conert web page to PDF, here is a demo for your reference:

    Export HTml page to PDF on user click using javascript

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, February 14, 2017 5:46 AM