How are you.
I am gonna save edited docx file to pdf.
how to do this?
const doc = docViewer.getDocument();
const xfdfString = await annotManager.exportAnnotations();
const data = await doc.getFileData({
// saves the document with annotations in it
xfdfString
});
const arr = new Uint8Array(data);
const type = ‘application/pdf’
const blob = new Blob([arr], { type });
const file = new File([blob], new Date().getTime().toString() + “.pdf”, { type, lastModified: new Date().getTime() });
const urls = await uploadFiles([file], “documents”);
this is my current code.
but when I use this for pdf file, all’re working fine.
but for docx file, after save it and opens again, shows error.
“not found pdf header”
so I think I should convert edited buffer and save to pdf.
how could I handle this?
thanks
Lyu