Convert docx to pdf using C++ SDK in windows and Linux

I want to convert the docx to pdf using C++ SDK, I downloaded the document builder from https://github.com/ONLYOFFICE/DocumentBuilder/releases/latest/download/onlyoffice-documentbuilder-windows-x64.zip and tried to use it to convert the docx to pdf. but the open file is failing. The following is the code snippet I have used

#include “common.h”
#include “docbuilder.h”
#include
using namespace NSDoctRenderer;

int main() {
const wchar_t* workDir = L"C:\Program Files\ONLYOFFICE\DocumentBuilder";
const wchar_t* inputPath = L"C:\OnlyOffice\sample.docx";
const wchar_t* outputPath = L"C:\OnlyOffice\sample.pdf";

// Initialize the DocumentBuilder
CDocBuilder::Initialize(workDir);

CDocBuilder builder;

bool opened = builder.OpenFile(inputPath, L"“);
if (!opened)
{
std::wcerr << L"Failed to open file!” << std::endl;
return 1;
}

// Save as PDF
builder.SaveFile(OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF, outputPath);

builder.CloseFile();
CDocBuilder::Dispose();

return 0;
}

Note: OpenFile call is successful if my input is a .txt file but fails for .docx file.
CreateFile call is also working fine for new docx creation.
For feature suggestions, describe the result you would like to achieve in detail.
For bug reports, provide the steps to reproduce and if possible a minimal demo of the problem.
Document Server version\Desktop Editors version:
Additional information:
Any relevant details about the situation. If you’ve modified configuration files or are using a proxy server that might affect the situation, please mention it. You can also attach images and videofile to the post (or to place them to external storage)

I don’t have a license , can it be a problem ?

Hello @Satya_Kompella

Does your DOCX have fields? If not, I recommend saving in OFFICESTUDIO_FILE_CROSSPLATFORM_PDF format instead.

@Constantine The Openfile call itself is failing for me.
and it’s a simple docx file
bool opened = builder.OpenFile(inputPath, L"“);
if (!opened)
{
std::wcerr << L"Failed to open file!” << std::endl;
return 1;
}

Sorry, I missed that part. Please describe how you are compiling the project step by step.
In the meantime, you can try providing path directly to the method as described in the documentation: