PhantomJS Static Windows Version with SSL support

From Google Code of PhantomJS , you can download PhantomJS 1.2.0 Windows executable – Static. More compact, but does not support https. and said, this version is statically linked, therefore HTTPS is not supported. For HTTPS support please download the dynamic version. (You can only download dynamic build version now.)

With some effort, I compile a static version with https/ssl support, if you like it, please download here.

PhantomJS is a headless WebKit with JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, SVG. The official web site is phantomjs.org.

PhantomJS is cross-platform, it can be compiled for Linux, Windows, FreeBSD, and Mac OS X. PhantomJS scripts can be written in JavaScript or CoffeeScript.

Here a 14-line PhantomJS script which finds pizzeria in New York (using Google Places), along with the address and the telephone number:

page = new WebPage()
page.open 'http://www.google.com/m/local?site=local&q=pizza+in+new+york',
  (status) ->
    if status isnt 'success'
      console.log 'Unable to access network'
    else
      results = page.evaluate ->
        pizza = []
        list = document.querySelectorAll 'div.bf'
        for item in list
          pizza.push(item.innerText)
        return pizza
      console.log results.join('\n')
    phantom.exit()

Get the code and build it, and then enjoy some more simple and advanced examples, covering:

  • running regression tests from command line
  • getting driving direction
  • showing weather forecast conditions
  • finding pizza in New York
  • looking up approximate location based on IP address
  • pulling the list of seasonal food
  • producing PDF version of a Wikipedia article
  • rasterizing SVG to image

For questions and feedback, please post to phantomjs mailing-list.

PhantomJS is based on Qt. There are two implementations, using C++ and Python.

Be Sociable, Share!

how to let qtwebkit open https page

After downloaded and installed Qt SDK for Windows 4.6.2, the first time, I tried the famous example, fancybrowser, it is no problem to open http://www.google.com/ncr, but when I clicked the Gmail link on the Google home page, I got the following error message,
QSslSocket: cannot call unresolved function SSLv3_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error
QSslSocket: cannot call unresolved function ERR_error_string

After a quick search, I noticed OpenSSL is not installed, so needs an OpenSSL for Windows. I tried Win32 OpenSSL and GnuWin OpenSSL for Windows, both works.
For Win32 OpenSSL, just download Win32 OpenSSL v1.0.0 Light or Win32 OpenSSL v0.9.8n Light(both need Visual C++ 2008 Redistributables), install it(i used Universal Extractor unpack them then copy libeay32.dll and ssleay32.dll to windows system folder). For GnuWin OpenSSL for Windows, just download openssl-0.9.8h-1-bin.zip then extract libeay32.dll and libssl32.dll to windows system folder or mingw bin folder (installed with qt).

P.S.
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library.

Be Sociable, Share!

wkhtmltopdf-Free and Open Software to Convert Html to PDF using QtWebkit

Introduce
wkhtmltopdf is a simple shell utility to convert html to pdf using the webkit rendering engine, and qt.
Usage
To use this software download the latest static release unpack it and run it like
wkhtmltopdf www.rubypdf.com rubypdf.pdf
for a list of available options see
wkhtmltopdf --help
Features

  • Convert web pages into PDF documents using webkit
  • Adding headers and footers (static version only)
  • TOC generation (static version only)
  • Batch mode conversions
  • (Linux) No longer requires an XServer to be running (however the X11 client libs must be installed)
  • Supports multiply platforms, Windows, Linux, Mac OS X and so on

Download
precompiled binaries and source code

btw, there is another project named Webkit2pdf, is built with Webkit, GTK+, Poppler-glib, not qtwebkit.
Webkit2pdf is a little tool designed to fetch web pages and export them to numbered PDF files (or to print them). It allows specifying paper size and output directory. It is released under the terms of the GPL, version 3 or later.

Be Sociable, Share!