DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: conn_w2p

Created:2006-04-05T09:44:51
Changed:2014-09-19T09:37:47.546000000
E-Mail:p.leitner@connetation.at
Email:m.gebhart@connetation.at
Info 4:

EXT: conn_w2p

Extension Key: conn_w2p

Copyright 2013-2014,

Michael Gebhart,Paul Leitner,Rüdiger Mausz, < support@connetation.at >

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: conn_w2p 1

Introduction 2

What does it do? 2

Users manual 3

Installation 3

Quick start: 4

TS Example Configuration 4

Base Configuration 5

Single Configuration 5

Administration 6

Rights & Permissions 6

Configuration 7

Files: 7

Reference 8

plugin.tx_connw2p_lib TS constants 8

plugin.tx_connw2p_pi1 TS constants 8

plugin.tx_connw2p_pi1 TS configuration 8

Usage 9

Backend 9

Creating a base configuration 10

Backend module 11

Creating a single configuration 12

Adding content to the single configuration 13

Downloads in a single configuration 16

Frontend 17

Previewing content 17

Starting the rendering process 20

Extending conn_w2p 21

Render library interface 21

List of conn_w2p add-ons 22

Render library for pages 22

Render library for PDF files 22

Render library for table of contents 22

Render library for commerce categories/products/articles 22

w2pservice 23

Sponsoring conn_w2p development 24

Known problems 24

To-Do 24

Changelog 24

Introduction

What does it do?

Web2Print is a framework to create HTML5 content out of different sources.The extension displays the content in a preview environment which resembles the single rendered pages in the finished document.Since rendering – especially for print production – is a time consuming task, the preview provides the user with the possibility to check the result.

The rendering process itself is finished by the w2pservice, a server- side ensemble of different tools and proprietary code taking care of converting existing RGB Images to CMYK colorspace if needed and creating a print-ready PDF-X3 document.

Users manual

Installation

Installation of the extension is done through the TYPO3 extension manager as usual.The supplied rendering libraries have some dependencies:

installed locales for needed money/time format

  • ImageMagick/GraphicsMagick for rendering
  • gdlib for text-size estimation

img-1 Web2Print configuration in extension manager

Quick start:

At first a frontend user (for the w2p rendering service) as well as a frontend usergroup has to be created. This frontend usergroup must be assigned to every base configuration to allow access for the rendering service.If not already existing, create a user storage folder for user-related records.Now create a page for both the frontend plugin and the needed configuration records.This page needs to include the static TS template for basic setup purposes.The page itself must not contain any content elements, the page configuration is done by the static TS template.The TS setup should not contain a page object with type 0 (this page object is already created by the included template and an additional object would overwrite it).

The pid of this page has to be set in the constant and in the extension configuration (see the previous screenshot) because the backend module has to know where single configuration records and the frontend plugin are inserted.The pid of the user storage folder has to be set in the constant on the page for web2print as well. This is needed for the login process.The constants userGroup.view, userGroup.render and userGroup.finalversion need to be set on fronted usergroup UIDs allowed to access the different modes.The “view” usergroup is just allowed to preview the content, without any rendering functionality. Whereas the “render” and “finalversion” both are allowed to render, but only the “finalversion” group may render a final version of the document without watermarks. These constants can also contain multiple usergroup UIDs separated by commas.

TS Example Configuration

img-2 img-3

img-4

A rendering configuration consists of two hierarchical configuration types. A base configuration and one or multiple single configurations.

Base Configuration

The base configuration defines general options such as the used language, paper-size, templates for content rendering and the included stylesheets for screen display and print output (which are subsequently used in the PDF rendering process).

Additionally permissions for this specific base configuration in frontend and backend are defined through usergroups.

You can find examples for the needed template file and the stylesheets in the sub-directory “resources/examples“ of the conn_w2p extension.

Single Configuration

A single configuration is always dependent on a base configuration.

