From kfm-devel Tue Oct 16 22:33:42 2007 From: Albert Cervera i Areny Date: Tue, 16 Oct 2007 22:33:42 +0000 To: kfm-devel Subject: Re: Konqueror: Save HTML page as PDF Message-Id: <200710170033.43387.albert () nan-tic ! com> X-MARC-Message: https://marc.info/?l=kfm-devel&m=119261635420531 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_HxTFHeOYtlqjKed" --Boundary-00=_HxTFHeOYtlqjKed Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Kaspar, I'd suggest you something similar to what Volker was looking for. I attach a shell script that should do the trick. Unfortunately I can't make it work as cups complains that no printer has been selected. Maybe somebody else can tell us why this doesn't work. Another problem is how you know a page has been fully loaded. You can look with dcop to see if there is any way to ask konqueror. Hope that helps! A Dimarts 16 Octubre 2007, Kaspar Fischer va escriure: > Dear all, > > I need to archive webpages for a library and for this need to save > HTML as PDF files. If possible, the page background and the layout > should be retained (of course, it will get resized to A4 and be split > into several pages - that's all fine). > > What would be the best approach to accomplish something like this? > A script (in bash or whatever) is what I need in the end. > > Is DCOP and kprinter a good starting point? > Or can Konqueror be called from the command line with appropriate > options? > > I have never used DCOP so am a little at a loss how to get started. > > Many thanks for any pointers! > Kaspar -- Albert Cervera i Areny http://www.NaN-tic.com --Boundary-00=_HxTFHeOYtlqjKed Content-Type: application/x-shellscript; name="konqui.sh" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="konqui.sh" #!/bin/bash if [[ -z "$1" || -z "$2" ]]; then echo "usage: konqui.sh url printer" exit fi export PRINTER="$2" konqueror "$1" & sleep 8 pid=$! ref=$(dcop konqueror-$pid konqueror-mainwindow#1 currentView) ref=$(dcop "$ref" part) dcop "$ref" print true --Boundary-00=_HxTFHeOYtlqjKed--