I am using Microsoft Playwright in order to create a PDF from a remote website inside an Azure Function (HTTP trigger). The method used is page.GetPdfAsync() that only handles a file path in order to create the generated PDF file. I would like to store the file in an Azure Blob storage container but as the GetPdfAsync() method doesn't handle stream or Azure blob storage, I am trying to temporary store the generated file. I tried to use different local folders such as /tmp or /local but each time I trigger the function I see an exception in the trace saying that the filesystem is read-only.
I read this blog post from Anthony Chu so it seems that Playwright is now supported on a Linux consumption plan but in the article the generated screenshot is directly sent back in the HTTP response and never not stored on the local disk.
For the coding environment, I am using C#, VS 2019 and Azure Function Core Tools + Azure CLI for the deployment.
Any idea how I can handle this scenario?
Page.GetPdfAsync()
returns abyte[]
. You can pass null to the path and upload the resultingbyte[]
to Azure.