We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Convert PDF to DOCX in Node.js results missing formatting, words and pictures

Hi, I’m generating a pdf buffer in nodejs, i am trying to convert the pdf buffer into a docx that a user can download. i am running into a few issues, firstly, the file that I get to download has no extension, secondly, after open with word, the word file I get is missing some images and words with ffi or fi have been replaced with spaces. when i do the conversion on the aspose website, the file comes out perfectly but messed up using my own code

My code is as followsa

const { WordsApi, ConvertDocumentRequest } = require("asposewordscloud");
var fs = require('fs');

 // Get Customer ID and Customer Key from https://dashboard.aspose.cloud/
wordsApi = new WordsApi("xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxx");

router.get(
	'/pdf2',
	catchAsync(async (req, res) => {

const pdf = generated using pupeteer from html

 var request = new ConvertDocumentRequest({
                format: "docx",
                document: pdf,
            });

 wordsApi.convertDocument(request).then((result) => {    
 console.log(result.response.statusCode);    
 console.log(result.body.byteLength);    
res.send(result.body);  
 }).catch(function(err) {
 // Deal with an error
 console.log(err);
 });

	})
);

@emil_chigu

We are sorry for the inconvenience. We will appreciate it if you please share your input and output documents with us. It will help us to investigate and address the issue exactly.