Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create PDFs with working hyperlinks from HTML files Internet
Being new to OS X, I really appreciate the "print to PDF" option for most apps and have taken to capturing web pages (confirmation screens, on-line documents, etc.) in PDF format. However, frequently I find myself wanting the links in the resultant "web capture" to be clickable. My solution is to save the page as "Web page, complete" in its own directory with my browser (Mozilla) and then I use HTMLDOC (GPL) from the command-line to translate the HTML to PDF via:
htmldoc --webpage -f outfile.pdf infile.html
The resultant PDF will be the HTML file deftly translated into PDF with links (internal or external to the document) that are clickable in Acrobat Reader (or any PDF reader that can read links).
    •    
  • Currently 1.40 / 5
  You rated: 3 / 5 (5 votes cast)
 
[22,068 views]  

Create PDFs with working hyperlinks from HTML files | 21 comments | Create New Account
Click here to return to the 'Create PDFs with working hyperlinks from HTML files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create PDFs with working hyperlinks from HTML files
Authored by: Nasir on Aug 19, '03 10:39:01AM

You don't even need to download the file, as htmldoc is able to fetch it via HTTP:

htmldoc -f out.pdf 'http://abc.com/?a=1&b=2'



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: pobs on Aug 19, '03 03:28:08PM

This might be an obvious problem but... some pages ripped from the web seem to get spread over three or four pages of the resultant PDF. Also pages that append directories dynamically (i.e. nytimes.com) do not work... maybe I haven't fiddled with the settings enough yet...

anyone find a way to rip a webpage and keep it's links to www URL's intact?

Just the same... a cool app.

Also, anyone have any comments about compiling with FLTK and using the GUI?



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: blgrace on Aug 19, '03 08:13:19PM

Or you could put this alias in your .tcshrc file (or whatever shell you're using)... to save the current URL from the pastebuffer to your desktop.

alias pdf 'cd ~/Desktop && htmldoc --webpage -f outfile.pdf `pbpaste` && cd - '

All one line



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: gvitale on Aug 19, '03 11:24:38AM

HTLMDOC is available via Fink



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: bigfudge on Aug 20, '03 08:17:18AM

Am I being dumb? I can't find this in Fink...



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: pjw on Aug 20, '03 11:56:09AM

HTMLDOC is not in the stable branch of fink. You will have to copy it from the unstable branch first. Open up the Terminal app and try this:

sudo cp /sw/fink/10.2/unstable/crypto/finkinfo/htmldoc* /sw/fink/10.2/stable/crypto/finkinfo

then try again to install using fink or finkcommander or whatever you use.



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: bluehz on Aug 21, '03 06:32:34PM

I didn't do any of that. First installed html doc and req. dependency fltk. That didn't work, so I then installed htmldoc-nox, and at the end it noted it was removing the other pkg - htmldoc. It has worked fine ever since.



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: pjw on Aug 20, '03 12:00:14PM

In addition to copying the htmldoc files to the stable branch, you will need to copy the fltk library as well:

sudo cp /sw/fink/10.2/unstable/main/finkinfo/libs/fltk* /sw/fink/10.2/stable/main/finkinfo/libs/



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: VEGx on Aug 19, '03 12:46:32PM

Very cool. So far I was making this in LaTeX, but this hint might make it easier at times...



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: joebeone on Aug 19, '03 01:32:40PM

I have a working scheme for producing pdfs with links using a combination of latex (with a bunch of hyperref and html package imports) and dvipdfm... email me if you want a working LaTeX header that will do this...



[ Reply to This | # ]
Scriptable?
Authored by: jscotta on Aug 19, '03 02:46:00PM

I wonder if this would be scriptable like the javascript that you can use in Safari to send links to people via Mail? Anyone got an idea of how to do that?

---
Windows because I have to. OS X because I want to.



[ Reply to This | # ]
HTML Doc -- how to use GUI?
Authored by: tmtomh on Aug 19, '03 03:22:28PM

Okay, so I installed HTMLDoc using FinkCommander. During installation I had to choose which variety of fitl (library?) to install. I chose the default, but now I'm thinking I should have chosen the X11 version, as I can't seem to get an HTMLDoc GUI under X11. I've tried removing HTMLDoc, and have also removed the deb file and the symlink to the deb file, but whenever I reinstall, Fink just rebuilds the same old configuration.

How do I get back to a "virgin" situation with this so I can having Fink rebuild HTMLDoc with the X11 library?

TIA for any info for this Unix noob.



[ Reply to This | # ]
HTML Doc -- how to use GUI?
Authored by: Enkerli on Aug 21, '03 11:41:15PM

I did something similar (built with fltk instead of fltk-x11) and HTMLdoc's window isn't a real window (I can click buttons but I can't move the window, switch to it in X11.app and htmldoc doesn't take the keyboard input). Quite weird.
A way to remove a package in Fink is to use "sudo dpkg --remove <package>" and to add "--force-depends" if there's a dependency problem. But htmldoc doesn't seem to be depended upon so you probably don't need to force remove it. I did force remove fltk to replace it with the X11 version, reinstalled htmldoc and it does the same thing. Ah well...



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: kerouassady on Aug 19, '03 04:08:06PM

I wonder how this free solution compares with the Web Capture feature in Acrobat 6? Under 4 and 5, it was pretty lousy when it came to pages more complex that straight HTML but I hear 6 is a big improvement (besides supporting embedded flash and Quicktime content).



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: bluehz on Aug 19, '03 07:44:36PM

Successfully installed via fink - yet I can not find "htmldoc" anywhere" Rehashed, resourced files, etc... still no htmldoc showing up. Retry an install with fink and it says no install nexessary (in other words, its installed)

Any advice?



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: bluehz on Aug 19, '03 08:00:22PM

Problem solved...

Thsi may help others installing via Fink. I did an "install htmldoc" and chose the X11 fltk install. Once installed Ic ould not find teh binary anywhere. Checked out fink and noticed there is a second pkg called "htmldoc-nox". Not sure what the "nox" stands for, but I installed it also "fink install htmldoc-nox") and now my htmldoc binary is showing up fine and working properly.



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: Tom Robinson on Aug 20, '03 04:52:15AM

nox = No X...

You sometimes (always?) need the nox version of a tool to run it from the command line.

Other Fink questions should receive a knowledgable and friendly answer from the fink-beginners list. Follow the links from .

Cheers



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: Enkerli on Aug 21, '03 11:47:39PM

Well, I used the standard version (w/ X11 support) and the "htmldoc" command works from the CLI. "which htmldoc" tells me it's where it should be: "/sw/bin/htmldoc"...
Maybe this was something specific to your Fink installation?



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: mark hunte on Aug 20, '03 03:27:38PM

Sorry I new to this. but used fink to instal the htmldoc and the nox and the fltk, but I do not know where to look for the App. if at all it exists..?

can anyone poit me in the right direction. Thanks

---
mh



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: jdtangney on Dec 13, '04 12:09:40PM

Read the fink installation info. You need to have /sw/bin on your path.



[ Reply to This | # ]
Create PDFs with working hyperlinks from HTML files
Authored by: MathGod on Nov 09, '07 05:11:22PM

Things are much easier in Leopard. If you print to PDF from an Apple application, the resulting PDF preserves any links in the original document. I've found that it even works in older Apple applications like Pages '06.

It doesn't work in any non-Apple application (like Word) that I have tried so far, unfortunately.



[ Reply to This | # ]