Hi Kieran,

A word of caution: Test the script (or wkpdf for that matter) early in "headless" mode. Both of them rely on Cocoa classes, which will connect to the window server. And that is only allowed for the current console user (that's why you won't notice during development) or root. So when you deploy on an Xserve, you'll probably have to make it "setuid root" or "setuid SomeUser", where you have to make sure that "SomeUser" is always logged into the console.

[mbp:~] th% ssh [email protected] # log in as user "admin" via ssh
Password:

mbp-tj:~ admin$ w # show logged in users: "tj" is on console, "admin" is not
 9:37  up 17:14, 4 users, load averages: 0.19 0.17 0.11
USER     TTY      FROM              LOGIN@  IDLE WHAT
tj       console  -                Mon16   17:11 -
tj       s000     -                Mon16    6:22 bash
tj       s001     -                Mon16    6:22 bash
admin    s002     192.168.112.252   9:37       - w

mbp-tj:~ admin$ ./webkit2png.py http://google.com/ # will fail
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL. 2009-03-31 09:38:23.669 Python[5525:717] *** -[NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1f12a90> '(null)') unlocked when not locked 2009-03-31 09:38:23.670 Python[5525:717] *** Break on _NSLockError() to debug.
Traceback (most recent call last):
  File "./webkit2png.py", line 257, in <module>
    if __name__ == '__main__' : main()
  File "./webkit2png.py", line 239, in main
    AppKit.NSBorderlessWindowMask, 2, 0)
objc.error: NSInternalInconsistencyException - Error (1002) creating CGSWindow

mbp-tj:~ admin$ sudo ./webkit2png.py http://google.com/ # will work on 10.5 if ANY user is currently on the console, will always work on 10.4, I think
Password:
Fetching http://google.com/ ...
 ... done

mbp-tj:~ admin$ su tj # switch to user on console
Password:

bash-3.2$ ./webkit2png.py http://www.google.com/ # will also work
Fetching http://www.google.com/ ...
 ... done

Timo

Am 30.03.2009 um 19:28 schrieb Kieran Kelleher:

Thanks Timo,

webkit2png python script produces perfect output ..... and has exactly the output (and output configurability) I want. nice, thanks!

-Kieran

On Mar 30, 2009, at 12:18 PM, Timo Hoepfner wrote:

For thumbnails you could try http://www.paulhammond.org/webkit2png/

Another utility I recently came across is wkpdf (http:// wkpdf.plesslweb.ch). Seems to work fine, but complains about not beeing able to access the window server when running w/o console. The author started porting it to ruby recently: http://github.com/ plessl/wkpdf/tree/master

I started to make a wrapper for wkpdf to make PDFs from WO- generated pages a while ago, but got side-tracked... I always wanted to have a simple and fool-proof solution to get a pdf from an arbitrary WO page for archival purposes or for sending it via e- mail without having to put half a MB of css in the mail...


Timo

Am 30.03.2009 um 17:31 schrieb Kieran Kelleher:

Anyone have any suggestions for free utility to make thumbnail (or plain image that I can thumbnail) of a HTML page in java?

-Kieran
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/th-dev% 40onlinehome.de

This email sent to [email protected]



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to