Ddoc to PDF

Stephan Soller stephan.soller at helionweb.de
Tue Oct 19 07:27:24 PDT 2010


On 19.10.2010 15:14, Gerrit Wichert wrote:
> Am 17.10.2010 19:45, schrieb Walter Bright
>
>> Apparently, it is fairly simple to convert plain text files to PDF.
>>
>> http://re-factor.blogspot.com/2010/10/text-to-pdf.html
>>
>> Which suggests to me it should be equally simple to create a Ddoc
>> macro file to allow Ddoc to emit pdf files directly.
>>
>> Anyone want a nice weekend project to product this?
>>
>
> I don't think that it is the best idea to produce a pdf in one step.
> First PDF is really complicated (and also evolves over time).
> Second this would require dmd to determine the layout of the generated
> documentation.
>
> We could easily avoid the frist point. When we just make ddoc generating
> xsl-fo a tool like apache fop can be used to generate pdf or html from
> it. This is what xsl-fo is designed for. It's not rocket science to
> create a xsl-fo layout. But the second problem remains. If i where a
> company or community writing libraries in d i would like to have some
> corporate identity in it. This means that I want to decide over the
> layout. So i would really prefer if ddoc were *additionaly* able to
> generate a pure semantical version of the document data that is easy to
> mess with an external tool. This can be a simple xml file which i can
> feed into my own transformation pipline. This way ddoc does the part it
> can really shine on, extracting the information, and delegates the rest
> to something that knows more about the wishes of the actual user.
>
> This shuoldn't  mean that ddoc should stop generating unified standart
> documentation. But i think it is worth a thought to generate semantic
> data files on request.
>
> Gerrit

I agree but maybe DDoc as it is now is already enough. I haven't looked 
closely at the HTML DDoc generates but from what I've seen on the D home 
page it looks expressive enough. This HTML code can be converted to PDF 
with [PrinceXML][1] and you have all the flexibility of CSS at your 
disposal (I know not everyone likes CSS…).

Letting the compiler do the layout of the PDF generation might be 
overkill. It's a compiler and not a layout engine.

[1]: http://www.princexml.com/

Happy programming
Stephan


More information about the Digitalmars-d mailing list