Xportability / css-to-pdf

Convert any HTML page or region to PDF - supports CSS, SVG, embedded XML objects, and more..
http://www.cloudformatter.com/CSS2Pdf
207 stars 77 forks source link

On pressing link nothing happens #78

Open JohnFishGerald opened 6 years ago

JohnFishGerald commented 6 years ago

Hello, This is my first time using github. I'm a good HTML and CSS code writer. A above average writer of PHP and MySQL. I'm using this code to be able to create a downloadable PDF. I've read all the text and when i click on the link for download.... nothing happens.

This is my code: <body id="Usage"> <div style='width:500px;height:500px;background-color:yellow'> <h1>Say Hello</h1> <a href="#" onclick="return xepOnline.Formatter.Format('Usage', {pageWidth:'216mm', pageHeight:'279mm'});"> Click Here </a> </div> </body> <script src="http://www.cloudformatter.com/Resources/Pages/CSS2Pdf/Script/xepOnline.jqPlugin.js"> </script> </html>

(Note: I've got the header info in place. I just didn't copy it across to show you)


I've set this up locally. I've put it in on my localhost too and saved the file as .php. I've put it online on some hosting i have (Which is shared). But it doesn't matter what i do it just won't do anything when i press 'Click Here'.

Please help.

kbrown01 commented 6 years ago

Do not print the body. Put a child div in and put the id on that div.

JohnFishGerald commented 6 years ago

Thank you for coming back to me this is so much appreciated. I've tried that and nothing. But Thank you anyway

kbrown01 commented 6 years ago

It depends on where you are formatting, take this sample: http://jsfiddle.net/w1rpjxoe/33/

You will note that I changed the render mode to download. You are possibly getting a popup blocking error you do not even see. The above works fine.

kbrown01 commented 6 years ago

You must set that on JSFiddle or it blocks the result, download is the only method

JohnFishGerald commented 6 years ago

Hi thank you so much for coming back to me. I will try this and let you know. Thank you John

JohnFishGerald commented 6 years ago

Hello, Sorry i went off line I had to pick up my wife from the airport. I'm back now. Thank you for your time on this. I went into the jsfiddle link and i see what you have done with my code I click on the link and great it downloads brilliant. So i take on board what you have done ive even just copied the code and inserted in my page. Viewed it on a browser clicked the button .... and nothing. I also put it online on some server space i've got and... nothing. It makes sense how you mentioned that it could be my browser that is blocking the download and i can't even see that. But when i click on your link to what you have done in jsfiddle it works fine.. Am I missing some other code or something? Its bizzare? If you have any more thoughts that would be very much appreciated. Kind Regards John

JohnFishGerald commented 6 years ago

I just wondered if anyone had any thoughts on this please?