Pechkin
Pechkin copied to clipboard
.setPrintBackground(true) is not working.
I downloaded the src file compiled and set print background to true as given in help file..
byte[ ] buf = sc.Convert( new ObjectConfig( ).SetPrintBackground( true ), htmlText.Text );
Could you please help me? I'm able to generate PDF but without background color..
I have the same problem.
I tried and it doesn't work:
<style type="text/css">
body {
font-face: "Calibry", "Tahoma", sans-serif;
background: url("http://yhub.ru/u/p/gman.jpg");
}
p { text-indent: 3em; }
.last-cell {
text-align: center;
font-style: italic;
}
code {
color: #484848;
border: 1px solid #dadada;
background-color: rgb(250, 250, 250);
padding: 5px;
margin: 15px; display: block;
}
</style>
</head>
<body>
<h1>Hello world!</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pulvinar pellentesque tincidunt. Duis eu massa augue. Pellentesque bibendum lacinia ipsum eget semper. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec in diam mi, vitae tincidunt leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque feugiat nibh vel dui ultrices a sagittis eros auctor. Curabitur at scelerisque tortor. Maecenas vel egestas lorem. Vivamus auctor hendrerit pharetra. Proin laoreet ornare ultricies. Nunc lectus ante, accumsan sed dictum id, vulputate at dui. Pellentesque nisl odio, tincidunt et consectetur ac, tristique ornare purus. Sed bibendum dolor vel eros auctor eleifend. Ut tortor metus, cursus sit amet tempor non, consectetur in nisl.
</p>
<table>
<tr><th>Property</th><th>Value</th></tr>
<tr><td>Text</td><td>Html to pdf test app</td></tr>
<tr><td>Object type</td><td>Form</td></tr>
<tr><td>Purpose</td><td><code>libraray test</code></td></tr>
<tr><td colspan="2" class="last-cell">Nothing more.</td></tr>
</table>
</body>
This has been solved before by setting properties the "traditional" way so this:
byte[ ] buf = sc.Convert( new ObjectConfig( ).SetPrintBackground( true ), htmlText.Text );
becomes: ObjectConfig oc = new ObjectConfig( ); oc.SetPrintBackground( true ); byte[ ] buf = sc.Convert(oc , htmlText.Text );
Try it and see if this fix works for you!
@bUKaneer: that change shouldn't have any effect since it is the same C# logic that will run.
Setting an absolute path for the stylesheet fixes the problem:
<link href="http://localhost/HtmlTemplates/CSS/main.css" rel="stylesheet" type="text/css" />
Is there a way to specify a base path for the CSS files with the Pechkin code. I can do it in the HTML but didn't know if it was possible to specify a basepath for the files as an option so I wouldn't have to do it in the HTML.
I don't think so. I have had to put the base in the html.
- Derek Gray
On May 16, 2014, at 4:13 PM, "Matthew Abbott" [email protected] wrote:
Is there a way to specify a base path for the CSS files with the Pechkin code. I can do it in the HTML but didn't know if it was possible to specify a basepath for the files as an option so I wouldn't have to do it in the HTML.
— Reply to this email directly or view it on GitHub.
In my ASP.NET webforms project i have css file paths like /Content/mycss.css but still doesn't pick it up even with a base in the html. Am I missing something?