I have a Laravel app running serverless with
@brefphp and generating PDF via chrome on Lambda.
I added X-Ray to visualize it:
1 - the HTTP route (Laravel controller) invokes the pdf function synchronously and passes it a URL to render
2 - the "pdf-renderer" function starts chromium, opens the URL, exports it to PDF, and uploads it to S3
3 - the HTTP route returns a temporary signed URL to the S3 file
This specific scenario is synchronous (~1s) because the PDF is live generated.
When possible the PDF is generated asynchronously in a Laravel job.
With that approach I write PDF templates with blade, it renders exactly the same locally or in Lambda (easy to test), never have to worry about scaling, and pay per PDF generated (about 0.004 cents/PDF)