PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

MigraDoc
https://forum.pdfsharp.net/viewtopic.php?f=2&t=514
Page 1 of 1

Author:  johnstratoudakis [ Wed Oct 22, 2008 1:59 pm ]
Post subject:  MigraDoc

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

Author:  Thomas Hoevel [ Wed Oct 22, 2008 2:53 pm ]
Post subject: 

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

Author:  johnstratoudakis [ Wed Oct 22, 2008 4:29 pm ]
Post subject:  MigraDoc

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?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/