How to insert HTML code before elements with a given class before converting
For Zapier, Integromat and others plugins insert custom profiles
into profiles
field. For API calls please set value as string in profiles
parameter as string.
The profile below inserts HTML code before each h2
element. The inserted code will also force new page for printing for at the place of every h2
header. For example, if you take any Wikipedia page url, this profile will turn every h2
header into new page break.
For direct API calls set profiles
param as string to the following:
{
"CustomScript": "document.querySelectorAll('h2').forEach( elem => { elem.insertAdjacentHTML('beforebegin', '<div style=\"clear: both; page-break-after: always;\">INSERTED BEFORE H2 ELEMENT</div>') } )"
}
For Zapier, Integromat and others set profiles
field to the following:
{
"CustomScript": " document.querySelectorAll('h2').forEach( elem => { elem.insertAdjacentHTML('beforebegin', '<div style=\"clear: both; page-break-after: always;\">INSERTED BEFORE H2 ELEMENT</div>') } )"
}
Copyright © 2016 - 2024 PDF.co