Matbaa is a mini API that provides an easy-to-use interface over Puppeteer to generate PDFs from HTML.
You need a browser that exposes its remote debugging interface. You can launch a local Chrome instance or run Browserless on Docker:
Launch a browserless/chrome
container with:
docker run -p 12345:3000 browserless/chrome
Then use the following URL:
ws://localhost:12345/webdriver
Open up a shell and run:
chrome.exe --headless --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=.chrome
This will launch a hidden Chrome window.
Then fetch the debugger URL using
(curl --silent http://127.0.0.1: 9222/json/version | ConvertFrom-Json).webSocketDebuggerUrl
Once you have a running browser instance, set Puppeteer:BrowserWsEndpoint
in appsettings.json
.
Or via an environment variable:
export Puppeteer__BrowserWsEndpoint=ws://url.to.browser
dotnet run
Go to /api
to view Swagger documentation.
- Add UI