Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

PDFGenerationAPI and background image not working out...?

DrewW
Mega Sage

Has anyone tried adding a background image to a custom PDF?  I need to use a specific background image and every thing I have tried has not worked.  The frustrating thing is if I use an img tag the image shows up, so I know that works.

 

This is the HTML from my last attempt.  I have tried using a ".", just a /, and also the full instance name in the URL and none of them have worked.

<html class='pageBackground'>
   <style>
@page {
	size: LETTER Landscape;
	margin-left: 1cm;
	margin-top: 3cm;
	margin-right: 1cm;
	margin-bottom: 3cm;
}

.pageBackground {
	background-image: url(./sys_attachment.do?sys_id=1405fb4f2b647a90516afcb14391bf7a);
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center center;
	background-attachment: fixed;
	height: 100vh;
	margin: 0;
}
</style>
   <body>
      <div>
         <p style="text-align: center;"><strong><span style="font-size: 36pt; font-family: &#39;comic sans ms&#39;, sans-serif;">{Name Here}</span></strong></p>
         <p style="text-align: center;">{Company Here}</p>
         <p style="text-align: left;">{What they did}</p>
      </div>
   </body>
</html>

 

 

Any thought/suggestions would be appreciated.

 

0 REPLIES 0