Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML -> something else

Status
Not open for further replies.

1DMF

Programmer
Joined
Jan 18, 2005
Messages
8,795
Location
GB
I'm trying to convert HTML to PDF, alas the HTMLDoc Module is only a wrapper for the HTMLDoc exe and that isn't free.

I've tried PDF::FromHTML , but that can't handle CSS so the PDF looks nothing like the HTML.

I've tried HTML::RTF but that can't handle CSS, Tables or Forms (Why it's called HTML::RTF and not TEXT::RTF is beyond me!)

So does anyone know of a module that can either do the above or convert HTML to IMAGE (gif, jpg, png).

It needs to be able to handle CSS & Forms so the output file looks just like the HTML does in a browser.

Any ideas?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
There are a couple of ideas mentioned here that might be able to help (you'll notice a familiar name about halfway down the page ;-)). The goal was to save a web page as a PNG but once it's in that format, it won't be difficult to convert to PDF.
 
thanks ishnid, but i'm a bit confused.

Am I to take it that Win32::CaptureIE no longer works?

also I tried that KHTML2PNG using
./configure
make
make install
but it doesn't work, it's not a PERL module and ./configure just throws up "not a recognised command" error.

normally i'd use perl makefile.pl , then nmake and nmake install , i'm a bit lost as to what i'm doing.



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
maybe you can use Win32::Clipboard instead. I don't know how a clipboard file (bmp I believe) would be converted to a pdf document though.

- Kevin, perl coder unexceptional! [wiggle]
 
ImageMagick can convert BMP to PDF.
 
adding the image to a PDF would be the easy bit, i'm having major problems getting Win32::Screenshot installed at present, as I was going to try Win32::CaptureIE

it does seem a rather difficult thing to do with perl, converting HTML to anything else.



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Seems from the ActiveState site that Win32::CaptureIE can't be built at present. There seems to be an installable older version available from here.

Something else I came across: Denature claims to convert HTML to PDF. There's also mention of CSS support in there.
 
thanks ishnid , but that trouchelle repository doesn't seem to work for win32::screenshot, I get the following error
Win32-Screenshot marked for install
Preparing install to site area of:
Win32-Screenshot

ERROR: Don't know how to unpack
do you know whwat that means?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
You're not using build 818 or 819 of ActiveState Perl by any chance? They're not supported. AFAIK it was something to do with unpacking either .zip or .tar.gz files - can't quite remember which and I can't seem to find a reference for it (though in fairness I haven't searched that hard). Not sure how much I can help really. I'm not a Windows user.
 
well activestate and bribes repositories seem to work fine with my perl version.

this task is becomming a nightmare!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
not going to try Win32::Clipboard?

- Kevin, perl coder unexceptional! [wiggle]
 
does Win32:Clipboard , work better for capturing HTML webpages than Win32::CaptureIE ?



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
You're not using build 818 or 819 of ActiveState Perl by any chance?
Yes i was on Build 819, i've upgraded to 820 (with a little hastle as it doesn't actually upgrade!) but it still doesn't work, I guess i'm just going to have to give up. Win32::Screenshot just will not install. I think it is trying to install a file already installed by Image-Magick ->
ERROR: File conflict for 'C:/Perl/site/lib/auto/Image/Magick/CORE_RL_Magick++_.dll'.
The package Image-Magick has already installed a file that package PerlMagick
wants to install.
this was using PPM on build 820 via Trouchelle repository!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
I found it is IE Cpature throwing that error not screenshot.

Shall I manually delete the DLL and see what happens?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
not going to try Win32::Clipboard?
Kevin, I've looked at it and can't see how this module will help, it takes an image from the clipboard, how do I get the image on the clipboard in the first place?

and if grabs the 'screen' then it's no good I don't want the browser navigation, windows task bar etc.. in the image captured.

I want to capture a webpage, how am I going to acheive this?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Try uninstalling ImageMagick. That error above suggests that your installation of Win32::CaptureIE is trying to install PerlMagick (which is just an older version of ImageMagick: in fact it seems to be this change that causes newer versions of Win32::Capture not to be installable).
 
thanks ishnid, but I managed to work it out and that's what I did, but then found the CaptureIE doesn't work anyway.

I have another thread on that problem!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top