cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rajesh
Level: Powered On

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
Community Support Team
Community Support Team

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

21 REPLIES 21
Community Support Team
Community Support Team

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

NeilLombard
Level: Power Up

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?

Rajesh
Level: Powered On

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

nadirshakeel
Level: Powered On

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, 

SuzanneHunt76
Level: Powered On

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?

SuzanneHunt76
Level: Powered On

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

DCNehs
Level: Powered On

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.

JulianaAoyagui
Level: Powered On

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


 

DCNehs
Level: Powered On

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
SuzanneHunt76
Level: Powered On

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

DCNehs
Level: Powered On

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.

sajarac
Level 8

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

DCNehs
Level: Powered On

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? 

sajarac
Level 8

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

 

 

DCNehs
Level: Powered On

Re: Generate PDF from SharePoint list item

Thanks so much everyone is so helpful here.

Vignesh_2112
Level: Powered On

Re: Generate PDF from SharePoint list item

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

sajarac
Level 8

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  

DCNehs
Level: Powered On

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!

sajarac
Level 8

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,640)