This might help: http://www.princexml.com
I've not used it, but the creators of the CSS spec used it to print their book, which they discuss here: http://www.alistapart.com/articles/boom - TH On Dec 22, 2012, at 1:06 PM, James Laver wrote: > Hi all, > > I'm new to the list but I've been using markdown for a while and I wonder if > it might make the things I've been doing recently easier if I could find a > tool that does what I need. > > Essentially, I've been writing a lot of technical proposals of late (mostly > using google docs), but I'd like to switch to writing them in Markdown (which > handily means I can track revisions and collaborate with git). However, the > finished output needs to be in both pdf and html and I'd like to apply > templates to both. Additionally I have a requirement for a cover page for the > PDF Copy. I'd also like to be able to paginate the HTML at the same > boundaries as the PDF copy is paginated. > > Now I've seen a number of markdown libraries that can generate TeX and HTML > but I don't seem to be able to apply a TeX template to them (and indeed my > knowledge of TeX stops at writing a CV for which I haven't written a document > template). > > So, my requirements are: > - Generate a PDF copy > - With company cover page > - With company header, footer and ideally something in a margin like a logo > - Generate a HTML copy > - With company branding applied via CSS > - Ideally paginated at the breaks of where the PDF would be paginated. > > Now, for the cover page, I explored three possibilities: > - Document-level metadata (as supported by python-markdown with a plugin). > Specify some fields in there that I could manually output in the right format. > - Inline metadata (as supported by ruby's maruku). Not sure how i'd make it > spit this out differently though > - Specially formatting some fields (e.g. building a level 1 header with > DOCTITLE: in it or something, parsing it out before it hits the markdown > library and prepending it to the document) > > Yes, I'm aware HTML isn't designed to be paginated as such and I'm willing to > lose that (though it would be nice just as a cross-platform fallback for > where PDFs are not supported). I've also spent several hours searching for > tools or libraries that do all of this out of the box and found nothing > (which leads me to believe it doesn't exist). > > My current approach is likely to be taking Pegdown (a java markdown library) > and writing new renderers (it exposes the AST directly), but that's obviously > a substantial amount of work. I'd be grateful for any pointers people have as > alternatives, or perhaps someone knows of a tool? > > Oh and I know this is the markdown list, but if the above already exists for > another markup language, I'd consider switching, provided it was of a similar > theme to markdown. > > Cheers, > James _______________________________________________ Markdown-Discuss mailing list [email protected] http://six.pairlist.net/mailman/listinfo/markdown-discuss
