Boa noite uma duvida como eu faço esse mix, por exemplo tenho dois end point: const file1Response = await api.get(/upload/files/122
, {
headers: {
Authorization: Bearer ${token}
,
},
responseType: "text",
});
const pdfId = localStorage.getItem('mediaPdf_id')
const file2Response = await api.get(/upload/files/127
, {
headers: {
Authorization: Bearer ${token}
,
},
responseType: "text",
});
const pdfData1 = file1Response.data;
const pdfData2 = file2Response.data;
const mergedPdfData = pdfData1 + pdfData2;
const mergedPdfBlob = new Blob([mergedPdfData], { type: "application/pdf" });
const mergedPdfFile = new File([mergedPdfBlob], data1 + "merged.pdf", {
type: "application/pdf",
});
const formData = new FormData();
formData.append("files", mergedPdfFile);
const response = await api.post('/upload', formData, {
headers: {
Authorization: `Bearer ${token}`,
},
});
const mergedPdfFileId = response.data.id;
const mergedPdfUrl = URL.createObjectURL(mergedPdfBlob);
window.open(mergedPdfUrl, "_blank"); estou fazendo assim, pegando dois pdf e qerendo fazer um novo, mas nao estou conseguindo