My goal is to extract all CSS references from an external stylesheet, such as
<link rel="stylesheet" href="css/General.css">
, and add them to the existing styling of each HTML element on my page (converting all CSS to inline).
The reason for this requirement is because I need to use .html()
to capture a specific div and send it to the server to generate a PDF. However, the tool I am using only recognizes inline CSS.
Is there a way to achieve this?
Edit: The question identified as a "possible duplicate" only mentioned placing everything within the <style>
tag. While that approach could be beneficial, my main focus is on incorporating the styles into the style=""
attribute in the HTML markup.