Welcome Guest Search | Active Topics | Sign In | Register

Want to remove background image from PDF Options
Muthanna Kuppanda
Posted: Friday, September 2, 2016 6:52:56 AM
Rank: Newbie
Groups: Member

Joined: 8/9/2016
Posts: 0
Hi,

We have html page with body tag having the background image.
Code: CSS
body {
	background-image: url(../images/background.jpg);
	background-repeat: repeat-y;
	background-position: center center;
    /*background-size:<span class='val'> cover</span>;*/
	height: 98%;
    width:100%;
	padding: 0px !important;
	margin: 0px !important;	
}


We don't want this image as background to the PDF.

Please let us know how can we do this?

How can we change the css of the Html after rendering?
Code: C#
pdfPrint.RenderAsPDF("demo.pdf");



Thanks in advance,
Anjan Kumar
eo_support
Posted: Friday, September 2, 2016 7:56:21 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You have to remove the background image from your CSS. There are couple of ways to do that:

1. Modify your original HTML file directly;

2. Load your original HTML as is into the converter, but then modify it with JavaScript to remove the background image before you start the conversion;

3. Provide an additional set of CSS using print media, and then use print media for the conversion;

For option 2, you will need to use HtmlToPdfSession.RunWebViewCallback method:

http://www.essentialobjects.com/doc/eo.pdf.htmltopdfsession.runwebviewcallback.aspx

Inside the callback you will need to use WebView.LoadUrlAndWait to load your HTML file, then use WebView.EvalScript to run JavaScript code to do whatever modification you want to do.

For option 3, you will need to set this property to true:

http://www.essentialobjects.com/doc/eo.pdf.htmltopdfoptions.useprintmedia.aspx

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.