benfoster / MigraDoc.Extensions

Extensions for MigraDoc/PDFSharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

will this lib work for the wpf version?

williamsonjake opened this issue · comments

hey ya, just found your lib - looks grand but...

i've had to use the wpf version of migradoc (for one reason and another...).

can you think of any reason why your lib wouldn't play nice? i was just about to try it but thought i'd run it by you before i got in to deep ;)

whatcha reckon?

cheers,

jake

hi ben,

took a stab at it myself and yes, it all works with the wpf version (i just updated the migradoc and pdfsharp refs).

the big problem i've got at the moment is i've been using sections with paragraphs to format my text where as the extension uses just the section... the trick being, i need to positioning it using x and y coardinates.

i've posted up a message on the pdfsharp/migradoc forum:

http://forum.pdfsharp.net/viewtopic.php?f=2&t=2676

but if you've any pointers, it'd be greatly appreciated ;)

cheers,

jake

Hi Jake,

The extension uses paragraphs providing there are paragraphs (<p>) in the html. If you want to center your paragraphs how about setting the default paragraph style (DefaultParagraphFont) or overriding the existing paragraph handler with your own logic:

        var htmlConverter = new HtmlConverter();
        htmlConverter.NodeHandlers["p"] = (node, parent) =>
        {
            var paragraph = ((Section)parent).AddParagraph();
            paragraph.SetStyle("MyParagraphs");
            return paragraph;
        };
        section.Add(html, htmlConverter);

Hope this helps.