The single configuration is the real definition of rendered content.This is achieved by adding contents to the configuration.

The content-types correspond with a specific rendering library which takes care of set-up of content data-element as well as final rendering of HTML content.

Default settings for resolution and colorspace are also defined in the single configuration.

The downloads inside a single configuration resemble the finished rendering jobs and are attached through a callback mechanism controlled by the w2pservice.

Administration

Rights & Permissions

One important part is the permission setting on the page containing the configuration records.The backend usergroup defined in a base configuration needs write access to this page, otherwise no saving of single configurations is possible.

Configuration

Files:

pi1/class.tx_connw2p_pi1.php

File

pi1/class.tx_connw2p_pi1.php

Description

Main PHP-class used to display the rendering overview and calling the specific rendering libraries

lib/class.tx_connw2p_element.php

File

lib/class.tx_connw2p_element.php

Description

Base class for all types of elements (document, page, contentelement)

lib/class.tx_connw2p_document.php

File

lib/class.tx_connw2p_document.php

Description

Document class, container for pages of a document

lib/class.tx_connw2p_page.php

File

lib/class.tx_connw2p_page.php

Description

Page class, contains single content elements, which can resemble arbitrary content

lib/class.tx_connw2p_contentelement.php

File

lib/class.tx_connw2p_contentelement.php

Description

ContentElement class, this is the main class processing content for a page

lib/class.tx_connw2p_data.php

File

lib/class.tx_connw2p_data.php

Description

Data specific helper functions

mod1

File

mod1

Description

Dummy module to create top backend menu entry

mod2/index.php

File

mod2/index.php

Description

Main class of backend module for single configuration management

renderlib/class.tx_connw2p_renderinterface.php

File

renderlib/class.tx_connw2p_renderinterface.php

Description

Definition of the interface for rendering libraries

renderlib/class.tx_connw2p_render_pdf.php

File

renderlib/class.tx_connw2p_render_pdf.php

Description

Renders a preview of given PDF file and submits the file to w2pservice for inclusion in the final document

renderlib/class.tx_connw2p_render_page.php

File

renderlib/class.tx_connw2p_render_page.php

Description

Renders TYPO3 page content

renderlib/class.tx_connw2p_render_toc.php

File

renderlib/class.tx_connw2p_render_toc.php

Description

Renders the table of contents, renderlibs incorporate a renderToc method for this task

resources

File

resources

Description

Contains stylesheets, templates and base files for the rendering process

static

File

static

Description

Contains the static TS templates

filechecksum.php

File

filechecksum.php

Description

used to check if transmission/retransmission of a file is needed

w2p.php

File

w2p.php

Description

AJAX interface for the w2pservice

Reference

plugin.tx_connw2p_lib TS constants
w2pPid

Property

w2pPid

Data type

int

Description

PID of page containing the Web2Print configurations and the frontend plugin

Example:

plugin.tx_connw2p_lib.w2pPid = 1

Default

0

userPid

Property

userPid

Data type

int

Description

PID of page containing the Web Site users for frontend login

Example:

plugin.tx_connw2p_lib.userPid = 2

Default

0

loginEnabled

Property

loginEnabled

Data type

int

Description

Choose whether a login is required to view/render contents

Example (disabling login requirement):

plugin.tx_connw2p_lib.loginEnabled = 0

Default

1

plugin.tx_connw2p_pi1TS constants
templateFile

Property

templateFile

Data type

resource

Description

Template file for Web2Print Frontend Framework (login/header area, rendering panel, javascript for handling rendering and status updates)

Example:

plugin.tx_connw2p_pi1 {
  templateFile = fileadmin/templates/w2p.html
}

Default

EXT:/conn_w2p/pi1/template.html

loginTemplateFile

Property

loginTemplateFile

Data type

resource

Description

Template file for login form in header of Web2Print frontend plugin, basically a modified felogin template file

Example:

plugin.tx_connw2p_pi1 {
  loginTemplateFile = fileadmin/templates/w2plogin.html
}

