Skip to content

agilize/libreoffice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libreoffice Microservice

Alpine container service for libreoffice.

Usage

Run Container

docker run -d -p 29881:80 agilize/libreoffice
curl -X POST -vv -F '[email protected]' http://localhost:29881 -o demo.pdf

You can found all libreoffice option here: https://help.libreoffice.org/Common/Starting_the_Software_With_Parameters

PHP example

<?php

$demoPath = realpath('./demo.docx');

$libreofficeOptions = [
];

// set request body
$data = [
    'file' => curl_file_create($demoPath),
    'options' => json_encode($libreofficeOptions)
];

// set header
$headers = [
];

// curl options
$options = [
    CURLOPT_URL            => 'http://localhost/',
    CURLOPT_PORT           => 29881,
    CURLOPT_POST           => 1,
    CURLOPT_POSTFIELDS     => $data,
    CURLOPT_HTTPHEADER     => $headers,
    CURLOPT_RETURNTRANSFER => true
];

// curl call
$ch = curl_init();
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
curl_close($ch);

// print result
echo $result;