0

I have an HTML "printer friendly version" type page that I'd like to convert to a document-style file type so that I don't have to worry about disabling links on the page and stuff. Is there a fairly simple way to create a file like that from the page's html without using third party libraries?

At first glance this is going to probably look like a duplicate of a bunch of other questions, but most of the answers involve using third party software, which isn't an option for me.

3
  • Most OS have the ability to print to pdf... Commented May 11, 2012 at 15:51
  • But thats not really the issue. The issue is that if I just display the printer friendly version page as straight html, all of the links and stuff from the page are going to be clickable (although broken). To fix that, I'd like the page to be displayed as a pdf, or xps, or something Commented May 11, 2012 at 15:54
  • 1
    Why not fix the printer friendly page so that it doesn't have (broken) links and let users print it however they like? I'm not aware of non-3rd party library way of generating pdf... Commented May 11, 2012 at 16:24

2 Answers 2

2

If you're talking about an asp.net site, you don't have the HTML that is given to the browser; you'll have to do whatever you want to do to generate a PDF and send that back to the browser. You can't let ASP.NET send HTML back to the browser and expect the user to see PDF...

Sign up to request clarification or add additional context in comments.

9 Comments

But i have the HTML from the page that calls the print preview function, which I am creating the new html from. Then, I want to convert that new html to pdf
You're calling that on the client computer; you have no idea if they have a print-to-pdf driver on their computer...
You guys are clearly not getting the point. I just want to display the page as a pdf. Then they can print it to whatever they want.
You've missed the point, the only thing you can do is send the HTML to the browser. If you want to send a PDF to the browser you have to send the PDF...
And that's what I want to do.
|
0

I just did it with CSS. Sorry I have to accept this as an answer, but the only answer posted wasn't really what I was looking for..

3 Comments

@PeterSmith said "Is there a fairly simple way to create a file like that from the page's html without using third party libraries?" and claimed he has achieved it. How did he do, I wonder? "I just did it with CSS" is somewhat a vague answer.
@marquito if I knew how to do it the right way, I wouldn't have asked the question, right? Would you have rathered I post all of the relevant CSS? It's just CSS to style links more like text and hide buttons, etc. My CSS isn't going to help anyone anywhere, so I answered the way I did. Thanks for the not-so-constructive criticism, though. And by the way, its @PhillipSchmidt, not @PeterSmith.
No need to put up a fight, @PhillipSchmidt. I didn't ask for the CSS code itself, but thought you missed the point of marking it as an answer as you did not actually answer your own question. I was more in hope of finding an answer than criticizing you. Sorry. (I would edit the post to change your username but there's no means to do it except deleting it)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.