Conversion Api html to docx

Hi. I am new with onlyOffice Api. I previously used Aspose HTML to DOCX conversion, where images that appeared normal within the HTML are showing up in a smaller size in OnlyOffice.

Here’s the conversion query I’m using:

public boolean convertHtmlToDocx() {
try {

        String onlyOfficeUrl = "http://localhost:8500/converter";

        Map<String, Object> requestBody = new HashMap<>();
        requestBody.put("async", false);
        requestBody.put("filetype", "html");
        requestBody.put("key", UUID.randomUUID().toString());
        requestBody.put("outputtype", "docx");
        requestBody.put("codePage", "65001");
        requestBody.put("title", "document.docx");
        requestBody.put("url", htmlFileUrl);

        String token = generateToken(requestBody);

        HttpHeaders headers = new HttpHeaders();
        headers.set("Authorization", "Bearer " + token);
        headers.setContentType(MediaType.APPLICATION_JSON);

        HttpEntity<String> request = new HttpEntity<>(new JSONObject(requestBody).toString(), headers);

        RestTemplate restTemplate = new RestTemplate();
        String response = restTemplate.postForObject(onlyOfficeUrl, request, String.class);
        JSONObject jsonResponse = new JSONObject(response);
        String url2 = jsonResponse.getString("fileUrl");

        ResponseEntity<byte[]> fileResponse = restTemplate.getForEntity(url2, byte[].class);
        byte[] docxContent = fileResponse.getBody();

        String outputPath = "C:/Users/user/Desktop/outlook-images/test.docx";
        Files.write(Paths.get(outputPath), docxContent);

        System.out.println("Fayl yaradıldı: " + outputPath);


        return true;
    } catch (Exception e) {
        System.out.println("Error: " + e.getMessage());
        return false;
    }
}

Hello @ayla,
Could you please provide the HTML file that you use for document conversion so that I can perform a check?

Hello, here is the link

Hello @ayla,
There is error while try to download the file.

sorry for that.

can you try again please.

Hello @ayla,
Apologize for longness, but the link to your HTML file has expired.