Subject: Does DocumentBuilder C++ API require Document Server? Conversion fails with V8 TypeError
Environment:
- Ubuntu2404 x86_64
- ONLYOFFICE DocumentBuilder 8.2
- GCC 9.4.0
Issue:
When converting DOCX to PDF using the C++ API, we encounter:
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.
#
Full stack trace shows failure in V8 engine during decoding.
Code Implementation:
// main.cpp
#include "common.h"
#include "docbuilder.h"
using namespace NSDoctRenderer;
const wchar_t* workDir = L"/opt/onlyoffice/documentbuilder";
const wchar_t* filePath = L"/opt/onlyoffice/documentbuilder/empty/new.docx";
const wchar_t* resultPath = L"result.pdf";
int main()
{
// initialize DocBuilder
CDocBuilder::Initialize(workDir);
CDocBuilder builder;
builder.OpenFile(filePath, L"");
// save as PDF and close
builder.SaveFile(OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF, resultPath);
builder.CloseFile();
CDocBuilder::Dispose();
return 0;
}
Compilation:
g++ -I/opt/onlyoffice/documentbuilder/include \
-L/opt/onlyoffice/documentbuilder \
-Wl,--unresolved-symbols=ignore-in-shared-libs main.cpp \
-ldoctrenderer
Key Question:
Is the Document Server component required when using DocumentBuilder’s C++ API locally? The documentation is unclear about whether:
- DocumentBuilder is a standalone library
- The V8 errors imply missing backend services (like Document Server)
- This architecture requires both components