Newsflash

The HTML markup language has build in codes to provide forms. In forms the user can input fields fill out, in text fields of several lines text enter, from lists of entries selects and so forth.If the form is filled out, the user can click on a Button, in order to process the form. The form contains special tags to indicate what happens with the data of the filled out form. For example send the data by E-Mail or process the data with a CGI program on the server.Generally, the major problem is the form validation.

 

 

Syndicate

Printable web pages on the fly ! Print
Monday, 17 March 2008

coffee.jpg Virtually every web page contain information that is only usable while browsing the website. In contrast importation informations are lost while printing, Hyperlinks for example. Web2printer closes this gap and transforms every web page in a printer-friendly manner. Fully i18n support, use web2printer in your language!

Web2Printer is the first and most powerful printer-friendly Open Source Software Open today. Based on the Java 5 EE Platform it is easy to install, simple to manage, and reliable. 

Prerequisites

Web2printer based on the Java 5 EE Platform:download java ee

  1. Servlet API 2.5
  2. Java  5
  3. Jetty >= 6.1 or Tomcat >= 6.0

Getting Web2Printer

Web2Printer is distributed under the BSD License with sourcecode includes. Download from here  

Functions

Web2Printer works online, real-time. There is no need to define a second, "hidden" page. Just put a appropriate hyperlink in your document.

Web2Printer generates a meaningful page footer, to preserves the origin and navigation information.

The footer contains:

  • The page url
  • meta tags author and copyrighta smily
  • a hyperlink cross reference
  • a image cross reference
  • images replaced with alt="" tag

With web2printer you can easily clip the web page content to the print relevant part i.e cut of menus and ads. This embed the relevant part into two html comments:

<!-- start main column -->
every thing between this comments
is transformed in a printable manner
<!-- end main column -->
The html comment text can be configured!

Web2Printer comes in two editions:

Servlet: For integration in existing web sites on cms systems which not relay on Java 5 EE. Drupal or Joomla for example.
Servlet Filter: For seamless integration into a existing  Java 5 EE application.

Usage

 Servlet

To use the web2printer servlet just insert a hyperlink to the web2printer servlet on your printable web page.

Example 1: http://www.printer-friendly.com/web2printer/print?page=/2008011945/java/web2printer.html&lnk=1&img=3

 Servlet Filter 

  For the web2printer servlet filter just append "web2printer" to your get or post parameters.

Parameters

Web2printer accepts get and post parameters. The parameters validated before they are processed.

 

 
 parameter value  meaning   constraint
 lnk      length == 1, numeric, between  0 and 2
   1  create hyperlink xref  
   2  create hyperlink xref and remove get parameters
 
 img      length ==1, numeric, between 0 and 4
   1  supress images
 
   2  replace images with IMAGE
 
   3  replace images with alt="" tag
 
   4  replace images with alt="" tag and create a image xref
 
 page    only needed supported by web2printer servlet
 valid path, max 255 chars, host part is web2printer site url
     valid path
 

 

Build

Web2printer is built using the Maven software project management tool. Follow these instructions to build web2printer from source on your machine.

Prerequisites

To build web2printer, you'll need the software listed below installed on your machine.

Running a web2printer build
mvn package
  • You may need to run the 'mvn' command multiple times when you're first starting out, as it downloads plugins and the download process does not seem to be entirely reliable.

  • Use the setting -Dmaven.test.skip=true if you don't want tests to run.

  • Use the setting -Dmaven.test.failure.ignore=true if you don't want the build to stop if a test fails

The output will be put in the "target" folder of every subproject.

Building the documentation

To build the documentation site, execute:

mvn site

The documentation will be put in the target/site folder.

 

Configuration

The web2printer configuration will be done via the init-parameters inside the web.xml file.

<!-- web2printer default language -->
<init-param>

    <param-name>defaultLocale</param-name>
    <param-value>en_US</param-value>
</init-param>
<!-- resolve user locale on every request -->

<init-param>
    <param-name>localePerRequest</param-name>
    <param-value>true</param-value>
</init-param>
<!-- definition of clipping area -->

<init-param>  
    <param-name>startToken</param-name>
    <param-value><![CDATA[<!-- start main content -->]]></param-value>
</init-param>
<init-param>
    <param-name>endToken</param-name>
    <param-value><![CDATA[<!-- end main content -->]]></param-value>
</init-param>
<!-- The following parameters on relevant for web2printer servlet -->
<!-- site url, other hostnames not accepted -->

<init-param>
    <param-name>site-url</param-name>
    <param-value>http://localhost:8080/web2printer</param-value>
</init-param>
<!-- timeout in milliseconds for retieve content -->

<init-param>
    <param-name>timeout</param-name>
    <param-value>3000</param-value>
</init-param>

Localisation

To localise web2printer, just create a messages.properties for your language an locale. Your translations are welcome.

 
Next >