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. Image for the cookie policy date

Insert image from clipboard.

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.


1 Reply

BP Bhuvaneswari P Syncfusion Team February 2, 2009 07:23 AM UTC

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


Loader.
Live Chat Icon For mobile
Up arrow icon