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

Convert HTML to PDF - trouble creating footer by any method

Hi there,

 

I have a PowerApp that's taking Sharepoint data from List(s) and creating HTML document (invoice etc) which I'm then passing to a Flow where I save the HTML in OneDrive file and then user Convert HTML to PDF to create and save a PDF file in Sharepoint doc library and all works well .. However ..

 

.. I need to add a footer statement (registered address etc.) in the PDF but know there's no direct way to do that (yes?) so been tryiing various ways in the HTML to achive the same which work fine in the HTML view but when converted to PDF don't .. either by .. using <FOOTER> tag but that doesn't work .. or .. using a <DIV> with style of position:absolute; bottom:0px; but that doesn't work (actually shows at top!) .. or .. setting <BODY> to height:100%;min-height:100% then creating three <DIV> with height 20%/70%/10% effectviely for header/body/footer but that doesn't work as appears correctly (ie. % wise) but with page height looks like about half the size rather than PDF' page height .. few other ways too so ..

 

.. The question is, does anyone know to code the HTML/CSS in such a way as to have a footer at the bottom of the page that appears in the subsequent convert PDF file at the bottom of it's page?

 

Thanks for any help,

 

Derek

1 ACCEPTED SOLUTION

Accepted Solutions
DerekPapworth
Level: Powered On

Re: Convert HTML to PDF - trouble creating footer by any method

Thanks both @jhall and @Jay-Encodian for thoughts and options

 

I was needing a quick'est solution so in the end I've just played with relative positioning trial and error for this particular document format so that's sorted for that but still would like a generic "trailer" type option.

 

Coding an convertor myself is one option @jhall but time is the contsraint on that one amd Encodian could well do the job but it's a cost option (although looks reasonable) and this is for charity so trying to use standards in Flow etc., as they get whole Office 365 for free.

 

Thanks though!

View solution in original post

6 REPLIES 6
jhall
Level 8

Re: Convert HTML to PDF - trouble creating footer by any method

I don't have an answer, but the issue made me curious.  I did a quick gut-check on wkhtmltopdf (which might be the underlying open source code being used to generate the PDF) and it does not properly handle the HTML5 "footer" value.  So, if I were hazarding a guess that could be related.  Knowing what's doing the conversion under the hood could be key to figuring out if it really can be done at all.

 

If this were my problem to solve, I would consider writing my own app/service to do this.  I did something similar for merging SharePoint data with PowerPoint data fields (search/replace) so that slide decks were auto-generated when new items were added to meeting agendas.  If you include the Flow SFTP service connector (if your org allows it) to push/pull files to pretty much any system, this opens you up to having the documents batch processed by anything and doesn't restrict you to the existing tools within Flow.

Super User
Super User

Re: Convert HTML to PDF - trouble creating footer by any method

Hi @DerekPapworth,

 

The Encodian connector provides the 'Add HTML Header or Footer' action which you can use to overlay an existing PDF document. - https://support.encodian.com/hc/en-gb/articles/360013808614-Add-HTML-Header-or-Footer 

 

This should cover your requirements? 

 

If you could share the source HTML, I'll try to see why the OneDrive coversion doesn;t convert the HTML correctly.

 

HTH

Jay

DerekPapworth
Level: Powered On

Re: Convert HTML to PDF - trouble creating footer by any method

Thanks both @jhall and @Jay-Encodian for thoughts and options

 

I was needing a quick'est solution so in the end I've just played with relative positioning trial and error for this particular document format so that's sorted for that but still would like a generic "trailer" type option.

 

Coding an convertor myself is one option @jhall but time is the contsraint on that one amd Encodian could well do the job but it's a cost option (although looks reasonable) and this is for charity so trying to use standards in Flow etc., as they get whole Office 365 for free.

 

Thanks though!

View solution in original post

jhall
Level 8

Re: Convert HTML to PDF - trouble creating footer by any method

Glad you were able to hack something together.  I'm very happy w/ most of the standard methods on Flow, but my own experience was similar w/ the PPT/SharePoint merge.  However, it did allow me to do some standard methods for "punting" so I could use any number of tools to solve a particular issue.

Super User
Super User

Re: Convert HTML to PDF - trouble creating footer by any method

Hey @DerekPapworth

 

Good stuff, glad you solved it.

 

There is a free SKU, and if it's for charity then we'd have loved to have helped FOC.

 

Cheers Jay

Super User
Super User

Re: Convert HTML to PDF - trouble creating footer by any method

Hi!

 

You can use "Convert HTML to PDF" action from Plumsail Documents connector.

 

It allows you to specify Footer and Header HTML. Please review parameters in the documentation.

 

Note, it is a paid solution.

 

convert-html-to-pdf-example.png

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,604)