We have a problem with previewing the uploaded PDF in the integration process of our development.
below code snipt is used to make the stream of the uploaded file.
const makeDownloadStream = (url: any, z: ZObject) =>
new Promise((resolve, reject) => {
https
.request(url, (res: any) => {
res.pause();
resolve(res);
})
.on('error', reject)
.end();
});
when this upload_as parameter is set to the PDF, then the uploaded PDF can be previewed as empty white color PDF(without any character).
const formData = new FormData();
const stream = makeDownloadStream(`${bundle.inputData.file}`, z);
formData.append('upload_as', `${bundle.inputData.upload_as}`);
formData.append('file', `${stream}`, { filename: bundle.inputData.name });
Follow image is the input form of the PDF.
IS there any suggestion to preview the PDF in correctly ?