Publisher and Web Interface > Publisher > Generating documents and Publisher HTML > Worked example: generating Publisher HTML through a document definition (Publisher)
  
Worked example: generating Publisher HTML through a document definition (Publisher)
This is one of two worked examples that relate to generating documents and Publisher HTML:
Worked example: generating a document through a document template
Worked example: generating Publisher HTML through a document definition
This worked example demonstrates how to use Publisher to generate Publisher HTML using a provided Document Definition.
Important: You can generate a document using a Document Template or a Document Definition. PTC Document Templates are provided with Publisher (available in the New Document pane), but no Document Definitions are installed with Publisher. You can create your own Document Templates and Document Definitions.
For information about creating a Document Definition, refer to Creating a Document Definition.
By default, Publisher works with the active model in Modeler, so we start by opening the model we want to work with in Modeler. We open the Traffic Lights model from the provided Examples database.
We now start Publisher through the Publisher command on the Tools menu in Modeler.
A Document Definition defines which items and diagrams are included in the generated Publisher HTML and how that information is organized.
A colleague has developed a new Document Definition that is based on the 'Model Package Browser - HTML' document template. This Document Definition generates the items and diagrams in the model in a structure that is similar to the Packages pane in Modeler. The Document Definition file is named Packages_View.ds.
On the File menu, we click Open and we select the Packages_View.ds file. Publisher opens the file and you can see the document structure of Document Definition in Publisher.
In the Generate pane we can see that the Document Definition has set the Style to PTC, which is the recommended style for generating documents and Publisher HTML. The Document Definition has also set the Output Format to Publisher HTML, which is what we want to generate.
Note that if we wanted to generate a Word document, we would change the Output Format to Word.
We want to generate the HTML files to a folder named Publisher HTML on the C: drive, so we set the Output Path to C:\Publisher HTML.
We click the Generate button and Publisher generates the Publisher HTML files. The Launch After Generation check box was selected, so Publisher opens the Publisher HTML in your default internet browser.
When the Publisher HTML is first opened in Internet Explorer, a message typically appears asking you if you want to allow the webpage to run scripts or ActiveX controls. We click the Allow Blocked Content button.
Note that if Internet Explorer removes the preceding message before you click the Allow Blocked Content button, refresh the view.
Notice that the Publisher HTML structure in the left pane is similar to that of the Packages pane in Modeler. When you select a diagram in the left pane, that diagram is shown.
The HTML files are generated to the folder we specified in the Output Path. Publisher creates a subfolder for each Document Definition, the name of the folder being the same as the Title property of the Document Definition.
In our example, Publisher generates the HTML files to the C:\Publisher HTML\Package Browser folder. Publisher creates two files for opening the Publisher HTML output in your web browser:
The HTMLDocument.htm file opens the Publisher HTML output in supported web browsers that are not Google Chrome.
The Run Google Chrome.vbs file opens the Publisher HTML output in the Google Chrome web browser.
In this worked example we have demonstrated how to generate Publisher HTML using a provided Document Definition file.
For information about how to use the Publisher HTML output in Internet Explorer, click here Publisher HTML output format