mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 09:54:51 +10:00
fix: convert DOCX template uploads to PDF (#2807)
This commit is contained in:
@@ -3,6 +3,7 @@ import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';
|
|||||||
import { jobs } from '@documenso/lib/jobs/client';
|
import { jobs } from '@documenso/lib/jobs/client';
|
||||||
import { getDocumentWithDetailsById } from '@documenso/lib/server-only/document/get-document-with-details-by-id';
|
import { getDocumentWithDetailsById } from '@documenso/lib/server-only/document/get-document-with-details-by-id';
|
||||||
import { sendDocument } from '@documenso/lib/server-only/document/send-document';
|
import { sendDocument } from '@documenso/lib/server-only/document/send-document';
|
||||||
|
import { convertToPdf } from '@documenso/lib/server-only/document-conversion';
|
||||||
import { createDocumentData } from '@documenso/lib/server-only/document-data/create-document-data';
|
import { createDocumentData } from '@documenso/lib/server-only/document-data/create-document-data';
|
||||||
import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';
|
import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';
|
||||||
import { duplicateEnvelope } from '@documenso/lib/server-only/envelope/duplicate-envelope';
|
import { duplicateEnvelope } from '@documenso/lib/server-only/envelope/duplicate-envelope';
|
||||||
@@ -269,9 +270,18 @@ export const templateRouter = router({
|
|||||||
attachments,
|
attachments,
|
||||||
} = payload;
|
} = payload;
|
||||||
|
|
||||||
const { id: templateDocumentDataId } = await putNormalizedPdfFileServerSide(file, {
|
const pdf = await convertToPdf(file, ctx.logger);
|
||||||
flattenForm: false,
|
|
||||||
});
|
const { id: templateDocumentDataId } = await putNormalizedPdfFileServerSide(
|
||||||
|
{
|
||||||
|
name: file.name,
|
||||||
|
type: 'application/pdf',
|
||||||
|
arrayBuffer: async () => Promise.resolve(pdf),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
flattenForm: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
ctx.logger.info({
|
ctx.logger.info({
|
||||||
input: {
|
input: {
|
||||||
|
|||||||
Reference in New Issue
Block a user