We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Insert image from clipboard.

Thread ID:

Created:

Updated:

Platform:

Replies:

79323 Feb 1,2009 04:55 PM Feb 2,2009 02:23 AM Windows Forms 1
loading
Tags: PDF
Marty Graham
Asked On February 1, 2009 04:55 PM

How do I insert an image(emf) from the clipboard into the pdf document. Using Syncfusion.PDF.Windows.Net.4.402.0.51, Visual Studio 2005, VB.Net. I can do this programatically with MS Word easily with outstsnding results. The reason for purchasing your control was to eliminate the use of MS Word. Feel like I have to walk on my lips get these controls to perform what should be simple tasks.


Bhuvaneswari P [Syncfusion]
Replied On February 2, 2009 02:23 AM

Hi Martin,

Thank you for your interest in Syncfusion products.

DocIO doesn't have any API to work with clipboard. But we can work around this by using .Net library by converting the Clipboard object to image object and then insert the image into the word document. Please find the below code snippet to do so:
[C#]

WordDocument doc = new WordDocument();
doc.EnsureMinimal();
//Metafile
if (Clipboard.GetDataObject().GetDataPresent(typeof(Metafile)))
image = (Image)Clipboard.GetDataObject().GetData(typeof(Metafile));
//Bitmap
else if (Clipboard.GetDataObject().GetDataPresent(typeof(Bitmap)))
image = (Image)Clipboard.GetDataObject().GetData(typeof(Bitmap));

doc.LastParagraph.AppendPicture(image);
doc.Save("sample.doc");
Process.Start("Sample.doc");

Please try this and let us know if this helps you.

Best Regards,
Bhuvana


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;