Default

EXT:/conn_w2p/pi1/loginform.html

plugin.tx_connw2p_pi1 TS configuration
loginPid

Property

loginPid

Data type

int

Description

PID of page where users can login (usually same as the Web2Print frontend plugin page)

Example:

plugin.tx_connw2p_pi1.loginPid = 1

Default

{$plugin.tx_connw2p_lib.w2pPid}

loginForm

Property

loginForm

Data type

USER

Description

Contains a configured instance of plugin.tx_felogin_pi1 with assigned storagePid and templateFile according to above set constants

Default

instance of plugin.tx_felogin_pi1

userGroup.render

Property

userGroup.render

Data type

int

Description

Usergroup with permission to render a document

Default

1

userGroup.view

Property

userGroup.view

Data type

int

Description

Usergroup with permission to preview a document

Default

1

userGroup.finalversion

Property

userGroup.finalversion

Data type

int

Description

Usergroup with permission to render a document as final version

Default

1

renderParameters

Property

renderParameters

Data type

Description

Parameters for rendering libraries, especially for commerce rendering library defining default height of categories and products for space calculation and positioning

Default

Usage

Backend

img-5 Records inside the w2p page (configurations, contents of single configuration, downloads)

Creating a base configuration

The base configuration defines, as the name suggests, the basic properties of a document you want to render.Those include the page size as well as a bleed setting, the language for the rendered document, HTML template to use, general CSS stylesheets and stylesheets for print (which get applied upon rendering) and the permission settings for frontend and backend through usergroups.

img-6 Base configuration with assigned values

Backend module

The Web2Print backend module provides an easy way to handle the different single configurations of a given base configuration.

After selecting the data source (base configuration) all available single configurations are displayed as well as final versions of documents rendered with these single configurations.

img-7 Web2Print backend module view

img-8 Backend module in TYPO3 navigation

Creating a single configuration

Each base configuration can have various single configurations with different content or settings. The original idea was to have the possibility of creating different versions of the same document.

Inside a single configuration the actual content of the document is defined.This is done by adding different content types to the document and specifying the required properties.The default resolution and colorspace is also set in the single configuration.

img-9 Basic single configuration, already filled with content and rendering results (downloads)

Adding content to the single configuration

Content is added to a single configuration through the IRRE area “Contents”.

The extension already has some basic content rendering libraries providing the following types:

Page

Content Type

Page

Description

Renders a TYPO3 page

PDF

Content Type

PDF

Description

Renders a given PDF document

Table of Contents

Content Type

Table of Contents

Description

Renders a table of contents page, each content type has a checkbox to activate/deactivate inclusion in the table of contents

img-10 Table of contents in single configuration

img-11 PDF file as content to single configuration

img-12 TYPO3 page content in single configuration

Downloads in a single configuration

img-13 Download in single configuration (finished rendering)

Each single configuration contains an IRRE area called “Downloads”. This is where all the finished renderings are present.The Downloads itself are read only and represent the settings of the finished rendering. The URL points to the rendered PDF document on the w2pservice rendering server.

Frontend

Previewing content

img-14 Web2Print rendering panel

Content preview is done in the frontend part of the extension.After logging in using a previously created frontend (Web Site) user and assigning a group with appropriate rights, you can select the single configuration you want to preview.After configuration selection the default values for resolution and colorspace are loaded and the first page is displayed.The navigation part allows navigation through pages as well as defining how much pages should be displayed at once.Additionally it is possible to disable the bleed which was set in the base configuration, for example to render a RGB version for web view only.The rendering section defines settings for the rendering process, the most important being the resolution and colorspace of the resulting PDF file. By default the rendering is only in preview mode, where watermarks are placed in the document.To render without watermarks the “Final Version” checkbox has to be set. In this mode special limits apply.Beneath is a list of the last rendered documents. img-15 Rendering panel may be hidden to provide better overview of content

