PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 30, 2024 2:33 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
 Post subject: MigraDoc
PostPosted: Wed Oct 22, 2008 1:59 pm 
Offline

Joined: Wed Oct 22, 2008 1:39 pm
Posts: 3
Location: NYC
Does this forum also include support for MigraDoc?

I have searched the internet for some time and have been unable to find such a website.

Otherwise, let me say what I am trying to do, I am using MigraDoc to replace all my messy PDFSharp code and want to modify the behavior of the MigraDoc Image class to be able to support the creation of an Image object from a GDI+ Image. Currently it only supports the creation of an Image object by reading a GDI+ image from file, which is rather messy for my situation (I love storing all my images as resources)

The thing is that I am doing this where I work, and I want to make sure that any changes I make will be fine even let's say I leave or this project gets moved to another location. So I was hoping to make this change and to contribute it to the MigraDoc team so that they can include it in their future releases.

Does anybody know who I can contact in the MigraDoc team?

Thanks!

John


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Oct 22, 2008 2:53 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
Hi, John,

this is the right place.

How will you do this?

I see the following potential problems:
  • MigraDoc documents can persist in text files (MGDDL) - this only works if images exist in files, too (this is also used for the Preview dialogue)
  • MigraDoc can emit HTML documents - this only works if images exist in files
  • MigraDoc can emit RTF documents - IIRC images use references to files in the file system
  • PDF shouldn't be a problem as images are stored inside the PDF


Therefore images that only exist in memory will only work with PDF (not with Preview, not with RTF).
Temporary files should solve the Preview issue (or an exception should be thrown).
RTF and HTML will need permanent files (how about using hash codes as filenames to avoid duplicate files?) - otherwise an exception should be thrown.

Contributions will be included in future releases if approved by our chief developer ...

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: MigraDoc
PostPosted: Wed Oct 22, 2008 4:29 pm 
Offline

Joined: Wed Oct 22, 2008 1:39 pm
Posts: 3
Location: NYC
I see, this makes sense, because I am using MigraDoc to create PDF documents only, I did not think of the ramifications of using it with RTF and other formats.

Perhaps I can solve my problem for now by using Temporary files and offer my help in making it work the other way for all document formats.

In a nutshell, I modifed the MigraDoc.DocumentObjectModel.Shapes.Image class to have an overloaded constructor that accepts a Stream which is then saved as a new field named "ImageStream". Then, afterwards the MigraDoc.Rendering.ImageRenderer tries to load the file by looking at the imageFilePath property, which I intercepted in the Format(), Render() and CalculateImageDimensions() to use the Stream only if the imageFilePath property is null.

So I am guessing that I have to properly save the Image Stream in the Serialize object to get this to work?


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 52 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