PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Dec 06, 2021 2:23 pm

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu May 09, 2013 10:48 pm 

Joined: Wed May 08, 2013 10:56 am
Posts: 17
Hey guys,

I'm working on a Markdown and HTML to PDF converter that builds on top of the MigraDoc Document Object Model.

One issue that I've come up across is that there does not need to be a common interface between related Document Elements - the only thing we have is DocumentObject which is too low level for building the PDF.

An example would be Hyperlinks and Paragraphs. Both objects can contain other elements (they both have a ParagraphElements property). However, since they don't share a common interface I have to check explicitly for the element type when doing a conversion. Likewise both Paragraphs and Sections can contain Images but neither share a common interface.

It would be much better if interfaces were used to drive the design of the API. Currently there are lots of duplicate functions on related elements. If these shared common interfaces, the Add* methods could simply be extension methods.

If you are open to this I'd be happy to send a spike of what I am proposing. Also, could you explain what is the functional difference between DocumentObjectCollection, DocumentElements and ParagraphElements - it seems to be me that the only difference is the Add* methods they expose; yet they don't actually restrict what can be added to the underlying collection - for example, I can add a Paragraph to another Paragraph but it will blow up when I try and render the document.

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group