5

I’ve developed a love/hate relationship with wkhtmltopdf.

I’ve also apparently lost the ability to sleep properly.

These may be related things.

Comments
  • 2
    I read that thing three times until I understood what it said wkHtmlToPdf
  • 4
    @Codex404 Try having to say it aloud to people. Regularly. XD
  • 0
    It's decent but has limitations. I've found it to be the best (cheapest) way to get a dynamic document into PDF when using .Net.
  • 0
    @LMagnus It seems pretty great, I’ve just been tasked with providing some things that I’m having difficulty getting it to do. Like hilariously it’s been frustratingly difficult to get it to render a paginated table of contents that doesn’t include the table of contents in the pagination while having the TOC at the front.
  • 0
    @AmyShackles do it like shitty word users do. (me as 8 year old using word for the first time)
    Add a blank page where the TOC should be. Generate PDF, Generate toc seperately. Then replace the blank page for the TOC
  • 0
    @Codex404 But then how would the TOC know where all the sections in the document are? (This is one of those “I have no idea how many documents they’re going to select to print” kind of deals, and they want to be able to sort the data by different things so that it renders differently based on options selected). Don’t get me wrong, you could be totally right and I’ve just mind numbingly been oblivious to an obvious solution.
  • 0
    @AmyShackles in my case, I had a template created in Word which needed to be dynamic depending on the situation. It had tables in like yours.

    My solution was to pull the XML out of the Word document and turn it into an XSLT file. Then the data that needed to appear in it was saved as XML and run through the XSLT. The converted XML was then injected back into the Word document. The document was then saved as HTML and then converted to PDF
  • 0
    @LMagnus But Word docs have a sense of what a page is and html in the browser doesn’t? (Sorry, newb here)
  • 0
    @AmyShackles yes you're right that's the challenge. I didn't manage to solve that effectively. The docs imply it is possible but couldn't get it to work.
  • 0
    @LMagnus Ah, yeah, that’s my struggle. There’s no Word involved, so it’s literally just the html I’m dealing with. :(
  • 0
    Forget about this kind of libs. I’ve spent one year trying to make these kind of transform work. It never does. At best you’ll get “OK” result
    The best one I used is EvoPDF. And even this expensive lib is shitty.
    Just write your PDF generation “for real”.
Add Comment