I had a problem with converting this xml file to pdf. I can’t upload directly xml file so i put xml text into docx.
Документ Microsoft Word.docx (224,2 КБ)
@PostMapping(value = "/convert-without-base64", produces = MediaType.APPLICATION_PDF_VALUE)
public byte[] convert(@RequestBody byte[] xml) throws Exception {
return xmlToPdfService.convertDirectly(xml);
}
public byte[] convertDirectly(byte[] xml) throws Exception {
ByteArrayInputStream xmlInputStream = new ByteArrayInputStream(xml);
ByteArrayOutputStream pdfOutputStream = new ByteArrayOutputStream();
Document document = new Document(xmlInputStream);
document.save(pdfOutputStream, SaveFormat.TEXT);
return pdfOutputStream.toByteArray();
}
So, this is my java code for converting. It worked well before this xml