Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XMPL Specification documentation #5

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ This project includes two main components:

## Features

* XML to Binie conversion
* XMPL to Binie conversion
* PDF generation with custom fonts and images
* [GDI](https://en.wikipedia.org/wiki/Graphics_Device_Interface) printing (Windows) via [Colony NPAPI (npcolony)](https://github.com/hivesolutions/colony-npapi)
* [CUPS](https://en.wikipedia.org/wiki/CUPS) printing (Linux) via [Colony NPAPI (npcolony)](https://github.com/hivesolutions/colony-npapi)

## XMPL Specification

The XML Markup Language for Printing (XMPL) is integral to our document processing pipeline. For an in-depth understanding of the XMPL structure and its seamless convertibility to Binie, see the [XMPL File Format Specification](xmpl.md).

## Installation

### Pre-requisites
Expand Down
102 changes: 102 additions & 0 deletions xmpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# XMPL – XML Markup Language for Printing 1.0

## Motivation

XMPL is a file format specification developed to enable diverse applications to create and manipulate structured documents for printing purposes.
The design of XMPL facilitates its conversion into Binie format, making it a versatile intermediary for rendering structured, print-ready documents.
XMPL appends additional, implementation-agnostic information about the document layout, allowing a single XML-based file to be transformed into a fully-featured, print-ready format.

## Specification

XMPL uses an XML structure where each element and attribute is carefully defined to represent various components of a print document.

### XMPL Document Structure

XML documents are structured with nested elements, each representing a part of the print layout, such as blocks, paragraphs, lines, text, and images.

#### Document Root: `printing_document`

The root element for any XMPL document. It encapsulates all the content elements of the document.

```xml
<printing_document>
<!-- Nested Elements -->
</printing_document>
```

#### Block Element: `block`

Defines a container for grouping related content elements like paragraphs, text, and images.

```xml
<block>
<!-- Nested Elements -->
</block>
```

#### Paragraph Element: `paragraph`

Represents a paragraph within a block, including lines, text, or images.

```xml
<paragraph>
<!-- Nested Elements -->
</paragraph>
```

#### Line Element: `line`

Denotes a single line within a paragraph, typically holding text or image elements.

```xml
<line>
<!-- Nested Elements -->
</line>
```

#### Text Element: `text`

Specifies a segment of text within a line or a paragraph.

```xml
<text>
<!-- Text Content -->
</text>
```

#### Image Element: `image`

Used for embedding images within the document layout.

```xml
<image>
<!-- Image Attributes -->
</image>
```

### Attributes and Properties

Elements in XMPL files may have various attributes defining their properties, such as font for text or size for images.

### Convertibility to Binie

The XMPL format has been designed for easy and efficient conversion to the Binie file format.
This feature allows XMPL to serve as a flexible tool for creating structured documents that can be readily transformed into a print-ready format.

### Example

Below is an example of an XMPL document designed to display "Hello World" in a centered paragraph.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<printing_document name="hello_world" font="Calibri" font_size="9">
<paragraph text_align="center">
<line><text>Hello World</text></line>
</paragraph>
</printing_document>
```

## Validation and Compatibility

XMPL is structured to be robust and flexible, ensuring that the conversion to Binie maintains the integrity and layout of the document.
Implementations are expected to handle XMPL structure gracefully, supporting a wide range of document configurations.