Changing pdf conversion font

Hi,

im using libreoffice-convert npm package in order to convert docx file to pdf file.
is there any option to change the converted pdf font that libre convert?

here is the sample code im using:

const libre = require('libreoffice-convert');
 
const path = require('path');
const fs = require('fs');
 
const extend = '.pdf'
const enterPath = path.join(__dirname, '/resources/example.docx');
const outputPath = path.join(__dirname, `/resources/example${extend}`);
 
// Read file
const file = fs.readFileSync(enterPath);
// Convert it to pdf format with undefined filter (see Libreoffice doc about filter)
libre.convert(file, extend, undefined, (err, done) => {
    if (err) {
      console.log(`Error converting file: ${err}`);
    }
    
    // Here in done you have pdf file which you can save or transfer in another stream
    fs.writeFileSync(outputPath, done);
});

Thanks.

That “libreoffice-convert” is an unrelated project - you possibly could link a reference to it, no?

See this similar question wrt modifying documents in --convert-to (which that project obviously uses). You would need to ask developers of that project to modify their project and include the editing functionality you need (which would require using UNO or Online functionality).

ok, thank you very much! But the docx that I’m trying to convert, has a different font than the pdf result file.
In the docx file, we are using Open Sans font and the pdf looks different font.
There is an option in the cli command, to convert the docx to pdf with Open Sans font?
Thanks again!

No such option, as described. If there’s a different font in the result, then LO can’t use required font on the system. You need to investigate why (e.g., some permission issue), and provide the necessary font to LO.

Thank you very much!