The current methods to either save a document as a PDF in the same library, or download a document as PDF are usually many clicks away. Why not have the actions in the library, without purchasing an expensive 3rd party solution?

What it does

The solution uses the OneDrive conversion API's to convert a file to a PDF. Then either saves it as a new file, or downloads it.

How I built it

It's built using list command extensions in SharePoint Framework. Originally I wanted to convert the file using MS Graph API's, but files are not accessible using the GraphHttpClient out of the box due to limited access scopes. Instead I built a Flow using the OneDrive connectors to achieve the same. The same Flow is used for both conversion and saving, and for conversion and download.

Challenges I ran into

GraphHttpClient file access issue so I had to do the Flow work around.

Accomplishments that I'm proud of

That you with very little code can solve something valuable.

What I learned

Some of the Flow for converting file - inspired by John Liu's posts. And that I can add extension icon as data uri's.

What's next for Save and Convert as PDF

Waiting for the GraphHttpClient to support file access - and cleaning up the code and writing docs to add as a PnP PR.

Built With

  • flow
  • sharepoint-framework
Share this project: