Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom PDF Exporter (Read 3490 times)
luisfernando
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Jul 26th, 2010
Custom PDF Exporter
Jul 26th, 2010 at 8:09pm
Print Post  
Hi, Do you have samples export diagram as pdf using PdfGraphics ?

I am having problems exporting Node's image to pdf , the result is a low resolution images? how can i get a better image exported?

I am override Draw Method

     public override void Draw(MindFusion.Drawing.IGraphics graphics, MindFusion.Diagramming.RenderOptions options)
       {

           graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
           graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
           graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
           graphics.DrawImage(Resources.image1,new RectangleF(Bounds.Location.X, Bounds.Location.Y,Bounds.Width,Bounds.Height));

}

But the images in the pdf result is lower quality than the original.

Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom PDF Exporter
Reply #1 - Jul 27th, 2010 at 5:33am
Print Post  
Hi,

PdfExporter encodes the images in jpeg format, and you can't change that at this time. In the short term we could add an image quality property to let you control the jpeg compression / quality ratio.

Stoyan
  
Back to top
 
IP Logged
 
luisfernando
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Jul 26th, 2010
Re: Custom PDF Exporter
Reply #2 - Jul 27th, 2010 at 2:59pm
Print Post  
Ok, thanks for you answer, the solution you are proposing is ok, but, when you can provide us this new property?

Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom PDF Exporter
Reply #3 - Jul 27th, 2010 at 3:26pm
Print Post  
In a few days.
  
Back to top
 
IP Logged
 
luisfernando
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Jul 26th, 2010
Re: Custom PDF Exporter
Reply #4 - Jul 27th, 2010 at 3:43pm
Print Post  
ok, thanks
  
Back to top
 
IP Logged
 
luisfernando
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Jul 26th, 2010
Re: Custom PDF Exporter
Reply #5 - Aug 5th, 2010 at 10:41pm
Print Post  
Hi,

We are right now try to resolve this problem creating a new pdf exporter using pdfsharp, could you please give me clues in order to do it

thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom PDF Exporter
Reply #6 - Aug 6th, 2010 at 7:37am
Print Post  
Hi,

If you need to create your own exporter and preserve all graphics details, you will have to implement the IGraphics interface defined in mindfusion.common.dll so that methods like DrawString and DrawPath create corresponding objects in the format you are exporting to. When you have that, you can call diagram.Draw(IGraphics) to export the diagram.

We have already checked the image export code, but actually images are stored as uncompressed bitmaps by default so they should not lose any quality. The diagram items in PDF might be slightly bigger or smaller than in the original diagram depending on the MeasureUnit and screen resolution you have, this leading to stretching the bitmaps which could make them blurry. Is that the problem you are seeing? If you send us a sample diagram, our developer will investigate this further.

Stoyan
  
Back to top
 
IP Logged
 
luisfernando
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Jul 26th, 2010
Re: Custom PDF Exporter
Reply #7 - Aug 6th, 2010 at 6:13pm
Print Post  

Thanks for your answer.

Please give me your email i will send you the app and sample.

I noticed that changing the imagealign in node has no effect when the pdf file containing images are generated

On the other side, i have overriden the draw method i have noticed improvements in the image result in pdf files. However imageAlign has no effect. Do you have the code to change the image drawing according with the ImageAlign property?


       public override void Draw(MindFusion.Drawing.IGraphics graphics, MindFusion.Diagramming.RenderOptions options)
       {
    
           if (this.Image == null) return;
           graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
           graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
           graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
           graphics.DrawImage(this.Image, new RectangleF(Bounds.Location.X, Bounds.Location.Y, Bounds.Width, Bounds.Height));

           if (!Transparent)
           {
               Rectangle rect = new Rectangle((int)bounds.X, (int)Bounds.Y, (int)this.Bounds.Width, (int)this.Bounds.Height);
               System.Drawing.Pen pen = (System.Drawing.Pen)Pens.Black.Clone();
               pen.Width = 0.5f;
               graphics.DrawRectangle(pen, rect);
           }

       }


Thanks


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom PDF Exporter
Reply #8 - Aug 6th, 2010 at 7:14pm
Print Post  
You can send it to support@mindfusion.eu.

When implementing your own Draw method, you can call Utilities.DrawImage(graphics, image, rect, ImageAlign) to draw an aligned image.
  
Back to top
 
IP Logged
 
luisfernando
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Jul 26th, 2010
Re: Custom PDF Exporter
Reply #9 - Aug 10th, 2010 at 3:05pm
Print Post  
thanks, for your help
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint