cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Generate PDF from SharePoint list item

Hi

 

Is it possible to generate PDF from a SharePoint list item with all the form data when an item is saved into SharePoint?

 

I've looked into the option RenderListDataAsStream. but I guess this only converts word documents into stream

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-re...

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Generate PDF from SharePoint list item

Hi @Rajesh,

 

Do you want to generate a PDF file from SharePoint list items?

Please consider using the OneDrive for Business action Convert file to convert an HTML file to PDF.

Please take the following flow for a reference.

The flow is triggered by When an item is created in a SharePoint list.

Get items from the list.

Create an HTML table from the list.

Add the action Create file to create an .htm file in OneDrive for Business. Set its File name as ListB.htm.

Add the action Convert file to convert the file to pdf.

Last, create a .pdf file with a new name.

A screenshot for your reference.

1.PNG

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

36 REPLIES 36
Highlighted
Community Support
Community Support

Re: Generate PDF from SharePoint list item

Hi @Rajesh,

 

Do you want to generate a PDF file from SharePoint list items?

Please consider using the OneDrive for Business action Convert file to convert an HTML file to PDF.

Please take the following flow for a reference.

The flow is triggered by When an item is created in a SharePoint list.

Get items from the list.

Create an HTML table from the list.

Add the action Create file to create an .htm file in OneDrive for Business. Set its File name as ListB.htm.

Add the action Convert file to convert the file to pdf.

Last, create a .pdf file with a new name.

A screenshot for your reference.

1.PNG

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
New Member

Re: Generate PDF from SharePoint list item

How do I get the content of the SharePoint list item into PDF instead of the list of items?

Highlighted
Advocate II
Advocate II

Re: Generate PDF from SharePoint list item

You create the html first by adding the required content from list item and then save in one drive and convert to pdf as shown in the flow

Highlighted
Frequent Visitor

Re: Generate PDF from SharePoint list item

I Need help with this. My converted PDF contains only the first header and than data in html, 

Highlighted
Frequent Visitor

Re: Generate PDF from SharePoint list item

I've got this working but struggling to put a logo in to the html file? I've tried storing the logo image in the site assets folder on the sharepoint site and referring to the full path in the <img> tag, I've also tried storing the image file in the same folder in OneDrive that the files are generated in but all I get in the html and pdf file is the unknown picture square?

Help please?

Highlighted
Frequent Visitor

Re: Generate PDF from SharePoint list item

If anyone is interested in this, the answer (thanks to Shane Young) is to put the picture in OD4B, use a get file content action, then store a DataURI(Body('Get_File_Content')) expression into a variable and then put that variable into the html

Youtube video here: https://www.youtube.com/watch?v=2rfAQe1kK8M

Highlighted
Helper IV
Helper IV

Re: Generate PDF from SharePoint list item

I tried using this and creating from a Task List.  Running into an issue where i cant choose the "Issue Status Value" so from the dynamic info.  Any ideas?  We only want a DPF to be created if the issue has been closed.

Highlighted
Regular Visitor

Re: Generate PDF from SharePoint list item

Hi Mabel,

 

Does it work with List items which contains attachements (images, files etc.) too?

 

Juliana


@v-yamao-msft wrote:

Hi @Rajesh,

 

Do you want to generate a PDF file from SharePoint list items?

Please consider using the OneDrive for Business action Convert file to convert an HTML file to PDF.

Please take the following flow for a reference.

The flow is triggered by When an item is created in a SharePoint list.

Get items from the list.

Create an HTML table from the list.

Add the action Create file to create an .htm file in OneDrive for Business. Set its File name as ListB.htm.

Add the action Convert file to convert the file to pdf.

Last, create a .pdf file with a new name.

A screenshot for your reference.

1.PNG

 

Best regards,

Mabel



@v-yamao-msft wrote:

Hi @Rajesh,

 

Do you want to generate a PDF file from SharePoint list items?

Please consider using the OneDrive for Business action Convert file to convert an HTML file to PDF.

Please take the following flow for a reference.

The flow is triggered by When an item is created in a SharePoint list.

Get items from the list.

Create an HTML table from the list.

Add the action Create file to create an .htm file in OneDrive for Business. Set its File name as ListB.htm.

Add the action Convert file to convert the file to pdf.

Last, create a .pdf file with a new name.

A screenshot for your reference.

1.PNG

 

Best regards,

Mabel


 

Highlighted
Helper IV
Helper IV

Re: Generate PDF from SharePoint list item

I've tried following the instructions listed and get the following error for "Create HTML table" but not really sure how to fix. Any ideas?

BadRequest. The 'from' property value in the 'table' action inputs is of type 'Null'. The value must be of type 'Array'.
Highlighted
Frequent Visitor

Re: Generate PDF from SharePoint list item

Hi, what have you put as the input for the create HTML table action? You should use the value from the Get Items action above it

Highlighted
Helper IV
Helper IV

Re: Generate PDF from SharePoint list item

I was able to get it to work now but the output looks really bad.  I'm really just needing to have a single output to look like a nice report once the request has been completed.

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Generate PDF from SharePoint list item

I did this using the MS word connector. In my app I have an icon sor the selected record in my gallery. That gallery is a share Point List. Once the user click in the icon a flow will generate a word document in my onedrive using a word template and populating the data form the sharepoint, then it will convert a PDF and email me that PDF. If you think that this suits your needs chech the MS word connector.

 

Regards

Highlighted
Helper IV
Helper IV

Re: Generate PDF from SharePoint list item

Sounds interesting, I'll have to take a look.  I'm wondering how you set up your work template.  Would you be abe to share your template? I found a few things online but also saw that there can be issues with certain columns being used. 

 

Also, do you need to create and share a specific folder in your OneDrive so that if someone else presses the button it can use the word document in there? 

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Generate PDF from SharePoint list item

This guy teach how to create the MS Word template using the Developer tab, is easy.

 

Once you have created the word template *.docx. Create a folder in your onedrive.

Place the template in that folder.

Create a subfolder for the documents to be generated using that template. 

Create the flow.

Add in your powerapp an icon that triggers the flow.

 

Here is the video for the word connector:

 

https://www.youtube.com/watch?v=Zzm965PlYl0

 

And read this post, I have some screen shots for the process. And I have to say thanks to @Pstork1, I was able to acomplish this.

 

If you get stuck at some point let me know. I will try to do my best.

 

Regards.

 

https://powerusers.microsoft.com/t5/General-Flow-Discussion/MS-Word-Connector/td-p/350262

 

 

Highlighted
Helper IV
Helper IV

Re: Generate PDF from SharePoint list item

Thanks so much everyone is so helpful here.

Highlighted
Helper I
Helper I

Re: Generate PDF from SharePoint list item

Could you please ellaborate your work in converting the user input to word document followed by pdf?

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Generate PDF from SharePoint list item

Which part do you need?

 

I have running mine but, currently I am looking for another alternative, I don't want to use a premium connector for a feature that should be included.

 

Let me know and I will help you out.

 

Thx  

Highlighted
Helper IV
Helper IV

Re: Generate PDF from SharePoint list item

Is there a way to change the name of the file each time you run so it doesn't just override the last one?  If I missed that, I apologize.

thanks!

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Generate PDF from SharePoint list item

Hi, I think that probably the best way is to save the file name including the current date. By doing this you will never get the same file name.

 

Make sense?

 

 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,198)