Images are blurry when converted from Html to Pdf using SelectPdf library .Net

225 Views Asked by At

I need to convert html to pdf using SelectPdf. I have an html template with text and images, but the problem is that when I convert this html to pdf the images get smaller but everything looks great on the web browser. This is how I embed images in the html. This is in my code

string image = "<img src={{imageUrl}}/>";

What I do here is that, I replace imageUrl with the actual image url that I get from the request. The html looks like this: <div> {{images}} </div>. The images will be shown in this div block.

In order to solve the size issue I tried to add css to: string imageHtml = "<img src={{imageUrl}} style='width: 600px; height: 400px;'/>"; This solved the size issue, but the quality got very bad. I tried using more css properties like image-rendering but this did not work, also tried using some SelectPdf properties like PdfCompression.NoCompression but this didn't work either.

I really need to resolve this quality issue promptly. So any advice/suggestion will be appreciated.

0

There are 0 best solutions below