0

I did managed to convert the HTML (with CSS Bootstrap) to PDF. However the converted PDF got zoomed in a lot which i didn't expect. I tried a few options but none worked. The idea is to make the PDF as identical as the html view (image attached below) but in my case the textboxes is misplaced and stacked one after another.

My code: Github Gist

Images:

HTML view: HTML view (PDF should be like this also) Exported PDF: PDF view (It should not be put one below another)

Foyzul Karim
  • 4,252
  • 5
  • 47
  • 70
  • I forgot to remove these two lines of code before uploading to Github Gist. StyleSheet style = new StyleSheet(); style.LoadTagStyle("body","font","8px"); – Foyzul Karim Dec 02 '14 at 15:18
  • When I see the `StyleSheet` class, I assume that you're using `HTMLWorker`. That class has been abandoned in favor of XML Worker. Did you try using XML Worker? – Bruno Lowagie Dec 02 '14 at 15:32
  • I didn't use these two lines of code. I forgot to remove before commit. – Foyzul Karim Dec 02 '14 at 15:43
  • 973 lines of HTML, 20 lines of C# and 6,332 lines of CSS, wow. Anyway, I would start with your media queries. I'm honestly not sure if iText actually supports them. Try removing them all and seeing if the PDF looks any different. If it looks the same, you'll need to tweak your base CSS. If it looks different, test a bunch of different breakpoints to see which one is triggering. – Chris Haas Dec 02 '14 at 16:18
  • @Foysal Did you ever get a workaround to this? – stevenrcfox Dec 01 '15 at 12:24

0 Answers0