This is a migrated thread and some comments may be shown as answers.

Problems pasting snapshots from Snagit or Adobe

2 Answers 41 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 14 Mar 2014, 10:36 AM
Hi!

Snapshots from Snagit, Adobe and other softwares does not work.
Picture does not show up.

As well available as a Jing (.swf) file:

Issue-with-pasting-snapshot-from-acrobat.swf
https://skydrive.live.com/redir?resid=18C7014863ADA2A9!554&authkey=!ANaslUjBUZIPeG8

Is there a fix for this problem?

Thanks/Anders

2 Answers, 1 is accepted

Sort by
0
Missing User
answered on 18 Mar 2014, 01:19 PM
Hi Anders,

Thank you for getting to us with this!

The unexpected behavior which you have experienced is a known issue. The issue is already added to our to-do list. We can assure you that we are doing our best to develop all enhancements to the control as soon as possible. You able to track its implementation progress using the Feedback & Ideas portal – pasting snapshots issues.

The issue is specific to the program which you are copying the image from. Please take a look at this forum post for a reference.

However, we have also found a workaround for the problem and it should display correctly snapshots. For using it, I would recommend you to subscribe to the CommandExecuting event of RadRichTextBox and handling it in the following way:
...
       this.editor.CommandExecuting += PasteImageCommand;
...
        private void PasteImageCommand(object sender, CommandExecutingEventArgs e)
        {
            PasteCommand command = e.Command as PasteCommand;
            if (command != null && Clipboard.ContainsImage())
            {
                BitmapSource imageSource = Clipboard.GetImage();
                using (MemoryStream stream = new MemoryStream())
                {
                    JpegBitmapEncoder encoder = new JpegBitmapEncoder();
                    encoder.Frames.Add(BitmapFrame.Create(imageSource));
                    encoder.Save(stream);
                    stream.Seek(0, SeekOrigin.Begin);
                    ((RadRichTextBox)sender).InsertImage(stream, "jpeg");
                    e.Cancel = true;
                }
            }
        }

I hope this helps. 

All the best,
Yancho
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Anders
Top achievements
Rank 1
answered on 25 Mar 2014, 09:29 AM
Hi Yancho!

Workaround works great!

Thanks!

/Anders
Tags
RichTextBox
Asked by
Anders
Top achievements
Rank 1
Answers by
Missing User
Anders
Top achievements
Rank 1
Share this question
or