Skip to content

convertigo/c8oprj-lib-odftoolkit

Repository files navigation

lib_fill_odt_pdf

ODFToolkit and PDF library

For more technical informations : documentation

Installation

  1. In your Convertigo Studio use File->Import->Convertigo->Convertigo Project and hit the Next button

  2. In the dialog Project remote URL field, paste the text below:

    UsageClick the copy button
    To contribute
    lib_fill_odt_pdf=https://github.com/convertigo/c8oprj-lib-odftoolkit.git:branch=master
    
    To simply use
    lib_fill_odt_pdf=https://github.com/convertigo/c8oprj-lib-odftoolkit/archive/master.zip
    
  3. Click the Finish button. This will automatically import the lib_fill_odt_pdf project

Sequences

clean_outputs

Clean the generated files. Can be used in a Convertigo scheduled job to automate the process. Variables : 'max_time' => delete only files older than x ms. 'all' => Delete all files in folder even in a max_time is defined. 'target' => Folder path containing the files to delete. Can use "./", ".//" or absolute path syntax.

variables

namecomment
allSet value to 'true' to directly delete all files whatever last modified date they have. Default is 'false', it only deletes files older than 'max_time'
max_timeDefine the maximum time in millisecond before deleting the file. Default is 86400000ms (24h). Only works if 'all' is 'false'
target

demo_export_data_to_sheet

Demo sequence to create a spreadhseet filled with data.

demo_u_fill_odt

Demo sequence to fill an ODT template file.

demo_u_fill_pdf

Demo sequence to fill an ODT template file.

demo_u_fill_table_odt

Demo sequence to fill an ODT template file.

demo_u_fill_table_template_odt

Demo sequence to fill an ODT template file.

fill_odt

Fills an ODT template file (Deprecated). Place your template files in .//templates/odf folder.

variables

namecomment
dateDate
input_filenameInput ODT template file name to fill (without extension, '.doc' is automatically added but format is ODT and can be opened as a Ms Word file or OpenOffice). Put your templates in /templates/odf
objetSubject
output_filenameOutput ODT file name (without extension). '.doc' is automatically added to filename to be opened by Ms Word or OpenOffice.
signatureSignature. Absolute Image file path.
texteMain Body Text

fill_pdf

Fills a PDF template file (deprecated). Place your template file in .//templates/pdf folder.

variables

