Changing the image size solved my problem.
Pregunta
I have a routine that prints a PDF of HTML code. It works very well except the embedded image DPI is too low, so the resolution is very poor. Is there a way I can set the stylesheet to use a higher DPI?
HTMLWorker parser = new HTMLWorker(doc);
string fontpath = Server.MapPath("/Fonts/arialuni.ttf");
FontFactory.Register(fontpath, "Arial Unicode MS");
StyleSheet styles = new StyleSheet();
styles.LoadTagStyle(HtmlTags.TABLE, HtmlTags.SIZE, "6pt");
styles.LoadTagStyle(HtmlTags.H3, HtmlTags.SIZE, "10pt");
styles.LoadTagStyle(HtmlTags.H5, HtmlTags.SIZE, "6pt");
styles.LoadTagStyle(HtmlTags.BODY, HtmlTags.FACE, "Arial Unicode MS");
styles.LoadTagStyle(HtmlTags.BODY, HtmlTags.ENCODING, BaseFont.IDENTITY_H);
parser.SetStyleSheet(styles);
HTML code -
div style="text-align: left; margin-left:40px;">
<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 141px;"><img alt="" src="http://ephoms-prod.azurewebsites.net/images/eph_graphics/eph_logo_small.png"/></td>
<td style="text-align: center;"><h4>Order Summary</h4></td>
</tr>
</tbody>
</table>
</div>
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow