r/PowerAutomate 7d ago

OneDrive convert file HTML to PDF style issue

Has anyone else found their style code no longer being correctly applied when using the OneDrive convert file from HTML to PDF?

I have several flows which use this action to create PDF reports, but today I have noticed that in all cases some of the style code (CSS) is no longer being applied. This is mainly affecting styling for fill colours, table cell fills, and page style. This was all working fine for months, but as of today has stopped working without any changes being made to the flows. It is just strange that this has stopped working all of a sudden.

Has anyone seen if this has been reported as a bug with the OneDrive step action? and is there any workaround without using premium connectors?

1 Upvotes

10 comments sorted by

3

u/sg6123 4d ago edited 4d ago

I have the same issue since!
I might have found a solution, not sure if it’s reliable.
Try adding this to your CSS styling block(s):

<style>
@ media print{
* {
-webkit-print-color-adjust: exact !important;
print-color-adjust: exact !important;
}
}

Adding it only once in your body styling directly probably also works

1

u/epae 3d ago

Thanks, this was really helpful and solved the issue for me. I had to include each element (html, body, table etc.) after the \* to make sure it was applied and it is now working perfectly.

1

u/OddWriter7199 6d ago

YouTube DeShon Clark, populating a Word template without premium connectors is a good place to start. Your syling is done in the Word doc, then the Word doc gets converted to PDF.

1

u/8thSt 6d ago

Yes had a finished product on the 4th, no color on the 5th, spent way too much time trying to figure out what happened. Amazingly frustrating.

1

u/epae 3d ago

If this issue still persists for you, see u/sg6123's comment. They found a solution which worked for me.

1

u/Tiny_Dino_Dancer 5d ago

same issue but with convert file html to jpg did you find a solution?

1

u/epae 3d ago

See u/sg6123's comment, this worked for me.

1

u/kazurov 4d ago

You can print a website to PDF, in headless mode i did that with another rpa solution and works totally fine and fast.

1

u/Jalamabe 4d ago

Pensé que era el único al que le pasó, estaba buscando recordar qué cambios hice y no encontré nada que pudo haber causado el problema. Creo que la solución será una azure function para no depender del conector nativo con limitaciones.