
XStorable xStorable = (XStorable ) UnoRuntime.
PDF EXPORTER PDF
setString ( "Simple PDF export demo." ) // XStorable to store the document class, xComponent ) // access the text body and set a string XTextDocument xTextDocument = (XTextDocument ) UnoRuntime. createNewDoc (m_xContext, "swriter" ) // access its XTextDocument interface XComponent xComponent = null // create a new Writer document using a helper The following code shows the basic procedure: In the simplest case, all you need for exporting to PDF is the URL where you want to export the document and the filter name this way, the document will be exported using the current PDF export settings (the ones used the last time, or the default values stipulated by the filter configuration, if this is first time). The property needed for this purpose is the string argument FilterName that takes the name of a filter already known by Apache OpenOffice. In the API, documents are storable through their interface .XStorable, as discussed in detail in Developer's Guide - Office Development - Storing Documents.įor exporting, besides the location (in URL notation) where the exported document is to be stored, a filter name must be passed to XStorable.storeAsURL() and XStorable.storeToURL(). They are not intended to provide a ready-to-use PDF export application, but to give you a tool for doing your own experiments.Ī document can be exported by saving it to a different location and using a special filter capable to write the document to the desired format. The sources for this tutorial can be found here.
PDF EXPORTER FULL
This tutorial also aims to provide a full up-to-date documentation about the PDF export filter options, as these specific properties are usually not documented and only available in the core Apache OpenOffice source code (thus not accessible for developers aiming to work only with its API).

PDF EXPORTER HOW TO
The reader should have at least a basic knowledge about handling office documents (how to load and store a document), and should also know how to access Apache OpenOffice configuration. This tutorial will show how to use Apache OpenOffice API to export documents to PDF. PDF export is an important and useful feature of Apache OpenOffice that can completely be automatized using Apache OpenOffice API, quite every aspect of exporting to PDF in the graphical user interface is also available for programming: documents can be exported directly with default settings just passing the proper filter name and an URL, every option the user can set in the GUI can also be set programmatically in the filter options, also these settings are configurable via the API (they can be accessed, changed, or reset to their default values), and even the options dialog for exporting to PDF can be used through pure API calls.
