I'm using https://docx.js.org/api/ to create some docx file and download but I don't find how to convert this to PDF
This is how is working right now.
public download(data: any): void {
const documentCreator = new DocumentCreator();
const doc = documentCreator.create(data);
Packer.toBlob(doc).then((blob) => {
console.log(blob);
saveAs(
blob,
`Contrato ${data.place} ${_moment(data.dateEvent).format('LL')}.docx`
);
console.log('Document created successfully');
this.closeModalExport();
});
}
export class DocumentCreator {
// tslint:disable-next-line: typedef
public create(diary): Document {
//Some paragraph and texts
return document;
}
}
But how can I do to convert the blob to pdf?
I tried to convert directly and changed the type of the blob but didn't work
let pdf = new Blob([blob], {type: 'application/pdf'});
saveAs(
pdf,
`Contrato ${data.place} ${_moment(data.dateEvent).format('LL')}.pdf`
);