From 9a5735cfbc61b7b424fd69593febda27b850f8ff Mon Sep 17 00:00:00 2001 From: Gaurav Sharma Date: Wed, 27 Dec 2023 11:45:21 +0530 Subject: [PATCH] pageConfig passed --- src/core.js | 3 ++- src/index.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index a01e3d4..0ab3f2d 100644 --- a/src/core.js +++ b/src/core.js @@ -17,7 +17,7 @@ async function getBrowser() { const requiredAttributes = ['htmlContent', 's3Path', 's3FilePublic', 's3Region', 's3Bucket', 's3KeyId', 's3SecretKey'] // return the uploaded URL -async function createPdfAndUploadToS3({ htmlContent, s3Path, s3FilePublic, s3Region, s3Bucket, s3KeyId, s3SecretKey }) { +async function createPdfAndUploadToS3({ htmlContent, s3Path, s3FilePublic, s3Region, s3Bucket, s3KeyId, s3SecretKey }, pageConfig = {}) { const browser = await getBrowser() const page = await browser.newPage() const content = htmlContent @@ -35,6 +35,7 @@ async function createPdfAndUploadToS3({ htmlContent, s3Path, s3FilePublic, s3Reg bottom: 30, left: 0, }, + ...pageConfig, }) await browser.close() diff --git a/src/index.js b/src/index.js index 0263e19..e33d460 100644 --- a/src/index.js +++ b/src/index.js @@ -11,7 +11,7 @@ async function main(event) { return generateResponse(400, { message: `Missing attribute, It should contain the following attributes. ${requiredAttributes}` }) } - const url = await createPdfAndUploadToS3(reqBody) + const url = await createPdfAndUploadToS3(reqBody, reqBody.pageConfig) const res = await generateResponse(200, { url }) return res }