Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
LMagnus20635yIt'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.
-
@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.
-
@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 -
@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.
-
LMagnus20635y@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 -
@LMagnus But Word docs have a sense of what a page is and html in the browser doesn’t? (Sorry, newb here)
-
LMagnus20635y@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.
-
@LMagnus Ah, yeah, that’s my struggle. There’s no Word involved, so it’s literally just the html I’m dealing with. :(
-
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”.
Related Rants
I’ve developed a love/hate relationship with wkhtmltopdf.
I’ve also apparently lost the ability to sleep properly.
These may be related things.
rant
html
sleep
table-of-contents
pdf