PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Nov 10, 2024 7:41 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Feb 24, 2016 2:02 pm 
Offline

Joined: Wed Feb 24, 2016 1:10 pm
Posts: 2
Hello,

I've been asked recently to add a very specific chart to one of the reports of the software I'm working on.
I could not manage to render this chart using the 'Chart' class from Migradoc, and I could not use the "mix MigraDoc and PdfSharp" technic neither as the chart integrates in an existing complex report (all done using MigraDoc).

So I considered writing my owns DocumentObject/Renderer classes but I quickly discovered that the library does not allow this kind of extensions as many classes/methods/properties are marked as internal. The only workaround is to make a fork of the whole code with all the constraints that it brings.

I've added a static method to the 'Renderer' class that allow to register a new type of renderer for a particular DocumentObject, and removed the internal modifier from some classes.

Could that kind of changes be accepted if I make a pull request on GitHub?

Best regards,

O. Leneveu


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 24, 2016 2:15 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
Hi!

We have to see the changes to decide whether we will include them.

A ZIP with the changed files might be easier for us than a pull request.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 24, 2016 3:09 pm 
Offline

Joined: Wed Feb 24, 2016 1:10 pm
Posts: 2
Thomas,

Thanks for your answer.
The changed files are attached, based on v1.50 beta3b.

The most important change is in the 'Renderer' class: I've added a callback as a property. This callback is called from the 'Create()' methods to resolve the 'Renderer' type for a custom DocumentObject class.
I did not declared the callback as an 'event' because the delegate has a return value, and as an event can be attached more than once this could lead to unpredictable results.

All other changes consists of changing the 'internal' modifier to 'public' where I needed it.
As I told you, I'm writing a custom chart so I have inherited my custom DocumentObject and Renderer classes from 'Shape' and 'ShapeRenderer', but depending on the base class that someone would like to inherits from some other classes might have to be modified the same way.

Olivier Leneveu


Attachments:
MigraDoc.zip [51.66 KiB]
Downloaded 2277 times
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 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:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group