ODFToolkit and PDF library
For more technical informations : documentation
- Installation
- Sequences
- clean_outputs
- demo_export_data_to_sheet
- demo_u_fill_odt
- demo_u_fill_pdf
- demo_u_fill_table_odt
- demo_u_fill_table_template_odt
- fill_odt
- fill_pdf
- getInstalledFonts
- init_config
- metadata_pdf
- odt2pdf
- soffice_odt2pdf
- u_create_ods
- u_create_odt
- u_export_data_to_sheet
- u_fill_odt
- u_fill_pdf
- u_read_odt
- u_read_pdf
-
In your Convertigo Studio use
File->Import->Convertigo->Convertigo Projectand hit theNextbutton -
In the dialog
Project remote URLfield, paste the text below:Usage Click the copy button To contribute lib_fill_odt_pdf=https://github.com/convertigo/c8oprj-lib-odftoolkit.git:branch=masterTo simply use lib_fill_odt_pdf=https://github.com/convertigo/c8oprj-lib-odftoolkit/archive/master.zip -
Click the
Finishbutton. This will automatically import the lib_fill_odt_pdf project
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
| name | comment |
|---|---|
| all | Set 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_time | Define the maximum time in millisecond before deleting the file. Default is 86400000ms (24h). Only works if 'all' is 'false' |
| target |
Demo sequence to create a spreadhseet filled with data.
Demo sequence to fill an ODT template file.
Demo sequence to fill an ODT template file.
Demo sequence to fill an ODT template file.
Demo sequence to fill an ODT template file.
Fills an ODT template file (Deprecated). Place your template files in .//templates/odf folder.
variables
| name | comment |
|---|---|
| date | Date |
| input_filename | Input 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 |
| objet | Subject |
| output_filename | Output ODT file name (without extension). '.doc' is automatically added to filename to be opened by Ms Word or OpenOffice. |
| signature | Signature. Absolute Image file path. |
| texte | Main Body Text |
Fills a PDF template file (deprecated). Place your template file in .//templates/pdf folder.
variables
| name | comment |
|---|---|
| date | Date |
| input_filename | Input PDF template file name to fill (without extension, '.pdf' is assumed). Put your templates in /templates/pdf |
| objet | Subject |
| output_filename | Output PDF file name (without extension). '.pdf' is automatically added to filename. |
| signature | Signature. _ Image file. Can be an aboslute path file or relative to project (.//) or workspace (./). _ B64 string. |
| texte | Main Body Text |
Get installed Fonts
Auto start sequence to install some required fonts for Docker Linux Platform.
Get the metadata of the PDF file.
variables
| name | comment |
|---|---|
| input_filename | ODT 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. |
| mode | Read or Write PDF metadata. To write to PDF file, use 'w' or 'write'. output_filename must not be left blank or empty. |
| new_ap_canAssembleDocument | Permission to assemble the document |
| new_ap_canExtractContent | Permission to extract content from the document |
| new_ap_canExtractForAccessibility | Permission to extract content for accessibility purposes |
| new_ap_canFillInForm | Permission to fill in forms in the document |
| new_ap_canModify | Permission to modify the document |
| new_ap_canModifyAnnotations | Permission to modify annotations |
| new_ap_canPrint | Permission to print the document |
| new_ap_canPrintHighQuality | Permission to print the document faithfully |
| new_ap_ForcePolicy | Force a new protection policy according to password, new_user_password and new_owner_password. |
| new_author | Set the AUTHOR metadata |
| new_creation_date | Set the CREATION DATE metadata |
| new_creator | Set the CREATOR metadata |
| new_keywords | Set the KEYWORDS metadata |
| new_modification_date | Set the MODIFICATION DATE metadata |
| new_owner_password | Owner password of the protected PDF file. |
| new_producer | Set the PRODUCER metadata |
| new_setProtection | If "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_subject | Set the SUBJECT metadata |
| new_title | Set the TITLE metadata |
| new_trapped | Set the TRAPPED metadata |
| new_user_password | User password of the protected PDF file. |
| new_version | Set the VERSION metadata |
| output_filename | ODT 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. |
| password | Password of the protected PDF file. |
Convert an ODT file to a PDF file
variables
| name | comment |
|---|---|
| font_aliases | Font aliases according to font_paths values. |
| font_paths | Font absolute paths to register. |
| fonts_folder | Folder 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_filename | ODT 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_filename | PDF 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. |
Convert an ODT file to a PDF file using LibreOffice
variables
| name | comment |
|---|---|
| input_filename | ODT 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_filename | PDF 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_path | LibreOffice 'soffice' absolute path. Default is 'soffice' |
Create a new Calc document fr om a structured JSON.
variables
| name | comment |
|---|---|
| output_filename | ODS 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. |
| rows | Structured 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>" } ] ] ] } |
Create a new Text document with a table. Works the same as u_fill_odt sequence.
variables
| name | comment |
|---|---|
| markers | Structured 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_filename | Output ODT file name (without extension). '.odt' is automatically added to filename to be opened by Ms Word or LibreOffice. |
Use to export data to various file format (txt, csv, xlsx, ods...). Uses the SheetJS CE framework.
Output
| name | comment |
|---|---|
| file | local_path -> Server local file path. url_path -> Server file path url. |
| attachment | @local-url -> Server local file path. @name -> File name. |
| success | true/false |
| error | Error message. |
variables
| name | comment |
|---|---|
| book_type | Type of workbook to export to. Default is XLSX. |
| output_filename | 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 pat |
| rows | Structured 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>" } ] ] ] } |
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
| name | comment |
|---|---|
| break_before | Define the BreakBefore table style property. Can be 'auto', 'column' or 'page'. Default is set to 'page'. |
| input_filename | ODT 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. |
| markers | Structured 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_date | Defines 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_description | Defines the Description metadata in the ODT Document. If null, does not change it. If empty, removes it. |
| meta_initial_creator | Defines the Creator metadata in the ODT Document. If null, does not change it. If empty, removes it. |
| meta_keywords | Defines 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_subject | Defines the Subject metadata in the ODT Document. If null, does not change it. If empty, removes it. |
| meta_title | Defines the Title metadata in the ODT Document. If null, does not change it. If empty, removes it. |
| output_filename | ODT 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_file | Path of the ODT file containing a table to use as a template. |
| table_template_name | Name of the template table. |
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
| name | comment |
|---|---|
| input_filename | PDF 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. |
| markers | Structured 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_filename | PDF 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. |
Dev sequence to read a table from a Text Document.
variables
| name | comment |
|---|---|
| markers | Structured 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_filename | Output ODT file name (without extension). '.odt' is automatically added to filename to be opened by Ms Word or LibreOffice. |
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
| name | comment |
|---|---|
| input_filename | PDF 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. |