Generate a PDF from Microsoft Flow

Поділитися
Вставка
  • Опубліковано 26 січ 2025

КОМЕНТАРІ • 133

  • @casingena1985
    @casingena1985 6 років тому +2

    What a fantastic solution, thanks Matt. Loved the delivery! This is certainly a Flow that a lot of people will find incredibly useful.

  • @chih-ninghsu9111
    @chih-ninghsu9111 4 роки тому

    Fabulous!! I was able to follow through the video and create a solution immediately for our team in Peru. They will be so pumped when I show them tomorrow! THANK YOU SOOOOO MUCH!!!

    • @AbleBlue
      @AbleBlue  4 роки тому

      This comment made my day! Thank You.

  • @earllinealcide4651
    @earllinealcide4651 5 років тому +1

    this is the most concise, clear explanation I've come across. thank you!

  • @althurmonang4645
    @althurmonang4645 4 роки тому

    Thanks for the tutorial Matt! could not describe more clearly how this helps me

  • @njfrlng
    @njfrlng 6 років тому +1

    Can this work but with an entire list from Sharepoint?
    When I get to the replace function in the Compose, I cannot select any dynamic content from the Get Items - plural (versus the Get Item - singular)
    I want to use your technique to generate an individual report for every item in my sharepoint list that I can ultimately merge into one PDF.

    • @AbleBlue
      @AbleBlue  6 років тому

      Sure, use the GetItems/GetItem to loop through the items in the list. You could also send a Collection from a PowerApp and do essentially the same thing. I do this on a few reports.

  • @artoonugroho
    @artoonugroho 4 роки тому +1

    Great video. Interesting! I have an issue in microsoft flow. I have no idea how to merge 2 different SharePoint lists in one flow and generate it into one pdf file then send an email that contain the pdf file. Do you have any clue. Thankyou

    • @AbleBlue
      @AbleBlue  4 роки тому

      I would use separate actions and perform the merge in a compose. It would be fun, but you should be able to do it.

  • @yehunlavolontededieu322
    @yehunlavolontededieu322 4 роки тому

    Thank you very much Matt. Incredibly useful.. ..Can I convert multiple items at once ? And merge the induvial multiple pdfs into one pdf? to send by email as a weekly report. They're looking for all the different items to be on the same pdf. For eg: 9 items at once / for weekly task report . But all i need is max 3 fields title+Date+ Description. Bear with me pls , can i also trigger the conversion when a status filed changes to " complete" in the SP list? Thanks a lot in advance.

    • @AbleBlue
      @AbleBlue  3 роки тому

      No reason why not. You would have to build up the document and create the PDF yourself.

  • @amyclapp8457
    @amyclapp8457 3 роки тому

    What do you do when your HTML file is larger than 2MB? Convert file fails in that case. Do you have a workaround?

    • @AbleBlue
      @AbleBlue  3 роки тому

      I haven't run into that Amy. That's a very large HTML file. Have you tried "chunking" it? Break it into Head, Body, and Contents?

  • @robertmerritt4806
    @robertmerritt4806 5 років тому

    Awesome video. May I ask how do I get my power apps and flows to run under the context of the current user, instead of the user who created them?

    • @AbleBlue
      @AbleBlue  5 років тому

      Robert, I haven't tried that. I think it depends on the type of connection you choose for the flow.

  • @hmvelloso
    @hmvelloso 6 років тому +1

    Hey, man! Awesome video. Using what you showed, I'm gonna be able to change like a dozen documents in my company! Thank you very much!!

    • @AbleBlue
      @AbleBlue  6 років тому +1

      Outstanding. I am so happy that it helped!

  • @jrhcr
    @jrhcr 4 роки тому

    the html templates are necessary? I need to export a PDF with all the information of the selected item of the list, what I have to do. Thanks

    • @AbleBlue
      @AbleBlue  4 роки тому

      I use the template to control the formatting. You can create the content any way you like.

  • @andyxberner
    @andyxberner 4 роки тому

    Does the Compose action work with lookup columns? My flow worked for a text field, but there was a problem with a lookup.. unless there's something else going on?

    • @AbleBlue
      @AbleBlue  4 роки тому +1

      The contents of Lookup Fields is an ID and the column value concatenated together with a hashtag and other crap. I would pull the field in as text and take a look. You can't just use "Choice 2" because that isn't the text in the field, that is the rendered text in SharePoint. You'll have to play with it.

  • @dyldatsroj
    @dyldatsroj 4 роки тому

    Thanks for good introduction.
    I have a challenge to need some assistance: One of the columns in the table from which I retrieve information is optional, which means that some fields are sometimes empty. This causes flow to fail when it finds an empty field. My wish is that there should be no text in the final report when the table fields are blank, is it possible?

    • @AbleBlue
      @AbleBlue  4 роки тому

      You can add a null test in the Flow. If you use the "?" character in the field value getter it will not throw an error. Then you can test for blank values. @empty(triggerBody()?['field'])

    • @dyldatsroj
      @dyldatsroj 4 роки тому

      @@AbleBlue Thanks, how you combine @replace and @empty in one compose field?

    • @AbleBlue
      @AbleBlue  4 роки тому

      Generally I try and not combine too many functions. I prefer to use multiple actions instead.

  • @dbjaquet
    @dbjaquet 4 роки тому

    Great video, Thanks! I have a specific need to create the temp HTML file in SharePoint instead of OneDrive but during the conversion to PDF I get an BadRequest 400 error with the message “the response is not in a JSON format” .. do you have an idea on how to get around that?

    • @AbleBlue
      @AbleBlue  4 роки тому

      I am afraid I don't. I found the Flow Connectors limited in one way or the other and finally settled on this approach to make it all work. It looks like there is an issue with the response from the action, so I would start there and see if you can create a simple HTML document in a test Flow that can same the document to SharePoint. Troubleshoot one thing at a time.

  • @bhrigunath3588
    @bhrigunath3588 5 років тому

    Thank you for the Solution... Can you help with how can we export attached images in list item in same PDF...

    • @AbleBlue
      @AbleBlue  5 років тому +1

      I generally avoid list item attachments. I wold start by looking to see if there are any Flow actions that support getting the attachments. Once you have them you'll need to see if they can be added to the PDF.

  • @gaozizheng3413
    @gaozizheng3413 4 роки тому

    I encounter an issue here that really need your advise. I have created the flow, but it seems like the HTML will only replace the very last content, while the rest remains unchanged, what would that be?

    • @AbleBlue
      @AbleBlue  4 роки тому

      More than likely you have a mistake in your Compose action. Check the variable and the substitutions.

  • @lilfrog5
    @lilfrog5 4 роки тому

    What happens if the HTML file links to a picture that exists on the same folder, for example a picture is called something.png and we added it to the html template as will it be shown on the generated pdf?

    • @AbleBlue
      @AbleBlue  4 роки тому

      I tried several things. The only thing that worked for me was to embed the image in the HTML itself. If you find an easier way let me know.

    • @christopherlawes9286
      @christopherlawes9286 3 роки тому

      I believe you can convert the image url via datauri(url) and point to this in the src

    • @lilfrog5
      @lilfrog5 3 роки тому

      @@christopherlawes9286 yes that worked for me when i tried it last year, seems like the only way

  • @jnx111
    @jnx111 4 роки тому

    Hi, do you have a tutorial on how to add the html template in sharepoint?

    • @AbleBlue
      @AbleBlue  3 роки тому

      @jnx111 If you mean you want to store the template in SharePoint, you can do this by just adding it to and then reading it from a library.

  • @shubhamkhare6324
    @shubhamkhare6324 4 роки тому

    What if I wanted to add a buttpn on top of list to run the flow using powerapp

    • @AbleBlue
      @AbleBlue  4 роки тому

      You should be able to do that. You can add a button to a list or library to run a Flow on an item. Adding it to the "top of the list" should fall under the Automate button for an Item Flow.

    • @shubhamkhare6324
      @shubhamkhare6324 4 роки тому

      @@AbleBlue how to add a button like from where i will get ID

    • @AbleBlue
      @AbleBlue  4 роки тому

      I don't know, I haven't tried to do that. I usually stick with the default UI. That way there is less to teach.

  • @marlonchristie
    @marlonchristie 5 років тому

    great video, however when I try the first replace file content expression I get "replace(outputs('Get_file_content__-Asset_Sheet')?['body'])" instead of "replace(body('Get_file_content-__Asset_Sheet')", what am I doing wrong

    • @punatero
      @punatero 5 років тому

      I also get this expression. I am wondering if you can show us the full expression in the window at time 7:05?

    • @AbleBlue
      @AbleBlue  5 років тому

      The full expression is : replace(body('Get_file_content__-HTML_Template'),'{title}',body('Get_item-__Issue_Item')?['{Name}'])

  • @jhctao
    @jhctao 5 років тому

    Seems the function replace() only can replace strings. Failed if the value in the SharePoint List is a number or date.
    Unable to process template language expressions in action 'Compose_-_xxx' inputs at line '1' and column '20792': 'The template language function 'replace' expects its third parameter 'new string' to be a string. The provided value is of type 'Float'.
    Any ideas if the values are numbers or dates? I can't change the source in SP List to different datatype.

    • @jhctao
      @jhctao 5 років тому

      I just use string() to set the number and date fields to string and it works.

    • @AbleBlue
      @AbleBlue  5 років тому

      Have you tried using a Compose action and casting the value as a string? I think you can even use Concat for that. It's lame, but this this isn't a real programming language. You could also try adding a calculated field to the list and reference that in your Flow.

    • @kmuralikrishna1582
      @kmuralikrishna1582 5 років тому

      ​@@jhctao replace(outputs('Compose-_Set_Title'),'{number}',outputs('Get_item-Custom_list_item')?['body/number'])
      here i would like to read number(int) values from html file , can any one help me where to put string() ....?
      already tried with below examples..
      replace(outputs('Compose-_Set_Title'),string('{number}'),outputs('Get_item-Custom_list_item')?['body/number'])
      replace(outputs('Compose-_Set_Title'),'{String(number)}',outputs('Get_item-Custom_list_item')?['body/number'])

    • @marvismeng1953
      @marvismeng1953 4 роки тому

      jhctao hi,I had same problem,can you share the input which you successfully applied?I have tried string(),it didn’t work

    • @marvismeng1953
      @marvismeng1953 4 роки тому

      jhctao thanks for your sharing!!!

  • @123rohitpande
    @123rohitpande 5 років тому +1

    how we can loop and generate pdf for 10 items in one go

    • @AbleBlue
      @AbleBlue  5 років тому

      There is no reason you cannot change the looping logic so that rather than enumerating the items and generate one PDF you can create a PDF per item. Just add the PDF step during the enumeration loop.

  • @cummins75901
    @cummins75901 4 роки тому

    Great tutorial. I have a question, I have a dynamic string that could contain a single apostrophe within it like this: replace(outputs('Compose_-_body'),'This ' Quote' , 'This ' ' Quote'). I'm needing to replace that single quote in the middle with two single quotes since I'm passing this compose output to a powershell script. Any ideas?

    • @AbleBlue
      @AbleBlue  4 роки тому

      I would look at creating a compose that does the substitution. You may need to escape the quote character.

  • @davidh8228
    @davidh8228 5 років тому

    is it possible to allow the HTML file carry CSS formatting when converting?
    so you can place text onto of an image or in the middle of a table?

    • @AbleBlue
      @AbleBlue  5 років тому

      As we are using the free PDF action it is really limited. For example it took a lot of trial and error to get the images to work. You will have to test the CSS rendering for your specific case.

    • @davidh8228
      @davidh8228 5 років тому

      @@AbleBlue ok i will give it a try.

  • @lasherza
    @lasherza 5 років тому

    Hi @AbleBlue , Thank you so much for this!!. I am having issues i hope you will read this.. After adding the Compose Data Operation .. The second one added and all after that always only show the contents of the { } .. ie ..it is not pulling in from PowerApps into the HTML page...? Can you pls Help??????!!!!!!!!!

    • @AbleBlue
      @AbleBlue  5 років тому

      Make sure you are using the right expression in your Compose action.

    • @mgtd1138
      @mgtd1138 5 років тому

      Same thing on my end...not pulling in to the HTML, tried a few different samples

  • @kmuralikrishna1582
    @kmuralikrishna1582 5 років тому

    What/where/how if i want to send email that PDF document after "create file-Client file" action ...? file will be exist from which section, i found it no luck to send email.

    • @AbleBlue
      @AbleBlue  5 років тому

      I would try an email link to item or other OneDrive share action. (I haven't tried it, so you'll need to look for yourself.) I haven't needed to send an attachment as I usually only send links and leave the document in place.

    • @kmuralikrishna1582
      @kmuralikrishna1582 5 років тому

      @@AbleBlue fine its working can able to send PDF to email.

  • @satishphadke1
    @satishphadke1 4 роки тому

    this saved lot of time.. i think this is the only free solution .. all other PDF convertor are paid one

    • @AbleBlue
      @AbleBlue  4 роки тому

      Great, Glad it helped.

  • @srilaxmigrao2734
    @srilaxmigrao2734 4 роки тому

    Can we merge attachment as well?

    • @AbleBlue
      @AbleBlue  4 роки тому

      I haven't tried, any actions that allow text manipulation could work.

  • @kellycristinazacarias1779
    @kellycristinazacarias1779 4 роки тому

    Thanks for the great video! I'm facing a problem: my HTML is fine but when i'm convert to PDF the configuration of images is lost. I'm converted with an online tool and the PDF generate with that tool is OK, with my set configuration. So it's not a problem with my write HTML...do you know what could be?
    Really appreciate your help

    • @AbleBlue
      @AbleBlue  4 роки тому +1

      Images are a challenge with the OneDrive Conversion action. I had to add them as inline encoded images to get them to work. I am sure the premium converters are probably better, but I wanted this to be "free".

    • @kellycristinazacarias1779
      @kellycristinazacarias1779 4 роки тому +1

      @@AbleBlue Thanks for reporting this. Well, I'm build a dynamic report generator (catch data from a powerapps aplication in real time) and convert this data (with images included) to a PDF document. The problem that a I mentioned before was that One Drive Conversion did not mantain the break page and some other things of HTML code (native problem, we don't have what to do about that). So I use the Encodian connector with a Free Account (there are some limitations about size doc and use/month but for me it's not a big problem).
      Again, thanks for your answer! Sucess in 2021 :)

    • @AbleBlue
      @AbleBlue  4 роки тому +1

      @@kellycristinazacarias1779 So glad you found a solution.

  • @garylynch2734
    @garylynch2734 5 років тому

    Hi i have followed your excellent tutorial.......but when i run my flow which says no errors! only the first token is replaced and none of the others are :(...

    • @AbleBlue
      @AbleBlue  5 років тому

      Pay close attention to the replacement logic. You have to pass the results from the previous replacement. This is usually the problem.

    • @garylynch2734
      @garylynch2734 5 років тому

      @@AbleBlue Ahh i found my error!! wasn't passing the previous compose outputs.. You might want to highlight this in the excellent video as it is very easy to miss.. Thank you for a great video :)

  • @chandrarao3407
    @chandrarao3407 5 років тому

    Thanks for the Video. I tried to implement this.I could get the HTML file with content,but it is generating a blank PDF. Could you please help me out on this?

    • @AbleBlue
      @AbleBlue  5 років тому

      Anytime you are troubleshooting a Flow you need to go step by step. Is your file a Text file? If so is the Path correct? In the step where you get the file, are you actually getting the contents of the file. Each of these parts needs to work before any additional steps will work. Use the Test feature and ensure that the results of each step are correct before proceeding to the next step. When you do discover the issue please post the resolution here so others can learn. Thanks for watching!

    • @chandrarao3407
      @chandrarao3407 5 років тому

      @@AbleBlue Thanks for the reply. The template file which I'm using is a HTML file. The output of creating a HTML file is perfect with all the fetched values from SharePoint list. The next step is convert HTML file to PDF which is generating a PDF without content. The flow is showing successful but I'm getting a blank PDF. I have used the test feature to trace the result of each step.But I couldn't get why the PDF file is not fetching the HTML content.

    • @AbleBlue
      @AbleBlue  5 років тому

      @@chandrarao3407 There is either an issue in the temp file you created or in the ID of the file you are passing to the Convert step. I would test it by using a static text file that you know exists before adding the dynamically generated text file.

    • @devxon
      @devxon 3 роки тому

      I had the same issue and what happened is that I was pulling the "Compose - File Name" instead of the "Compose - Service Details", which is the action that has the content. It could be tricky if you have lots of compose actions, but just make sure you are pulling from the last Compose anytime you run into a Blank/Empty PDF or HTML. Thanks @ableblue

  • @putriayunurbayti1393
    @putriayunurbayti1393 4 роки тому

    Hi.. nice video ! I have an issue with convert pdf. I could show all off item in sharePoint list (31 items) in html. But after convert to Pdf only shows 17 items. How could that be? Please give some clue

    • @AbleBlue
      @AbleBlue  4 роки тому +1

      Thanks, so you say that all the items are in the HTML but aren't showing in the PDF? I would troubleshoot the conversion.

    • @putriayunurbayti1393
      @putriayunurbayti1393 4 роки тому +1

      @@AbleBlue correct. But I have found the mistake. So, my pdf run correctly. Good. Thankyou for sharing.

    • @AbleBlue
      @AbleBlue  4 роки тому +1

      @@putriayunurbayti1393 Excellent!

  • @lesliearnett1642
    @lesliearnett1642 6 років тому

    I tried to set this up but I am getting an error on my compose items. It is saying "The template language function 'replace' expects its third parameter 'new string' to be a string. The provided value is of type 'Object'." Here is my expression: replace(body('Get_file_content__-HTML_Template'),'{Athlete_Name}',body('Get_item-__StudentRecordDetail')?['Athlete_Name']) - I have tried it with and without the question (?) mark before ['Athlete_Name'] - still no joy. Any thoughts?

    • @AbleBlue
      @AbleBlue  6 років тому

      No idea, I hate that editor. I would troubleshoot your string first. Hard code a value and get that working. Then troubleshoot the Athlete Name expression.

    • @lesliearnett1642
      @lesliearnett1642 6 років тому

      @@AbleBlue After researching the heck out of this, I have come to the conclusion that Microsoft has broken the PDF conversion options in FLOW. From my understanding, they are currently working on a fix.

    • @freddygarciasalvo1719
      @freddygarciasalvo1719 6 років тому

      Hola, tambien tengo el mismo problema y no puedo solucionarlo. espero su pronta respuesta. gracias, con valor duro si funciona, pero con los campos, lo asigna como valor Null y sale error en la ejecución.

    • @AbleBlue
      @AbleBlue  5 років тому

      I get the error when using non string data types. All you have to do is cast the value as a string. I just tested it by adding a number field called "Occurrences" to my demo. Then I used the following to add the value to my template after the Assigned To step: replace(outputs('Compose__-Assigned_To'),'{occurrences}',string(body('Get_item-__Issue_Item')?['Occurrences']))

  • @lukedarr731
    @lukedarr731 5 років тому

    any chance you could walk thru how you made that html doc?

    • @AbleBlue
      @AbleBlue  5 років тому

      You mean the template? I just used Notepad++ and hand rolled it. If you need a primer on HTML I recommend www.w3schools.com/

  • @shubhamkhare6324
    @shubhamkhare6324 4 роки тому

    In my compose Statement I am getting error as invalid statement

    • @AbleBlue
      @AbleBlue  4 роки тому

      It's probably a typo. Check your quotes and syntax. Build it up a little at a time.

  • @hughmurfitt
    @hughmurfitt 5 років тому

    Elegant solution, clearly and succinctly explained

  • @kmuralikrishna1582
    @kmuralikrishna1582 5 років тому +1

    every thing you are reading string datatype values , you should of try with at least different type of values.... number, date etc..., cant not read number field values

    • @AbleBlue
      @AbleBlue  5 років тому

      Thanks for your comment! I'll give it a shot with numbers and dates, but have you tried casting the values as strings? What have you tried?

    • @kmuralikrishna1582
      @kmuralikrishna1582 5 років тому

      @@AbleBlue First of all thank you very much for reply, Yes i have tried with string and number and multiple line of text, unfortunately can`t working for number data types, only string i can read from HTML, and convert it to PDF.
      from HTML: Title and Number
      First one is title : No error here
      replace(outputs('Get_file_content')?['body'],'{Title}',outputs('Get_item-Custom_list_item')?['body/{Name}'])
      Second is number: error here:
      replace(outputs('Compose-_Set_Title'),'{number}',outputs('Get_item-Custom_list_item')?['body/number'])
      Can you help me how to use string function here.... also i have tried here ,string('{number}') kindly help me

    • @AbleBlue
      @AbleBlue  5 років тому

      @@kmuralikrishna1582 All you have to do is cast the value as a string. I just tested it by adding a number field called "Occurrences" to my demo. Then I used the following to add the value to my template after the Assigned To step: replace(outputs('Compose__-Assigned_To'),'{occurrences}',string(body('Get_item-__Issue_Item')?['Occurrences']))

  • @nerycaballeros3326
    @nerycaballeros3326 4 роки тому

    does converting works on html with scripts and css?

    • @AbleBlue
      @AbleBlue  4 роки тому

      No reason why not. You are just building a text file. How it renders will depend on your browser. Converting to PDF will depend on how the conversion is done. In O365 it was challenging to get it the PDF to look good, but straight HTML should be fine.

  • @stefanvonhusen5126
    @stefanvonhusen5126 5 років тому

    very cool - but i need the way directly to sahrepoint, not over onedrive - but at this time, there is no connector

    • @AbleBlue
      @AbleBlue  5 років тому

      Right, that's a bummer. But hopefully that connector is coming. (And hopefully it's not Premium. :) )

  • @StephanOnisick
    @StephanOnisick 4 роки тому

    Nice demo Matt. Thanks.

  • @JenkinsUSA
    @JenkinsUSA 5 років тому

    Wow - thank you so much for this tutorial. Elegant!

    • @AbleBlue
      @AbleBlue  5 років тому

      You are too kind. Thanks!

  • @hermanlamprecht5755
    @hermanlamprecht5755 6 років тому

    Incredibly useful. Thank you!

  • @yvonnew2010
    @yvonnew2010 6 років тому +1

    Great video. Thank you. Clearly explained :)

  • @celesteaguirre
    @celesteaguirre 4 роки тому

    Thank you!! Great and easy solution!

    • @AbleBlue
      @AbleBlue  4 роки тому

      Excellent! Hope it works for you!

  • @shubhamkhare6324
    @shubhamkhare6324 4 роки тому

    It will be better if we can creat a notification that documents have been saved in library

    • @AbleBlue
      @AbleBlue  4 роки тому

      You have several options for that. You can send an email or use a Teams message. I would use Teams for that since the adaptive card give you better options for message handling.

  • @joaopimentel3822
    @joaopimentel3822 4 роки тому

    This is pretty cool, thanks for sharing, but this works if its a simple HTML file, if you try to use Style Sheets it doesn´t work :(

    • @AbleBlue
      @AbleBlue  4 роки тому +1

      Right, that a limitation of the PDF generator. You can look at premium options or try Word automation.

  • @dinushahirushan7300
    @dinushahirushan7300 3 роки тому

    great tutorial Thank you

    • @AbleBlue
      @AbleBlue  3 роки тому

      Glad it was helpful!

  • @oskarz6478
    @oskarz6478 4 роки тому

    You are AWESOME! Thank you!

    • @AbleBlue
      @AbleBlue  4 роки тому

      Awww thanks! Hope it helped.

  • @ilikeacoustic28
    @ilikeacoustic28 5 років тому

    Thank you for this video!

    • @AbleBlue
      @AbleBlue  5 років тому

      My pleasure, hope it helps.

  • @Chuckgtz
    @Chuckgtz 5 років тому

    Great video. Thanks :)

  • @AdrielMirager
    @AdrielMirager 4 роки тому

    Excelente!

    • @AbleBlue
      @AbleBlue  4 роки тому

      Muchísimas Gracias!

  • @marcianocalvi
    @marcianocalvi 4 роки тому

    Thanks a lot!

  • @raslaankhan5146
    @raslaankhan5146 4 роки тому

    Awesome

    • @AbleBlue
      @AbleBlue  4 роки тому

      Glad you liked it!