Insert image from clipboard

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

cew
User
Posts: 213
Joined: Tue Feb 01, 2011 8:14 am

Insert image from clipboard

Post by cew »

Hi there,

how can I insert (paste) an image from clipboard into the current document?

Best regards,
cew
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Insert image from clipboard

Post by Vasyl - PDF-XChange »

Hi, cew.

You may use:

Code: Select all

ctrl.DoVerb(NULL, "ExecuteCommand", dataIn("Paste"), NULL, 0);
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
cew
User
Posts: 213
Joined: Tue Feb 01, 2011 8:14 am

Re: Insert image from clipboard

Post by cew »

I tried the following code:

Code: Select all

object vDataOut = null;
sdiViewer.DoVerb(null, "ExecuteCommand", "Paste", out vDataOut  , 0);
But it just happens nothing.
The keyboard shortcut for "paste" works fine.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Insert image from clipboard

Post by Vasyl - PDF-XChange »

Hi, cew.

We have found one problem with it is - if your program captures the mouse then this method won't work in current release, for example, in C# when you call this code in the your button click handler because C# captures the mouse when you press left mouse button on the form button, before calling of your button-click-handler. Possible workaround for form button:

Code: Select all

private void button1_Click(object sender, EventArgs e)
{
}
private void button1_MouseCaptureChanged(object sender, EventArgs e)
{
    DoPaste();
}
private void button1_KeyUp(object sender, KeyEventArgs e)
{
    DoPaste();
}
private void DoPaste()
{
    try
    {
        object dataIn = "Paste";
        object dataOut;
        axCoPDFXCview1.DoVerb(null, "ExecuteCommand", dataIn, out dataOut, 0);
    }
    catch (Exception ex)
    {
        ;;
    }
}
We will fix this issue in the next build.

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
cew
User
Posts: 213
Joined: Tue Feb 01, 2011 8:14 am

Re: Insert image from clipboard

Post by cew »

Vasyl-Tracker Dev Team wrote: HTH.
Oh yes, TH! :D

Best regards,
cew
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Insert image from clipboard

Post by John - Tracker Supp »

;-)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com