img-16 Preview of table of contents in demo setup

img-17 Preview of commerce content

Starting the rendering process

After checking the content in preview, the rendering process itself is started by selecting the desired resolution and colorspace settings and the page-range to render. If only the current page should be rendered a simple click on the button “Render current page” is sufficient.If the document shall be printed later on, selecting “Final Version” is recommended to get a resulting document without watermarks. It should be mentioned, that for the demo license limits apply to rendering final versions of a document.

After invoking the rendering, continuous status queries through JavaScript provide the current status to the user.The possible status values are:

Starting rendering process

Status

Starting rendering process

Description

Job was added to queue and will be processed soon

1 of 5 / Downloading resources

Status

1 of 5 / Downloading resources

Description

Processing of sourceUrl and fetching all needed resources including linked CSS stylesheets and images

2 of 5 / HTML5 rendering

Status

2 of 5 / HTML5 rendering

Description

Rendering of HTML5 content to PDF is initiated

3 of 5 / CI-Color mapping

Status

3 of 5 / CI-Color mapping

Description

If a color conversion file was provided mapping of RGB to CMYK colors is executed (only if target colorspace is CMYK)

4 of 5 / RGB → CMYK color conversion

Status

4 of 5 / RGB → CMYK color conversion

Description

Conversion of remaining RGB parts in the document to CMYK colorspace (only if target colorspace is CMYK)

5 of 5 / Merging PDF-Template

Status

5 of 5 / Merging PDF-Template

Description

Merging provided PDF files into resulting document

Download ready

Status

Download ready

Description

Rendering process finished, resulting PDF can be downloaded

Authentication failed

Status

Authentication failed

Description

The provided license key is invalid

Structure Caching

With the introduction of version 1.1.0 a new caching feature was implemented.Utilizing the provided TYPO3 caching framework the document structure is cached to improve performance for large documents and faster page switching.

The cache can be cleared either through the backend cache menu or through the W2P frontend interface using the “Data reload” button. This button clears the structure cache as well as the TYPO3 FE-cache for the W2P page (as set in the extension configuration).

Changes to the configuration of a W2P document lead to a new cache entries due to binding of the cache id to the tstamp of the configuration.

Extending conn_w2p

To allow rendering of other than the already supported content types (page, pdf, commerce, toc, index) it is possible to extend the render capabilities with your own library.

First you have to add a statement similar to a hook statement in you ext_localconf.php. Additional fields in the tx_connw2p_content table can also be specified.The TCA for the new type has to be configured as well to define the visible fields.

The Interface to the web2print extension consists of function to populate the content to be render in a hierarchical structure as well as the real rendering which is based on a give template, attached to a base configuration.

The populate method is called for each encountered content element inside a single configuration.After populating content into the structure the post-processing method is called for each content element. This is needed for example for the table of contents since the actual page order can only be determined after inserting the prepared content.

The rendering itself happens in renderContentElement and renderPage as well as in renderToc for the table of contents entry if valid.

Render library interface

public function populate ( &$document, $content, $singleConfig,&$pObj );

public function postProcess ( &$document, $content, $singleConfig,&$pObj );

public function renderContentElement ( $ce,&$pObj );

public function renderPage ( $page, $output,&$pObj );

public function renderToc ( $contentElement,&$pObj );

List of conn_w2p add-ons

Render library for pages

Creates the content for one page from a TYPO3 by parsing HTML and incorporating the content of the body tag and all stylesheets in the head into the w2p frontend view.

Render library for PDF files

PDF files get submitted to the w2pservice and a preview of the inserted PDF page is also shown in the frontend view

Render library for table of contents

All content elements inside the document are captured and if the flag for table of contents is set, get included in the rendered version.The generated content elements include a reference to the actual content element, therefore it's easy to get the correct page for the rendering process.

Render library for commerce categories/products/articles

Provided through additional extension conn_w2p_commerce.

w2pservice

