1. OverviewThe VisualXSL application is intended for visually editing stylesheets to fill forms. The primary purpose of the application is to prepare a XSL stylesheet to format a document (with already existing static form). The result of application work can be both XSL stylesheet and formatted PDF/PS document with using of XEP formatter. Its advantage lies in performing of formatting for dynamic data only, using static form data as background. That considerably speeds up document formatting in comparison to traditional method of doing it.
Easy-To-Use Layout DesignerA user can design a document visually using VisualXSL application. The application enables a user to put data fields onto document layout. A user can just drag and drop data directly to layout designer. The layout designer (also mentioned below as the layout or the designer area) has a very simple style, and can be learned easily and fast.
High-Speed Document GenerationVisualXSL generates specific stylesheet to render your designed document. With this stylesheet XEP formatter provides high speed of the PDF (or PostScript) document generation.
Single- and Multi-Page Forms SupportMulti-page forms can be filled with data as well as single page ones. If a user set a multi-page PDF as a background, application will extract every page to the separate PDF and set it as the background of corresponding page in the project. New pages will be created automatically if needed. The application offers user an opportunity to create an Acrobat PDF form from existing project.
Textboxes, Check Boxes, Pictures and BarcodesThere are the following types of data fields that can be placed into a form: Text fields will be rendered as a text from the XML.
Conditional RenderingEvery data field has a property that can be set to determine its rendering under certain condition.
XPath ValidationAlmost all XPath expressions are created automatically when a user drags and drops XML tree node to layout designer. But a user can also create or edit them manually. The application validates all XPath expressions and offers to modify a wrong expression.
Docking WindowsThe application gives an opportunity to use a docking window interface. A user can dock and undock tool windows to create an optimal work configuration. For example, if there is a dual-monitor system, some tool windows can be undocked and placed on the second monitor.
Print XML Data on Preprinted FormThe application makes possible for user to print XML data over the paper (preprinted) form. See the section “How to Fill in Preprinted Forms with Data” for more information.
Generation of Fillable PDF FormThe application has an option to generate Fillable PDF Form for documents with PDF background (currently textboxes and checkboxes are supported). See the section “How to Generate Fillable PDF Form” for more information.
2. Installation
2.1. Hardware/Software RequirementsBefore installing the application you have to get the following list of software installed:
2.2. How to Install VisualXSLRun setup.exe and follow the installation instructions. If a user has failed to set correct path to license.xml, the license file can be copied to the application installation folder (by default: C:\Program Files\RenderX\VisualXSL).
2.3. Inside the Product PackageThe installation folder contains the following subfolders:
After the installation new folder will be created (see below):
3. Getting Started
3.1. Making Your First ProjectLet’s start from the simplest (andnow existing) project. Suppose that you have to prepare a great number of reports in W9 form. You have already found a sample PDF file with W9 form on the Internet and you have XML file exported from your database. Your task is to prepare reports from these data. Try to repeat creating one of sample projects W9 step-by-step.
Fig. 3.1.1 BackgroundPath property for a new project page
Fig. 3.1.2 Text formatting properties of the selected data field
Fig. 3.1.3 Unfinished project (no checkmarks, malformed address, etc)
3.2. Creating a New Project from the ScratchNow you should prepare XML source and PDF background by yourself. It is not as difficult as it seems. To complete this tutorial you must have Microsoft Office Professional Edition 2003 (or greater) installed. You will use Microsoft Excel to prepare XML source file and Microsoft Word to make an invitation letter form. You are supposed to prepare and mail anniversary party invitations to all company managers from name of its CEO. All employees’ information is stored in Excel spreadsheet (see Fig. 3.2.1). The letter should look like the one on the Fig. 3.2.1 and you should be able either to print it and to e-mail it as an electronic document.
Fig. 3.2.1 The invitation letter
Fig. 3.2.2 Data in the Excel spreadsheet
First of all create XML source file. You should have some XML schema to be able to map data to XML tags and export it to XML file. The simplest way to do that is to prepare a little XML file describing the common structure of your data. Your XML file should look like following one (you can omit some elements not necessary for your task). Write down XML node corresponding to data record twice to make MS Excel understand that this node can be replicated many times. Here it is: <employees> <record> <EmployeeID>1</EmployeeID> <LastName>Davolio</LastName> <FirstName>Nancy</FirstName> <Title>Sales Representative</Title> <TitleOfCourtesy>Ms.</TitleOfCourtesy> <BirthDate>1968-12-08</BirthDate> <HireDate>1992-05-01</HireDate> <Address>507 - 20th Ave. E. Apt. 2A</Address> <City>Seattle</City> <Region>WA</Region> <PostalCode>98122</PostalCode> <Country>USA</Country> <HomePhone>(206) 555-9857</HomePhone> <Extension>5467</Extension> </record> <record> <EmployeeID>2</EmployeeID> <LastName>Davolio</LastName> <FirstName>Nancy</FirstName> <Title>Sales Representative</Title> <TitleOfCourtesy>Ms.</TitleOfCourtesy> <BirthDate>1968-12-08</BirthDate> <HireDate>1992-05-01</HireDate> <Address>507 - 20th Ave. E. Apt. 2A</Address> <City>Seattle</City> <Region>WA</Region> <PostalCode>98122</PostalCode> <Country>USA</Country> <HomePhone>(206) 555-9857</HomePhone> <Extension>5467</Extension> </record> </employees> Attach new XML map by doing the following: 1) Open XML source tab by selecting Data >> XML >> XML Source. 2) Then click on “XML maps…” button that will bring up the window with XML map list. 3) Add a new one by clicking “Add…” button and selecting the prepared XML file as XML source. 4) When a warning message that no XML schema is referred to this file appears, just click “Ok” and Excel will create schema automatically.
Fig. 3.2.3 Warning that Microsoft Excel will create a schema based on selected XML file.
Now you have to map all XML elements to spreadsheet data columns. After you have finished that you can export the spreadsheet to XML.
Fig. 3.2.4 XML elements mapped to Microsoft Excel spreadsheet data columns. Save your spreadsheet as XML file to your project folder. It is time to prepare PDF document that should be used as the background. Use Microsoft Word text processor and create a document with space left for data to be changed. The document may look like this one (see Fig. 3.2.5). Save it as an XML (WordML) file.
Fig. 3.2.5 Letter with space left for employee personal data Use XEP Assistant and WordML2FO stylesheets from XEPWin package to produce a PDF file from your mockup. Finally you have all necessary files to create a new project.
3.3. Preparing XML File: Exporting Data from SQL ServerLet's make an example using test database Northwind. We will use Query Analyzer (Microsoft SQL Server 2000) for data conversion.
Fig. 3.3.1 Data in Employees table
<root> <%begindetail%> <%insert_data_here%> <%enddetail%> </root>
EXECsp_makewebtask @outputfile ='c:\temp\myxmlfile.xml', @query = 'select * from Employees for xml auto', @templatefile = 'c:\temp\template.tpl' Where: @outputfile - a full way to file XML. @query – sql query for necessary data @templatefile - the file template on which will be made XML a file. Run the query by pressing F5 or select Query -> Execute from menu.
Fig.3.3.2 Query to export table data
Fig. 3.3.3 Resulting XML file
4. Interface
4.1. Application Panes and What They Are Intended ForApplication has docking style tool window interface (“pane” term is used as well as “tool window” one further on documentation). There are several predefined windows layout combinations. The project window consists of the following panes:
Fig. 4.1.1 VisualXSL interface with sample project W9 opened
User can choose the most comfortable tool windows combination from predefined set (menu Window) or arrange tool windows manually. Anyway the last window configuration will be saved if application exits successfully and will be restored on the next application startup.
4.2. Menus and ToolbarsThe basic commands are placed on the tool bar for quick access. Most of them are available in the menu. File operations
Open is a drop-down button list (see the description below).
Data operations
Edit operations
Add Page, this option adds a new page to the project (available in the menu only). Remove Page, this option removes the current page from the project (available in the menu only).
Note. All actions performed to the data field are considered to be a single action, while the data field is still selected. For example, if the data field size and position are changed while it is selected undo will rollback both changes. However, if the size is changed for data field and position for another one, then Undo will rollback the last action only.
Edit Para/Finish Editing Para, this option starts or finishes editing of paragraph block according to the current name. Build operations
Selection alignment buttons
Other operations
4.3. Application OptionsThe application options dialog can be accessed by main menu Options→ Preferences.
Fig. 4.3.1 Options dialog Rendering
Rasterization
Layout Grid
5. Data Fields
All data fields placed onto the design layout are shown as frames. Such frame can be selected by clicking. To select several frames keep pressing Ctrl and click on them. Properties of the selected frame (or group selection) are shown in the Properties pane. Look for detailed description of them below.
5.1. General Data Field Properties
Data field properties are grouped into the following groups.
AppearanceBackgroundColor lets you choose the color for the background. E.g. white – to make the area beneath the data field in the resulting PDF invisible. BlockProperties is a subgroup that contains block-level properties. They are described below. Alignment is a text alignment (inherited, left, start, center, right, end, justified). AlignmentLast is a text alignment applying only to the last line of the text block. It has the same set of values as the Alignment. IndentationFirst, IndentationLast, IndentationLeft and IndentationRight lets setting the corresponding indent for the data field. They are corresponding to XSL-FO traits text-indent, last-line-end-indent, start-indent and end-indent accordingly. LineFeed corresponds to XSL-FO linefeed-treatment property, defines the way of line feed characters handling. Displaying of this feature in designer area is not implemented.
WrapOption specifies whether or not the text should be wrapped to fit the frame size. Orientation property is setting block orientation, it allows rotating data fields. This property is analogue of XSL-FO reference-orientation trait. VerticalAlignment specifies vertical alignment. Values meanings are listed below:
DataInnerText is a subgroup that contains properties that concern to the content of the field. Comment is a description for the field. It is used to generate comment in the resulting stylesheet. Also it can be helpful for navigating the document structure. DataTypespecifies data type stored in XML source. This property provides necessary information for formatting of the text from XML source. Currently only Date and Text types are supported. DataFormat contains code that defines additional field formatting. For more details see sub-section 5.6. Data Fields Additional Formatting (Date/Time Only), also there is a table of available codes. Application does not provide the list of codes and does not check their validity. If an incorrect value is set for this property the default code (0) will be used for formatting. Text is a design time text to be displayed at the layout. It has special meaning for some fields (see below description of the Image specific properties and special fields). TextProperties contains properties for text formatting inside the block. Font is font properties (font family, size, styles, direction, etc). ForeColor is a color of field’s text. XPathValue is an XPath expression that returns a value from a node set defined in the Pattern. Patternis an XPath expression that selects an XML branch (node set). Caution! If a user manually modifies an XPath expression in Pattern property he should make sure that it is correct and evaluated to some XML node-set and this node-set is a descendant of XML node evaluated with page Pattern property. Test contains the XPath expression that defines condition to show or not the content.
CoordinatesLocationisthecoordinates of the data field frame’s top left corner. Size is width and height of the data field frame. The value for these properties can be using following measure units: points (pt), pixels (px), inches (in), centimeters (cm), millimeters (mm). If no measure unit is specified the default one (points) is used.
5.2. Checkbox Specific Properties
AppearanceFontSize defines the font size of the check mark inside of the field.
DataCheckType defines the checkbox style.
5.3. Image Specific Properties
DataXPathValue is not used by default for a newly created field. In order to extract the image URI from the source XML using XPath a user should manually edit ImageUrl property. For more details see description and example below. ImageUrl is an URL or a local path to the image file. By default it is a static path to image. It can be changed by clicking (…) button (this will bring browse dialog). In case user wants to use XPathValue to extract a part of the URI from XML, he has to use the tag {xpath-value} inside ImageUrl property. Suppose that we have some storage of employee’s photos in a shared folder of our intranet server. All files are named in the following way: http://intranet-server.com/photo/XXXX.jpg, Where “XXXX” is a serial number from 1 to 9999
Suppose that we have the following XML fragment describing every employee: <employees> <recordid="1"> <name>John Doe</name> </record> <recordid="2"> <name>Adam Smith</name> </record> </employees> We should use the following values to render images in our document
5.4. Barcode Specific Properties
AppearanceModule is the width of the narrowest stripe in a barcode. Use this parameter to control the width of the barcode. DataType is the barcode type. Available types of barcodes to render are EAN8, EAN13, UPC-A, UPC-E, Interleaved 2 of 5, Code 3 of 9, Codabar, Code128, Australian Post 4-state code. Please, keep in mind that no validation of XPath expression result to barcode specification rules is available.
5.5. Special FieldsThe application makes possible to insert a special field into the project. On the step of generating XSL stylesheet they will be transformed into XSL parameters. It enables a user to set some values at XSL transformation stage. Special fields are described in format-plugin.xml (it is created in %ProgramFiles%/VisualXSL/XSL subfolder of the application folder). Just drag and drop XML node from XML tree view to the layout to insert the one. Change the value of XPathValue property in its object properties to the name of a desired field (see list below). The name should be specified with preceding symbol “$”.
A user can also insert the custom special field, which will be later transformed into stylesheet parameter. In this case XPathValue should be set to “$<special-name>”. Where special-name is CName (satisfies standard XSL demands of variable naming). Set default value of the parameter by changing Text property.
5.6. Data Fields Additional FormattingThe application makes possible to apply additional formatting to the field content. Currently only different date formats are implemented. The date value in source XML file should be properly specified in ISO8601 format (yyyy-mm-ddThh:mm:ss:mmm) or ODBC canonical format (yyyy-mm-dd hh:mi:ss). Select field containing correct date value for applying formatting. Switch to its object properties; choose Datevalue for DataType property. Then specify format code for DataFormatproperty (all supported format codes listed in the table below). To refresh the designer area (and see updated formatting of data field) click Refresh button. Date format codes
Milliseconds (if they are specified in XML data for a field) will not be rendered after the layout being refreshed, but will be rendered in the resulting PDF document.
5.7. Address Label WizardThe application provides wizard for adding address labels to the document. The resulting label will be aligned vertically to the bottom of the label and will consist of 4 or 5 address lines. There are three areas in the wizard dialog (see the figure 5.7.1). The first one is a tree representing the first element from the XML source file (further XML tree). The second is a group of textboxes for address parts. And the third one (placed right down the second one) is a sort of preview for the address label. A user can add data from XML tree to textboxes by double click on tree node, by dragging nodes into or by clicking Add >> button.
Fig. 5.7.1 Address Block Wizard In a case a user clicks Add >> button data will be added to the highlighted textbox. When a user tries to add new data to the textbox that already contains some text, the new data will replace the previous one. And vice versa, by clicking << Rem button the textbox can be cleared. The data added from XML tree in such a way will be inserted into the resulting document dynamically. Also a user can type in some static data if needed. The application forms the PostNet barcode from 3 last textboxes. It assumes that all data typed into them are numeric, so please make sure that XML data represents a proper number for post code. Note. Currently application has no option to specify fonts to be used in document formatting. So a user should manually edit the configuration file for XEP and add a section to describe PostNet True Type font. Example Let’s assume that XEPWin is installed to “C:\Program Files\RenderX\XEPWin” folder.
<font-familyname="IDAutomationPOSTNET"embed="true"> <font> <font-data ttf="IDAutomationPOSTNET.ttf"/> </font> </font-family> That makes possible for XEP formatter to use True Type font for Postnet barcodes rendering.
5.8. Paragraph BlockThe application has an ability to put some paragraphs with different formatting properties into one block-container. Example of such a block-container is an address block. The main advantage of such a feature is possibility to prepare text blocks using XML data of variable length (so there is no possibility to leave blank for a data field). Also it may be helpful when different formatting should be applied to different parts of one paragraph. Initially, when a user adds a paragraph block to the project (from menu Data -> Add Paragraph menu) it has no paragraphs and will not be rendered in the preview or the result document. A user should select Edit –> Edit Para from the menu to add paragraph or to edit existing ones inside the block. This will bring up the following view:
Fig. 5.8.1 Empty paragraph block added to the layout A user can type in a static text there, drag and drop nodes with data from XML tree or type the XPath expression inside curly brackets. To apply formatting to the text, select it and click the appropriate toolbar button.
Fig. 5.8.2 The paragraph block is being edited. Some data fields and static text have been added To finish editing of the paragraph select Edit -> Finish Editing Para or click toolbar button with cross. Formatting of the text is limited by control possibilities that’s why most of XSL-FO features are inaccessible (that situation will be improved in the next application version). Caution! Before editing a paragraph block a user should ensure that the whole block on the design layout is visible to them. In other case, a user will have to scroll design layout manually to see all text being edited. Undo/redo is not supported while user is editing the paragraph block.
6. How To
6.1. How to Create Your Own ProjectTo create a new project:
6.2. How to Create Multi-Page Form ProjectThe easiest way to create a multi-page project is to follow these steps: Create a new project.
6.3. How to Add Data FieldsAfter the project is created data fields can be added, modified or removed. Data field is a frame on the Layout. It is rendered in the resulting document “dynamically” getting data from the XML data file. Follow these steps to add new data fields:
See detailed properties description in the “General Data field properties description”.
6.4. How to Fill In Preprinted Forms with DataIn order to fill in paper forms with data fields follow these steps:
6.5. How to Use Log PaneThe log pane allows tracing the formatting progress. It contains all the messages from the XEP formatting engine. The messages are highlighted in the following way: Some of them contain clickable links (warnings and errors concerning incorrect XPath expression in the data field). You can click them to go to the problematic object.
Fig. 6.5.1 Warnings are marked blue in log pane It will be of use to take a look at the log after every document formatting. It is highly important if the document is not generated successfully because the log can show the reason.
6.6. How to Create PDF/PS Documents with VisualXSLAfter the project is created and all necessary data fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||