namecomment
dateDate
input_filenameInput PDF template file name to fill (without extension, '.pdf' is assumed). Put your templates in /templates/pdf
objetSubject
output_filenameOutput PDF file name (without extension). '.pdf' is automatically added to filename.
signatureSignature. _ Image file. Can be an aboslute path file or relative to project (.//) or workspace (./). _ B64 string.
texteMain Body Text

getInstalledFonts

Get installed Fonts

init_config

Auto start sequence to install some required fonts for Docker Linux Platform.

metadata_pdf

Get the metadata of the PDF file.

variables

namecomment
input_filenameODT input template file name to fill. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
modeRead or Write PDF metadata. To write to PDF file, use 'w' or 'write'. output_filename must not be left blank or empty.
new_ap_canAssembleDocumentPermission to assemble the document
new_ap_canExtractContentPermission to extract content from the document
new_ap_canExtractForAccessibilityPermission to extract content for accessibility purposes
new_ap_canFillInFormPermission to fill in forms in the document
new_ap_canModifyPermission to modify the document
new_ap_canModifyAnnotationsPermission to modify annotations
new_ap_canPrintPermission to print the document
new_ap_canPrintHighQualityPermission to print the document faithfully
new_ap_ForcePolicyForce a new protection policy according to password, new_user_password and new_owner_password.
new_authorSet the AUTHOR metadata
new_creation_dateSet the CREATION DATE metadata
new_creatorSet the CREATOR metadata
new_keywordsSet the KEYWORDS metadata
new_modification_dateSet the MODIFICATION DATE metadata
new_owner_passwordOwner password of the protected PDF file.
new_producerSet the PRODUCER metadata
new_setProtectionIf "true", it will protect the PDF file with the given 'new_user_password' and 'new_owner_password', defaulting to 'password' variable if one is missing.
new_subjectSet the SUBJECT metadata
new_titleSet the TITLE metadata
new_trappedSet the TRAPPED metadata
new_user_passwordUser password of the protected PDF file.
new_versionSet the VERSION metadata
output_filenameODT output file path. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
passwordPassword of the protected PDF file.

odt2pdf

Convert an ODT file to a PDF file

variables

namecomment
font_aliasesFont aliases according to font_paths values.
font_pathsFont absolute paths to register.
fonts_folderFolder absolute path containing the Fonts to register. Font name alias computed from file name. Use font_paths and font_aliases to manually declare fonts instead.
input_filenameODT input file name to convert. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
output_filenamePDF output file path. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.

soffice_odt2pdf

Convert an ODT file to a PDF file using LibreOffice

variables

namecomment
input_filenameODT input file name to convert. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
output_filenamePDF output file path. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
soffice_pathLibreOffice 'soffice' absolute path. Default is 'soffice'

u_create_ods

Create a new Calc document fr om a structured JSON.

variables

namecomment
output_filenameODS output file path. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
rowsStructured object as follow :

{ "sheets": [ "name": "<Sheet name>", "header": { "style": //Optional { "bgColor": "<Background color>", "HAlign": "<Horizontal alignment>", "VAlign": "<Vertical alignment>", "fontName": "<Font name>", "fontStyle": "<Font style>", "fontColor": "<Font color>", "fontSize": "<Font size>" }, "value": [<Array of strings>] }, "data": [ [ { "value" : "<Cell content>", "type": "<Cell type>" } ] ] ] }

u_create_odt

Create a new Text document with a table. Works the same as u_fill_odt sequence.

variables

namecomment
markersStructured array as follow :

[ { "tag": "<tag name in template file to replace with 'value' key>", "type": "<tag type. 'image' or 'string' supported>", "value": "<replacement string or image absolute path>" } ]>

output_filenameOutput ODT file name (without extension). '.odt' is automatically added to filename to be opened by Ms Word or LibreOffice.

u_export_data_to_sheet

Use to export data to various file format (txt, csv, xlsx, ods...). Uses the SheetJS CE framework.

Output

namecomment
filelocal_path -> Server local file path.
url_path -> Server file path url.
attachment@local-url -> Server local file path.
@name -> File name.
successtrue/false
errorError message.

variables

namecomment
book_typeType of workbook to export to. Default is XLSX.
output_filenameOutput file path. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace pat
rowsStructured object as follow:

{ "sheets": [ "name": "<Sheet name>", "header": { "style": //Optional { "bgColor": "<Background color>", "HAlign": "<Horizontal alignment>", "VAlign": "<Vertical alignment>", "fontName": "<Font name>", "fontStyle": "<Font style>", "fontColor": "<Font color>", "fontSize": "<Font size>" }, "value": [<Array of strings>] }, "data": [ [ { "value" : "<Cell content>", "type": "<Cell type>" } ] ] ] }

u_fill_odt

Fills an ODT template file (Universal). Place your template files in .//templates/odf folder. It will output an attachment structure and if you call it with .bin requester it will trigger a download in the client Browser.

variables

namecomment
break_beforeDefine the BreakBefore table style property. Can be 'auto', 'column' or 'page'. Default is set to 'page'.
input_filenameODT input template file name to fill. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
markersStructured array as follow :

[ { "tag": "<tag name in template file to replace with 'value' key>", "type": "<tag type. 'image', 'string', 'span' (font styles), 'table' and 'tableh' (title row) supported>", "style": "<Font styles for span or table cells. Look at demo_u_fill_odt for syntax>" "value": "<replacement string or image absolute path>" } ]>

meta_creation_dateDefines the Creation Date metadata in the ODT Document. ISO 8601 date format: yyy-MM-dd'T'HH:mm:ss. If null or empty, does not change it.
meta_descriptionDefines the Description metadata in the ODT Document. If null, does not change it. If empty, removes it.
meta_initial_creatorDefines the Creator metadata in the ODT Document. If null, does not change it. If empty, removes it.
meta_keywordsDefines the Keywords metadata in the ODT Document. Multi-valued variable. Each entry is a keyword. If null, does not change it. If empty, removes it.
meta_subjectDefines the Subject metadata in the ODT Document. If null, does not change it. If empty, removes it.
meta_titleDefines the Title metadata in the ODT Document. If null, does not change it. If empty, removes it.
output_filenameODT output file path. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
table_template_filePath of the ODT file containing a table to use as a template.
table_template_nameName of the template table.

u_fill_pdf

Fills a PDF template file (Universal). Place your template file in .//templates/pdf folder. It will output an attachment structure and if you call it with .bin requester it will trigger a download in the client Browser.

variables

namecomment
input_filenamePDF input file path. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.
markersStructured array as follow :

[ { "tag": "<tag name in template file to replace with 'value' key>", "type": "<tag type. 'image' or 'string' supported>", "value": "<replacement string or image absolute path>" } ]

output_filenamePDF output file path. Can be an absolute path or a relative Convertigo path: ".//" is relative to the project's path. "./" is relative to the workspace path.

u_read_odt

Dev sequence to read a table from a Text Document.

variables

namecomment
markersStructured array as follow :

[ { "tag": "<tag name in template file to replace with 'value' key>", "type": "<tag type. 'image' or 'string' supported>", "value": "<replacement string or image absolute path>" } ]>

output_filenameOutput ODT file name (without extension). '.odt' is automatically added to filename to be opened by Ms Word or LibreOffice.

u_read_pdf

Reads a PDF file (Universal). Place your template file in .//read folder. It will output the following structure : { "array": [ { "name": "", "value": "", "type": "PDF Form type" }, ...]

variables

namecomment
input_filenamePDF input file name to read the technical fields name and value. Can be an absolute path or a relative Convertigo path. ".//" is relative to the project's path. "./" is relative to the workspace path.

About

This is the PDF and DOC file generator for Convertigo low code / No Code platform. Use this library to generate WORD , ODT or PDF documents from dynamic data. The library is based on the ODF toolkit to fill PDF or ODT documents templates

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors