You are not logged in.
Anyone got any tricks I can use to render a URL directly to a file on the command line?
I have a system setup that will e-mail me a URL occasionally. I want to extract the URL from the e-mail, render the URL into a file, and then print the resulting file (ie, e-mail this address a URL, and that web page will be printed out).
Any ideas?!
EDIT: FWIW tha page looks like the below.
Last edited by fukawi2 (2009-10-07 02:58:19)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
There's html2txt in community.
-edit-
Hm, probably wouldn't work with graphics. But it should be simple enough to print automagically.
Last edited by lucke (2009-10-06 22:47:11)
Offline
maybe curl/wget the html, do some html2pdf magic and print the pdf?
this may be of use:
> aurget -s princexml
aur/princexml 6.0r4-4 [out of date]
converts XML and HTML into PDF documents using the css print spec
how limited are you? i mean, you could easily script uzbl to open/print the page (even if its in an X session you can't see...)
//github/
Offline
Still have the problem of the images / maps though... Any ideas on how to handle them from a text based environment?
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Still have the problem of the images / maps though... Any ideas on how to handle them from a text based environment?
If you are completly text based and looking for graphics, I would suggest that you setup a framebuffer, and then use w3m with framebuffer support, and you should be good.
Knute
Offline
If you convert it to pdf and then use lpr or somesuch to print the pdf file, it should work. Can't really test it now.
Offline
If you are completly text based and looking for graphics, I would suggest that you setup a framebuffer, and then use w3m with framebuffer support, and you should be good.
I don't need to view the graphics though, just render them into a file and send to the printer.
This is actually a lot more complicated than I thought it may be... The maps aren't just images, they're actual Google Maps :s
<title>19FIRE Map</title>
<script src="http://maps.google.com/?file=api&v=2.x&key=ABQIAAAAW7DqHnhVYuKoFjBvZM-UKxTQsGcO0LneRX5C_-o5Fzlp0hMKjxSLomgw7CSUIXa9iM3qpxCGyXu88Q" type="text/javascript"></script>
<script type="text/javascript">
var routeMap;
var gdir;
var situationMap;
function initialize() {
if(GBrowserIsCompatible()){
routeMap = new GMap2(document.getElementById("route_map"));
routeMap.setUIToDefault();
gdir = new GDirections(routeMap, document.getElementById("directions"));
GEvent.addListener(gdir, "error", handleErrors);
gdir.load("from: -37.977600,145.206818 to: -37.980433,145.183873");
situationMap = new GMap2(document.getElementById("situation_map"));
situationMap.setCenter(new GLatLng(-37.980433, 145.183873), 17);
situationMap.addOverlay(new GMarker(new GLatLng(-37.980433, 145.183873)));
situationMap.setUIToDefault();
}
}
function handleErrors(){
if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_BAD_KEY)
alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
else alert("An unknown error occurred.");
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<h1>19FIRE Incident F091002302</h1>
......
<table class="directions">
<tr><th>Route Map</th></tr>
<tr>
<td>
<div id="route_map" style="width: 512px; height: 512px"> </div>
</td>
</tr>
<tr><th>Formatted Directions</th></tr>
<tr>
<td>
<div id="directions" style="width: 512px"></div>
</td>
</tr>
<tr><th>Situation Map</th></tr>
<tr>
<td>
<div id="situation_map" style="width: 512px; height: 512px"> </div>
</td>
</tr>
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
This topic just stuck in my head for some reason, so I searched the aur and found wkhtmltopdf. It's supposed to convert an html to a pdf file. I haven't tried it, but here are the sites:
http://aur.archlinux.org/packages.php?ID=26065
http://code.google.com/p/wkhtmltopdf/
There was another one called pisa, but that was flagged as out of date.
FYI... I used the search term "render" if you want to look thru the results. The two that I mentioned looked closest to what you were looking for, though.
HTH,
Knute
Offline
Oh yeah... You da man Knute
wget -O - 'http://<URL>.html' | wkhtmltopdf --no-background --page-size A4 --margin-top 20 --margin-bottom 20 --margin-left 24 - fireMap.pdf
Results in this file: http://fukawi2.nl/~fukawi2/fireMap.pdf
I can handle getting the PDF to the printer no problems.
Thanks heaps Knute!
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
You are most welcome.
Knute
Offline
are you serious!!! i had the wget > html > pdf solution at post #3!!!
i'm not bitter or anything...
glad you've solved it, i'm gonna go add a bash function real quick too.
//github/
Offline
are you serious!!! i had the wget > html > pdf solution at post #3!!!
Sorry, I worked backwards through the suggested solutions, and stopped when I found one that worked
You should have been slower
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline