2 #include "LibreOfficeKit/LibreOfficeKit.hxx"
4 int main(int argc
, char* argv
[])
8 std::cout
<< "Usage: lokconvert <input_file_path> <output_file_path>\n";
11 const char* input
= argv
[1];
12 const char* output
= argv
[2];
14 lok::Office
* llo
= NULL
;
17 const char* lo_bin_dir
= std::getenv("OO_SDK_URE_BIN_DIR");
18 llo
= lok::lok_cpp_init(lo_bin_dir
);
21 std::cerr
<< "Error: could not initialise LibreOfficeKit\n";
25 lok::Document
* lodoc
= llo
->documentLoad(input
, NULL
/* options */);
28 std::cerr
<< "Error: could not load document: " << llo
->getError() << "\n";
32 if (!lodoc
->saveAs(output
, "pdf", NULL
/* options */))
34 std::cerr
<< "Error: could not export document: " << llo
->getError() << "\n";
38 catch (const std::exception
& e
)
40 std::cerr
<< "Error: LibreOfficeKit exception: " << e
.what() << "\n";
44 std::cerr
<< "Success!\n";