1

can I design (for ex: 300x400 px) card in html and convert it to same size pdf using wkhtmltopdf?

I have html like:

<html><head></head><body><div style="width:364px; height:562px">
<img src="http://172.26.1.236/UserImage/jpeg.jpg" alt="my image" width="364px" height="562px"></div></body></html>

my code is:

var pi = new ProcessStartInfo(@"C:\Program Files\wkhtmltopdf\wkhtmltopdf.exe");
pi.CreateNoWindow = true;
pi.UseShellExecute = false;
pi.WorkingDirectory = @"c:\wkhtmltopdf\";
pi.Arguments = "--page-width 364pt --page-height 562pt --dpi 300 C:\\Users\\Admin\\Desktop\\Test.html C:\\Users\\Admin\\Desktop\\Test.pdf";

I want image should cover full page. how to achieve this?

Santhosh Nayak
  • 2,312
  • 3
  • 35
  • 65
  • 1
    PDF is not a pixel based medium; a pt is not the same as a pixel. I'd say you'll need to test it until you get it right. Note that this will be especially difficult if you don't want the white margins. – Joel Peltonen Sep 22 '14 at 09:36
  • This could help in your calculations: http://stackoverflow.com/questions/8730901/convert-pixels-to-points-for-pdf – Joel Peltonen Sep 22 '14 at 09:37

0 Answers0