I’m looking to generate a PDF document from HTML using the Winnovative PDF Converter
I wish to convert the PDF to exactly 842 x 595 pixels
I’ve tried doing:
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A5
But this doesn’t fit right. So I tried:
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.Custom
pdfConverter.PdfDocumentOptions.CustomPdfPageSize = New SizeF(842, 595)
However this doesn’t work right either as I think the size is measured in a different format to pixels?
How can I generate a PDF at exactly 842 x 595 pixels so that it matches my HTML content?
If you set the PdfConverter.PageWidth and PdfConverter.PageHeight attributes to 842 and 595 then that should cause your web content to fill the whole PDF page area.
There is also a FitWidth property which can be set to False if you want your web content to not be scaled down to fit the available page area. This will mean that your content will overflow the page if it is too large though.
Another point to raise about Winnovative PDF is that it is not easy to work with high resolution images, so depending on your PDF needs (and input) you may struggle to get good quality images – maybe that was just from my experience though.
Speaking of images, it seems that Winnovative PDF takes your input html and creates a single image of it all which then gets added to the PDF at screen resolution (72 dpi) and this can even make simple text look low quality.
If you fancied having a go at handle the html layout yourself you could always convert your content straight to PDF using another product such as ITextSharp which would allow more flexibility over higher resolution images. I really depends on your overall needs though