PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 12:43 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 Nov 03, 2010 10:10 am 
Offline

Joined: Mon Nov 01, 2010 2:23 pm
Posts: 17
Location: Prague, Czech Republic
I was trying to add some images to a MigraDoc document and then export it to PDF and RTF. While the PDF export works correctly, there was an exception thrown while exporting to RTF. It turned out that it is due to a *.bmp file being added to the document. I investigated the code and came across this method in file MigraDoc\code\MigraDoc.RtfRendering\MigraDoc.RtfRendering\ImageRenderer.cs:

Code:
    private void RenderSourceType()
    {
      string extension = Path.GetExtension(this.filePath);
      if (extension == null)
      {
        this.imageFile = null;
        Trace.WriteLine("No Image type given.", "warning");
        return;
      }
     
      switch (extension.ToLower())
      {
        case ".jpeg":
        case ".jpg":
          this.rtfWriter.WriteControl("jpegblip");
          break;

        case ".png":
          this.rtfWriter.WriteControl("pngblip");
          break;

        case ".gif":
          this.rtfWriter.WriteControl("pngblip");
          break;

        case ".pdf":
          // Show a PDF logo in RTF document
          this.imageFile = Assembly.GetExecutingAssembly().GetManifestResourceStream("MigraDoc.RtfRendering.Resources.PDF.png");
          this.rtfWriter.WriteControl("pngblip");
          break;

       default:
          Trace.WriteLine(Messages.ImageTypeNotSupported(this.image.Name), "warning");
          this.imageFile = null;
          break;
      }
    }


Does it mean that files with a *.bmp extension can't be rendered in RTF?


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 03, 2010 1:30 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
crypto_rsa wrote:
Does it mean that files with a *.bmp extension can't be rendered in RTF?

Good point.

A quick research on the Internet revealed that "pngblip" can also handle GIF, TIF and BMP (I didn't test that though).

So below
Code:
case ".png":
you should add
Code:
case ".bmp":
case ".tif":
case ".tiff":


Thanks for your feedback, I'll fix it with the next release.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 03, 2010 1:43 pm 
Offline

Joined: Mon Nov 01, 2010 2:23 pm
Posts: 17
Location: Prague, Czech Republic
Thomas Hoevel wrote:
Thanks for your feedback, I'll fix it with the next release.

Thanks for your reply. My next question is, inevitably, when we can expect the next release? :)


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