How to Convert a URL to PDF in Power Automate

Cloudmersive
3 min readOct 14, 2024

--

Converting URLs directly to PDF allows us to capture and store web page contents in a dynamic, portable format without needing to interact with the underlying HTML files.

To handle this conversion, we’ll need to leverage an API that retrieves a URL’s HTML files and either 1) parses content from HTML elements into equivalent PDF elements or 2) screenshots the rendered content and stores the resulting image in a PDF document.

In Power Automate, we can perform either of these conversions without writing a line of code. In this article, we’ll demonstrate an API solution that parses HTML into an equivalent PDF, returning a dynamic, text-based PDF document with searchable content and interactive links.

We’ll build a manually triggered, instant cloud flow to demonstrate this process with full control over our data.

To find our URL to PDF conversion action, we’ll add a new action and type “Cloudmersive” into the connector search bar. This brings up a list of Cloudmersive connectors for barcode scanning, security, currency exchange, file processing, and several other categories. We’re looking for the Cloudmersive Document Conversion connector with the green logo.

We’ll click “See more” to view the actions list, and we’ll then search for an action called Convert a URL to PDF.

After we select this action, we’ll need to create our connection before we configure our request parameters. Assuming we have a premium/business Power Automate license, we can use this connector for free with a free API key (that allows a limit of 800 API calls per month with zero commitments).

Once we’re ready to configure our URL to PDF conversion request, we’ll click “Show all” to view the request parameters, and we’ll paste a URL string in the Input/Url parameter. In my example, I’m using a link to the Google home page.

We’ll notice we also have the option to specify extra loading wait time for our URL and customize the height and width of our resulting PDF (note — the result of this operation is NOT a screenshot despite the Input/ScreenshotHeight and Input/ScreenshotWidth parameter names).

To create our new PDF document, we’ll add a Create file action and save OutputContent from our URL to PDF request in a folder in our system.

After we save and run our flow, we can open the PDF version of our URL and review its contents.

In my example PDF of the Google home page, I can still click on interactive links like “About” and “Sign in” and navigate to each respective web page from my PDF. In a URL screenshot, this wouldn’t be possible.

That’s all there is to it! Now we can easily build flows that save URL contents as dynamic PDFs in our file system.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Responses (1)