What is XDocReport
master.docx) or OpenOffice/LibreOffice (.odt). The tool allows you to generate reports and convert them into various formats such as PDF or XHTML.repository·master·Indexed 23 days ago
https://github.com/opensagres/xdocreportXDocReport is a Java-based reporting engine that merges XML documents (.docx, .odt) with Java data models to generate reports and convert them into formats such as PDF and XHTML. It includes a Java API, a command-line interface (CLI) for document processing, and remoting tools for interacting with JAXRS and JAXWS services.
.docx) or OpenOffice/LibreOffice (.odt). The tool allows you to generate reports and convert them into various formats such as PDF or XHTML.XDocReport has a split licensing model depending on which modules you use:
Important: If you use and redistribute XDocReport with the iText-based PDF converter, your project must comply with the LGPL license rather than the MIT license. This is why the official XDocReport samples are licensed under LGPL.
You can interact with XDocReport through several online web applications to test report generation and conversion capabilities:
docx and odt to pdf or xhtml).Source code for these demos is available at https://github.com/opensagres/xdocreport.samples.
The following positional arguments are accepted by the xdrtools-rep.bat script in this exact order:
| Argument | Description |
|---|---|
BASE_ADDRESS | The base address for the service |
USER | The username |
PASSWORD | The password |
SERVICE_TYPE | The type of service |
SERVICE_NAME | The name of the service |
OUT | Output file path |
ERR | Error log/file path |
RESOURCES | Resources path/identifier |
CHUNK | Chunk size or configuration |
TIMEOUT | Timeout value |
Note: Because these are passed as positional parameters in a batch script, ensure you provide all required values in the correct sequence.
The following service names are supported by the CLI to determine the operation type:
name: Retrieves the repository name.root: Retrieves the root resource structure (output as XML).download: Downloads a specific resource.upload: Uploads a resource from a local file.uploadLarge: (JAXRS only) Uploads a large file using streaming.downloadLarge: (JAXRS only) Downloads a large file using streaming.The xdrtools-rep.sh shell script is a CLI entrypoint used to launch the XDocReport Remoting tools. It wraps a Java execution that invokes fr.opensagres.xdocreport.document.tools.remoting.resources.Main.
To use this tool, you must provide arguments in a specific positional order. Note that the script is designed such that if you provide more than the expected number of arguments for certain positions, it will trigger an error.
| Position | Argument Name | Description |
|---|---|---|
| 1 | BASE_ADDRESS | The base address for the service |
| 2 | USER | The user for authentication |
| 3 | PASSWORD | The password for authentication |
| 4 | SERVICE_TYPE | The type of service being accessed |
| 5 | SERVICE_NAME | The name of the service |
| 6 | OUT | Output file path |
| 7 | ERR | Error log file path |
| 8 | RESOURCES | Path to resources |
| 9 | CHUNK | Chunking configuration |
| 10 | TIMEOUT | Timeout value |
The script maps these positional arguments to the following Java command-line flags:
-baseAddress-user-password-serviceType-serviceName-out-err-resources-chunk-timeoutThe xdrtools.sh script is a shell wrapper for the fr.opensagres.xdocreport.document.tools.Main Java class. It allows you to run XDocReport tools from the command line by providing input files, output destinations, and configuration parameters.
Note: The script expects arguments in a specific order. If you provide more than the expected number of arguments, it will fail with an error.
-in: The input file path.-out: The output file path.-dataDir: The directory containing data files.-metadataFile: The path to the metadata file.-err: The error file/log path.The xdrtools.bat script is a Windows batch entrypoint for running XDocReport command-line tools. It requires five positional arguments to execute the fr.opensagres.xdocreport.document.tools.Main class.
Arguments:
IN: Input file pathOUT: Output file pathMETADATA_FILE: Path to the metadata fileDATA_DIR: Directory containing data filesERR: Error file path/identifierUsage Example:
xdrtools.bat input.docx output.pdf metadata.xml ./data error.logThe Main class provides a command-line interface for interacting with XDocReport remoting resources. It supports both JAXRS and JAXWS service types and allows for common operations such as uploading/downloading resources, retrieving the repository name, and inspecting the root resource structure.
| Argument | Description |
|---|---|
-baseAddress | The base URL of the remoting service. |
-serviceType | The protocol type: JAXWS or JAXRS (defaults to JAXRS if not specified). |
-serviceName | The specific operation to perform (e.g., upload, download, root, name, uploadLarge, downloadLarge). |
-resources | The resource ID(s) to operate on. |
-out | The output file path for the result. |
-user | Username for authentication (Note: the code uses -password for both user and password in some logic, but -user is the intended semantic for the context). |
-password | Password for authentication. |
-timeout | Connection timeout in milliseconds. |
-chunk | Boolean flag to enable/disable chunking. |
-err | Path to a file where error stack traces should be written. |
The fr.opensagres.xdocreport.document.tools.Main class provides a command-line interface for processing documents using XDocReport. It allows you to specify an input file, an output destination, a template engine, metadata files, and a directory containing data providers.
| Flag | Description |
|---|---|
-in | The path to the input file. |
-out | The path to the output file. |
-err | The path to a file where error stack traces should be written. If the file exists, it is deleted before writing. |
-engine | The type of template engine to use. |
-metadataFile | Path to an XML metadata file. If provided, this file determines the templateEngineKind. |
-dataDir | A directory containing data files (e.g., JSON, XML). The tool will scan this directory and create IDataProvider instances for each supported file extension. If no providers are found but a metadata file is present, the tool attempts to generate a default.json in this directory. |
java fr.opensagres.xdocreport.document.tools.Main -in input.docx -out output.pdf -engine freemarker -dataDir ./dataThe xdrtools-rep.bat script is a Windows command-line entrypoint for running the XDocReport-Repository Tools. It executes the fr.opensagres.xdocreport.document.tools.remoting.resources.Main class with a set of positional arguments.
To use the tool, you must provide arguments in the specific order defined by the script. The script automatically builds the classpath by scanning the ../lib directory for all available .jar files.