0.0
No commit activity in last 3 years
No release in over 3 years
Generate PDF from ODF via Py3o.Fusion
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 11.2
~> 3.8

Runtime

~> 0.16.4
 Project Readme

Py3o.Fusion

Gem Version

Generate PDF from ODF via Py3o.Fusion and replace text fields and images.

See Py3o.Fusion for more information.

Usage

Constructor

Instantiate with URL to Py3o.Fusion form endpoint.

    py3ofusion = Py3oFusion.new('http://localhost:8765/form')

template(path)

Set path to ODF template file to use.

Example

Reads the file named template.odt and uses it as the template to generate PDF from.

    py3ofusion.template("template.odt")

data(hash)

Data dictionary with variables to replace in the ODF document.

Example

Replaces the text field named py3o.item.fieldname with the text Replacement text.

    py3ofusion.data({
      item: {
        fieldname: 'Replacement text'
      }
    })

static_image(name, path)

Replace an image with the name py3o.staticimage. prefixed to image_name.

Example

Replaces the image named py3o.staticimage.logo with the file at path logo.png.

    py3ofusion.static_image("logo", "logo.png")

generate_pdf(path)

Send the data to Py3o.Fusion to replace fields and images, and generate a PDF file that will be saved at output_path.

    py3ofusion.generate_pdf('output.pdf')

Complete example

A complete use, chaining methods together.

    require 'py3o_fusion'

    data = {
      item: {
        fieldname: 'Replacement text'
      }
    }

    Py3oFusion.new('http://localhost:8765/form')
      .template("template.odt")
      .static_image("logo", 'logo.png')
      .data(data)
      .generate_pdf('output.pdf')