The connection to the w2pservice is established through SOAP (URL: http://w2posserver.connetation.at/w2pservice.wsdl).

The available methods are addJob and getStatus each accepting on parameter containing json encoding data.

The addJob method adds the rendering job to the queue and returns a unique has for this job for subsequent status queries.

The should be checked continuously, although there is also a callback which is called upon completion of the rendering.

function addJob ( $jsonData )

Available options for jsonData

sourceUrl

a

sourceUrl

b

Source URL for of the document to be rendered

licenseKey

a

licenseKey

b

Assigned license key for w2pservice

finalVersion

a

finalVersion

b

Render preview or final version (without watermarks) (0/1)

pageWidth

a

pageWidth

b

Width of a page in the document (unit mm)

pageHeight

a

pageHeight

b

Height of a page in the document (unit mm)

disableBleed

a

disableBleed

b

If set 1, no additional cropping marks are added on the rendered document (0/1)

finalFileName

a

finalFileName

b

Filename of the final rendered PDF file

colorSpace

a

colorSpace

b

Colorspace to be used in the rendering process (rgb/cmyk)

resolution

a

resolution

b

Resolution for the rendering process (image rendering) (72/150/300)

pdfPages

a

pdfPages

b

Array of PDF pages which are inserted on give page after rendering of regular content (options for each elements: pdffile, startpage, pagecount)

fileChecksumScript

a

fileChecksumScript

b

URL to a script accepting a parameter filesrc resulting in the md5 hash of the given file. Used to minimize file transfers to the rendering server

callbackUrl

a

callbackUrl

b

URL to a script handling callback after finished rendering, parameters are uuid (the unique id of the finished rendering) and finalVersion (indicating if the rendered document was a final version without watermarks)

colorConversionFile

a

colorConversionFile

b

URL of the color conversion xml file (conversion of RGB to CMYK colors)

JSON return value

uuid

a

uuid

b

unique id generated based on sourceUrl and current rendering time, identified a unique rendering instance. Used for status queries.

messages

a

messages

b

detailed debug messages about the rendering process

error

a

error

b

if an error occurred this value will be present

function getStatus($jsonData)

Available options for jsonData

uuid

a

uuid

b

unique id, returned by the addJob method

sourceUrl

a

sourceUrl

b

sourceUrl for the document, if the unique id is not known

JSON return value

renderstatus

a

renderstatus

b

current status of the rendering process

messages

a

messages

b

detailed debug messages about the rendering process

outputAddress

a

outputAddress

b

the final URL for the rendered PDF file

error

a

error

b

if an error occurred this value will be present

Sponsoring conn_w2p development

In the backend as well as in the frontend part of the conn_w2p extension there are donate buttons for donations via Paypal.

Known problems

To-Do

Changelog

v1. 1 . 0 :

2014-09-12

*Added structure cache using TYPO3 caching framework

*Cache control via frontend (FE-Cache and structure cache)

v1.0.4:

2014-07-14

*Flag for start with left page

*Changed handling of subelements (sorting)

2014-05-20

*Ext config changes

2014-05-09

*Fetch authtoken before rendering via AJAX (fix for cached old authtoken)

*Increased token age

2014-05-05

*Restructured TS constants/setup

*Fix in postProcess hook

*Change interface for renderToc function

*Add getSubElementCount

*Logic for table of contents with start/end subparts

2014-05-02

*Login enabled by default

*Additional hooks for further processing in extensions

v1.0.3:

2014-04-29

* Changed rendering service authentication to token based system (replacing previous implementation using sfpipauth)

* New flag "loginEnabled" to choose between protected and publicly available W2P rendering frontend

* Additional description/screenshots for TS configuration

* Fixes in rendering service regarding different/asymmetric bleed values (crop mark settings)

* Moved conversion.xml (with example data) to conversion.xml.dist and created empty conversion.xml

* Optimization in CMYK rendering process

* Fixed backend module

img-18 EXT: conn_w2p - 25