ONLYOFFICE / DocumentBuilder

ONLYOFFICE Document Builder is powerful text, spreadsheet, presentation and PDF generating tool
https://www.onlyoffice.com/document-builder.aspx
GNU Affero General Public License v3.0
111 stars 56 forks source link

DocumentBuilder C++ API: Convert DOCX to PDF failed with V8 error #126

Open anatoly-spb opened 7 months ago

anatoly-spb commented 7 months ago

Describe your problem:

I try to convert docx/xlsx file to pdf, but my program finished with:

TypeError: Cannot read property 'length' of undefined
    at Object.a.AscCommon.NU.decode.a.AscCommon.NU.decode (<anonymous>:11662:172)
    at e (<anonymous>:11577:526)
    at n.au (<anonymous>:11597:402)
    at Object.au (<anonymous>:11602:10)
    at e.vGd (<anonymous>:10401:495)
    at e.vGd (<anonymous>:10704:213)
    at <anonymous>:10345:382
    at da (<anonymous>:9653:313)
    at Object.a.AscCommon.aQh (<anonymous>:9835:127)
    at e.yO (<anonymous>:10345:345)

#
# Fatal error in v8::ToLocalChecked
# Empty MaybeLocal.
#

Steps to reproduce the problem:

compile and run C++ program based on your /opt/onlyoffice/documentbuilder/libdoctrenderer.so:

    using namespace NSDoctRenderer;
    CDocBuilder::Initialize(L"/opt/onlyoffice/documentbuilder");
    {
      CDocBuilder oBuilder;
      oBuilder.SetProperty("--work-directory", L"/opt/onlyoffice/documentbuilder");
      oBuilder.CreateFile(L"docx");
      oBuilder.SaveFile(L"pdf", L"my.pdf");
    }

the same error with xlsx:

 using namespace NSDoctRenderer;
 CDocBuilder::Initialize(L"/opt/onlyoffice/documentbuilder");
 {
   CDocBuilder oBuilder;
   oBuilder.SetProperty("--work-directory", L"/opt/onlyoffice/documentbuilder");
   oBuilder.CreateFile(L"xlsx");
   oBuilder.SaveFile(L"pdf", L"my.pdf");
 }

Here is the demo project https://github.com/anatoly-spb/onlyoffice-documentbuilder-cxx-api-demo

DocumentBuilder version:

8.0.0.99

Installation method:

rpm -ivh https://download.onlyoffice.com/install/desktop/docbuilder/linux/onlyoffice-documentbuilder.x86_64.rpm

Operating system:

CentOS 6 g++ (GCC) 11.4.1 20230605