Drag and drop content into PDF-XChange Editor
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 49
- Joined: Tue Dec 28, 2004 9:49 am
Drag and drop content into PDF-XChange Editor
Hello,
we need to implement to "drag and drop" a text from outside the PDF-XChange Editor into a form field of a pdf inside the PDF-XChange Editor.
Because of the still missing "drag and drop"-feature in your PDF-XChange-Viewer SDK, I managed it to do this with some effort in another way in combination with low-level-mouse hooks and a couple of JavaScript methods - but this is really an ugly hack. So I'm evaluating your new product "PDF-XChange Editor SDK" in the hope, that this would be a better way.
In your "PDF-XChange Editor SDK" online-documentation and your "Fulldemo" sample-Project from Git, I can not find any information about a "drap and drop"-support. I can see that drag/drop events on AxPDFXEdit.AxPXV_Control are hidden (same as in your viewer).
If I make a class and inherit from AxPDFXEdit.AxPXV_Control to add an eventhandler on DragEnter, a NotSupportedException is thrown (same as in your viewer).
Is "drag and drop" still not supported in your new "PDF-XChange Editor" or do I have to implement it in another way?
Greetings
Hans-Peter
we need to implement to "drag and drop" a text from outside the PDF-XChange Editor into a form field of a pdf inside the PDF-XChange Editor.
Because of the still missing "drag and drop"-feature in your PDF-XChange-Viewer SDK, I managed it to do this with some effort in another way in combination with low-level-mouse hooks and a couple of JavaScript methods - but this is really an ugly hack. So I'm evaluating your new product "PDF-XChange Editor SDK" in the hope, that this would be a better way.
In your "PDF-XChange Editor SDK" online-documentation and your "Fulldemo" sample-Project from Git, I can not find any information about a "drap and drop"-support. I can see that drag/drop events on AxPDFXEdit.AxPXV_Control are hidden (same as in your viewer).
If I make a class and inherit from AxPDFXEdit.AxPXV_Control to add an eventhandler on DragEnter, a NotSupportedException is thrown (same as in your viewer).
Is "drag and drop" still not supported in your new "PDF-XChange Editor" or do I have to implement it in another way?
Greetings
Hans-Peter
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Hello Hans-Peter,
I need some clarifications first, before I can answer your question.
1) Where do you drag your text from (is it a text file, or just plain text from browser for example)?
2) Do you need to create a form field when you drop the text onto pages view or do you drop inside a form field?
3) Is this XFA form fields? or is it just a content item that looks like a form field?
Cheers,
Alex
I need some clarifications first, before I can answer your question.
1) Where do you drag your text from (is it a text file, or just plain text from browser for example)?
2) Do you need to create a form field when you drop the text onto pages view or do you drop inside a form field?
3) Is this XFA form fields? or is it just a content item that looks like a form field?
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 49
- Joined: Tue Dec 28, 2004 9:49 am
Re: Drag and drop content into PDF-XChange Editor
Hello Alex,
we have to implement/handle/serve the common windows drag and drop feature. This includes:
1. Dragging content from our application into the pdf-Editor-Control which is sitting on a form in our application.
Our users want to drop this content (usualy text/String, not a file) into a field in the pdf-document opened in pdf-Editor.
2. Dragging content from outside our application (text-Editor (String), Excel (out of a cell)) into the pdf-Editor-Control which is sitting on a form in our application and drop it into a field in the pdf-document opened in pdf-Editor.
3. Dragging an image-file from outside our application into the pdf-Editor-Control which is sitting on a form in our application and drop it somewhere in the pdf-document opened in pdf-Editor.
In these cases the pdf-document has form fields and widgets.
It is also a great idea to drag and drop content (Images and text) simply to anywhere in a pdf-page (if permissions allows).
For text-content this would require to create an annotation (typewriter?) or (even better) a form field at the drop-position.
For image-content this would require to create an image-object?
An example:
Our user want easily "sign" the document via drag and drop (put an image of theis signature on the pdf-page).
Therefore content has also to appear on a print of the pdf...
It is essential, that the drag and drop behaves like in other applications. The mousecursor must change if over an place on which a user can drop the content.
I hope this could help to understand.
Greetings
Hans-Peter
we have to implement/handle/serve the common windows drag and drop feature. This includes:
1. Dragging content from our application into the pdf-Editor-Control which is sitting on a form in our application.
Our users want to drop this content (usualy text/String, not a file) into a field in the pdf-document opened in pdf-Editor.
2. Dragging content from outside our application (text-Editor (String), Excel (out of a cell)) into the pdf-Editor-Control which is sitting on a form in our application and drop it into a field in the pdf-document opened in pdf-Editor.
3. Dragging an image-file from outside our application into the pdf-Editor-Control which is sitting on a form in our application and drop it somewhere in the pdf-document opened in pdf-Editor.
In these cases the pdf-document has form fields and widgets.
It is also a great idea to drag and drop content (Images and text) simply to anywhere in a pdf-page (if permissions allows).
For text-content this would require to create an annotation (typewriter?) or (even better) a form field at the drop-position.
For image-content this would require to create an image-object?
An example:
Our user want easily "sign" the document via drag and drop (put an image of theis signature on the pdf-page).
Therefore content has also to appear on a print of the pdf...
It is essential, that the drag and drop behaves like in other applications. The mousecursor must change if over an place on which a user can drop the content.
I hope this could help to understand.
Greetings
Hans-Peter
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Hello Hans-Peter,
Yes I understood your needs, though it will require some time to investigate whether it will be possible to implement custom drag and drop to the pages view right now, or will it require our native code update for such a possibility. Will reply as soon as I'll investigate this thoroughly.
Cheers,
Alex
Yes I understood your needs, though it will require some time to investigate whether it will be possible to implement custom drag and drop to the pages view right now, or will it require our native code update for such a possibility. Will reply as soon as I'll investigate this thoroughly.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Hello prosozial_schmitt,
So here is a custom drag and drop example of text onto PagesView that you can paste in the FullDemo project and try for yourself after the next release - there were some problems with IDropTarget and some other interfaces that were fixed and will be available in the next build
Cheers,
Alex
So here is a custom drag and drop example of text onto PagesView that you can paste in the FullDemo project and try for yourself after the next release - there were some problems with IDropTarget and some other interfaces that were fixed and will be available in the next build
Code: Select all
/// <summary>
/// Drag and Drop
/// </summary>
///
//Getting page coordinates in PDFXEdit control from screen coordinates
public int HitTestPage(PDFXEdit._POINTL pt, out PDFXEdit.PXC_Point ptPagePoint)
{
//Converting input data into given structures
PDFXEdit.tagPOINT ptIn = new PDFXEdit.tagPOINT();
ptIn.x = pt.x;
ptIn.y = pt.y;
PDFXEdit.tagPOINT ptRes = new PDFXEdit.tagPOINT();
//Converting screen point to PDFXEdit client point
pdfCtl.Doc.ActiveView.PagesView.Obj.ScreenPtToClient(ptIn, out ptRes);
//And then checking whether it is on page and returning it in page coordinate system if so
return pdfCtl.Doc.ActiveView.PagesView.Layout.HitTest(ptRes, out ptPagePoint);
}
//Adding annotation from given string in the given screen coordinate
public bool AddAnnotFromText(PDFXEdit._POINTL pt, string str)
{
PDFXEdit.PXC_Point ptPagePoint = new PDFXEdit.PXC_Point();
//Checking whether the point is on one of the document's pages
int nResPageNum = HitTestPage(pt, out ptPagePoint);
if (nResPageNum < 0)
return false;
//Creating rectangle for the new Free Text annotation
PDFXEdit.PXC_Rect rc;
rc.left = ptPagePoint.x;
rc.right = ptPagePoint.x + 200;
rc.top = ptPagePoint.y - 200;
rc.bottom = ptPagePoint.y;
PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)pdfCtl.Inst.GetExtension("PXS");
//Getting Free Text annotation atom for the InsertNewAnnot method
uint nTextBox = pSInt.StrToAtom("FreeText");
PDFXEdit.IPXC_Page pPage = pdfCtl.Doc.CoreDoc.Pages[(uint)nResPageNum];
PDFXEdit.IPXC_Annotation pAnnot = pPage.InsertNewAnnot(nTextBox, ref rc, 0);
if (pAnnot == null)
return false;
//Filling the annotation with needed text
PDFXEdit.IPXC_AnnotData_FreeText FTData = (PDFXEdit.IPXC_AnnotData_FreeText)pAnnot.Data;
FTData.Contents = str;
pAnnot.Data = FTData;
//Executing the operation so that the annotation will be updated from structure
int nID = pdfCtl.Inst.Str2ID("op.annots.addNew", false);
PDFXEdit.IOperation pOp = pdfCtl.Inst.CreateOp(nID);
PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
input.Add().v = pAnnot;
pOp.Do();
return true;
}
//Class that implements the drop target functionality for the needed object
//In this example the PagesView was used as the "needed object"
public partial class MyDropTarget :
PDFXEdit.IUIX_ObjImpl,
PDFXEdit.IDropTarget,
IDisposable
{
//Here we push implementation of drag and drop functions of the PagesView
public MyDropTarget(PDFXEdit.IUIX_Obj obj, MainFrm parentForm)
{
Obj_ = obj;
if (Obj_ != null)
Obj_.PushImpl(this);
Parent = parentForm;
}
~MyDropTarget()
{
Dispose();
}
//Disposing of all of the links we made with objects and parent
public void Dispose()
{
Parent = null;
if (Disposed_)
return;
Disposed_ = true;
if (Obj_ != null)
{
Obj_.PopImpl(this);
System.Runtime.InteropServices.Marshal.ReleaseComObject(Obj_);
Obj_ = null;
}
}
//Main form - a parent that in our case holds the PDFXEdit control
public MainFrm Parent = null;
//Object for which we are implementing drag and drop
public PDFXEdit.IUIX_Obj Obj_;
//Used for single dispose control
private bool Disposed_ = false;
//Used for checking whether the DragEnter function gave successful results (formats check) - used in DragOver function
private bool SuccessEnter = false;
//List of supported formats that will be dragged onto our object
List<System.Runtime.InteropServices.ComTypes.FORMATETC> m_SuppFmtEtc = new List<System.Runtime.InteropServices.ComTypes.FORMATETC>();
// IUIX_ObjImpl
public PDFXEdit.IUIX_Obj Obj
{
get { return this.Obj_; }
}
//Event listener that listens for e_QueryDropTarget
public void OnEvent(PDFXEdit.IUIX_Obj pSender, PDFXEdit.IUIX_Event pEvent)
{
pEvent.Handled = false;
if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_QueryDropTarget)
{
pEvent.Handled = true;
IntPtr res = IntPtr.Zero;
try
{
//We need to return com interface for PDFXEdit.IDropTarget from the current class as a pEvent.Result
res = System.Runtime.InteropServices.Marshal.GetComInterfaceForObject(this, typeof(PDFXEdit.IDropTarget));
}
catch (Exception e)
{
Debug.WriteLine("pdfCtl.OnEvent: e.nEventID=={0}", e.Message);
}
if (res != IntPtr.Zero)
pEvent.Result = (uint)res; // = (long)res for x64
}
else if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_BeforeDestroy)
{
Dispose();
}
else if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_Last)
{
Dispose();
}
}
//Method that adds text support formats into the m_SuppFmtEtc
public bool AddSuppTextDrop(bool bUnicode)
{
System.Runtime.InteropServices.ComTypes.FORMATETC FmtEtc = new System.Runtime.InteropServices.ComTypes.FORMATETC();
if (bUnicode == false)
FmtEtc.cfFormat = 1; //CF_TEXT
else
FmtEtc.cfFormat = 13; //CF_UNICODETEXT
FmtEtc.dwAspect = System.Runtime.InteropServices.ComTypes.DVASPECT.DVASPECT_CONTENT;
FmtEtc.lindex = -1;
FmtEtc.tymed = System.Runtime.InteropServices.ComTypes.TYMED.TYMED_HGLOBAL;
return AddSuppFmt(FmtEtc);
}
//Method that adds a new format into the m_SuppFmtEtc
public bool AddSuppFmt(System.Runtime.InteropServices.ComTypes.FORMATETC FmtEtc)
{
if (FmtEtc.cfFormat == 0)
return false;
for (int i = 0; i < m_SuppFmtEtc.Count(); i++)
{
if (FmtEtc.cfFormat == m_SuppFmtEtc[i].cfFormat)
{
m_SuppFmtEtc[i] = FmtEtc;
return true;
}
}
m_SuppFmtEtc.Add(FmtEtc);
return true;
}
//Method that gets FORMATETC and STGMEDIUM from the IDataObject
public bool GetFormatAndStgMedium(PDFXEdit.IDataObject pDataObj, ref System.Runtime.InteropServices.ComTypes.FORMATETC fmt, ref System.Runtime.InteropServices.ComTypes.STGMEDIUM med)
{
//Running through the m_SuppFmtEtc and checking whether the dragged IDataObject is correct for one of them
System.Runtime.InteropServices.ComTypes.IDataObject obj = (System.Runtime.InteropServices.ComTypes.IDataObject)pDataObj;
for (int i = 0; i < m_SuppFmtEtc.Count(); i++)
{
try
{
//Getting STGMEDIUM data from IDataObject with the FORMATETC from the current iteration
obj.GetData(m_SuppFmtEtc[i], out med);
if (med.tymed != System.Runtime.InteropServices.ComTypes.TYMED.TYMED_NULL)
{
fmt = m_SuppFmtEtc[i];
return true;
}
}
catch (Exception e)
{
Debug.WriteLine("pdfCtl.OnEvent: e.nEventID=={0}", e.Message);
}
}
return false;
}
public void OnPostEvent(PDFXEdit.IUIX_Obj pSender, PDFXEdit.IUIX_Event pEvent)
{
}
public void OnPreEvent(PDFXEdit.IUIX_Obj pSender, PDFXEdit.IUIX_Event pEvent)
{
}
/// <summary>
/// Provides access to Win32-level constants, structures, and functions.
/// </summary>
[DllImport("Kernel32.dll", SetLastError = true)]
private static extern IntPtr GlobalLock(IntPtr hMem);
[DllImport("Kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GlobalUnlock(IntPtr hMem);
[DllImport("Kernel32.dll", SetLastError = true)]
private static extern int GlobalSize(IntPtr hMem);
//
public void DragEnter(PDFXEdit.IDataObject pDataObj, uint grfKeyState, PDFXEdit._POINTL pt, ref uint pdwEffect)
{
pdwEffect = (uint)DragDropEffects.None;
SuccessEnter = false;
System.Runtime.InteropServices.ComTypes.FORMATETC fmtEtc = new System.Runtime.InteropServices.ComTypes.FORMATETC();
System.Runtime.InteropServices.ComTypes.STGMEDIUM medium = new System.Runtime.InteropServices.ComTypes.STGMEDIUM();
//Getting FORMATETC and STGMEDIUM from the IDataObject
if (GetFormatAndStgMedium(pDataObj, ref fmtEtc, ref medium) == true)
{
//If we succeeded then doing the page hit test
PDFXEdit.PXC_Point ptn = new PDFXEdit.PXC_Point();
if (Parent.HitTestPage(pt, out ptn) >= 0)
pdwEffect = (uint)DragDropEffects.Copy; //If we are on a page then changing the cursor
SuccessEnter = true;
}
}
public void DragLeave()
{
SuccessEnter = false;
}
public void DragOver(uint grfKeyState, PDFXEdit._POINTL pt, ref uint pdwEffect)
{
pdwEffect = (uint)DragDropEffects.None;
//If we got valid FORMATETC and STGMEDIUM in the DragEnter method then we can do the page hit test
if (SuccessEnter != false)
{
PDFXEdit.PXC_Point ptn = new PDFXEdit.PXC_Point();
if (Parent.HitTestPage(pt, out ptn) >= 0)
pdwEffect = (uint)DragDropEffects.Copy;
}
}
public void Drop(PDFXEdit.IDataObject pDataObj, uint grfKeyState, PDFXEdit._POINTL pt, ref uint pdwEffect)
{
SuccessEnter = false;
System.Runtime.InteropServices.ComTypes.FORMATETC fmtEtc = new System.Runtime.InteropServices.ComTypes.FORMATETC();
System.Runtime.InteropServices.ComTypes.STGMEDIUM medium = new System.Runtime.InteropServices.ComTypes.STGMEDIUM();
//Getting FORMATETC and STGMEDIUM from the IDataObject
if (GetFormatAndStgMedium(pDataObj, ref fmtEtc, ref medium) == true)
{
//If it's a global drag and drop and we've got the correct data
if (medium.tymed == System.Runtime.InteropServices.ComTypes.TYMED.TYMED_HGLOBAL)
{
//Getting data from the STGMEDIUM
var ptr = GlobalLock(medium.unionmember);
if (ptr != IntPtr.Zero)
{
try
{
var length = (Int32)GlobalSize(ptr);
var data = new byte[length];
Marshal.Copy(ptr, data, 0, length);
//Now we have a result string that has our dragged text
string result = System.Text.Encoding.UTF8.GetString(data).TrimEnd('\0');
//Adding Text annotation that contains that text
Parent.AddAnnotFromText(pt, result);
}
finally
{
GlobalUnlock(medium.unionmember);
}
}
}
}
}
}
//Drop target that will contain the custom drag and drop implementation for the given object
public MyDropTarget myDropTarget = null; //PS: Do not forget to dispose of it (we do it in Form1_FormClosed)
//Method where the myDropTarget is initialized
void InitializePagesViewAsDropTarget()
{
//Setting style of the object so it will accept dropping
pdfCtl.Doc.ActiveView.PagesView.Obj.SetStyleEx((int)PDFXEdit.UIX_ObjStyleExFlags.UIX_ObjStyleEx_DropTarget, (int)PDFXEdit.UIX_ObjStyleExFlags.UIX_ObjStyleEx_DropTarget);
//Creating the drop target and filling it's supported formats
myDropTarget = new MyDropTarget(pdfCtl.Doc.ActiveView.PagesView.Obj, this);
myDropTarget.AddSuppTextDrop(false);
myDropTarget.AddSuppTextDrop(true);
}
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 49
- Joined: Tue Dec 28, 2004 9:49 am
Re: Drag and drop content into PDF-XChange Editor
Hello Alex,
thank you for your answer. I'll try it with the next build.
Greetings
Hans-Peter
thank you for your answer. I'll try it with the next build.
Greetings
Hans-Peter
- Tracker Supp-Stefan
- Site Admin
- Posts: 17822
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
-
- User
- Posts: 123
- Joined: Wed Mar 25, 2015 10:59 pm
Re: Drag and drop content into PDF-XChange Editor
Alex, I implemented the custom drag & drop code above and it works great for dragging text. I can't seem to get it to work for dragging files though. If I drag a file from explorer onto the viewer, I get an exception thrown from the following line of code:
//Getting STGMEDIUM data from IDataObject with the FORMATETC from the current iteration
obj.GetData(m_SuppFmtEtc, out med);
The exception is:
Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC))
This is reproducible in the demo app with the code pasted in.
Basically what I would like to do is get the filename on disk when this type of drag & drop occurs so I can convert the file to a PDF and load it.
Any thoughts?
Thank you,
Stephen
//Getting STGMEDIUM data from IDataObject with the FORMATETC from the current iteration
obj.GetData(m_SuppFmtEtc, out med);
The exception is:
Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC))
This is reproducible in the demo app with the code pasted in.
Basically what I would like to do is get the filename on disk when this type of drag & drop occurs so I can convert the file to a PDF and load it.
Any thoughts?
Thank you,
Stephen
-
- User
- Posts: 123
- Joined: Wed Mar 25, 2015 10:59 pm
Re: Drag and drop content into PDF-XChange Editor
My apologies,
It was my misunderstanding of the code. You have to loop through the CLIPFORMATS (swallowing the exceptions) until the one that matches the file is returned. I have it working now.
Thanks much,
Stephen
It was my misunderstanding of the code. You have to loop through the CLIPFORMATS (swallowing the exceptions) until the one that matches the file is returned. I have it working now.
Thanks much,
Stephen
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 123
- Joined: Wed Mar 25, 2015 10:59 pm
Re: Drag and drop content into PDF-XChange Editor
Alex,
I am having a problem getting drag and drop to work within my application. It works okay if I drag text from outside of my application, but if I initiate the drag and drop myself (using the DoDragDrop method of of the C# Control object), I never get into the DragEnter event handler on the viewer.
I have tried using just a plain string, as well as embedding the string into a .NET IDataObject, which looks like a different interface than the C++ IDataObject interface.
How do I use a .NET control's DoDragDrop to initiate a drag and drop the viewer can understand?
Code example:
_itemCollectionGrid.GridControl.DoDragDrop("my text", DragDropEffects.Copy);
Any help would be greatly appreciated.
Thanks much,
Stephen
I am having a problem getting drag and drop to work within my application. It works okay if I drag text from outside of my application, but if I initiate the drag and drop myself (using the DoDragDrop method of of the C# Control object), I never get into the DragEnter event handler on the viewer.
I have tried using just a plain string, as well as embedding the string into a .NET IDataObject, which looks like a different interface than the C++ IDataObject interface.
How do I use a .NET control's DoDragDrop to initiate a drag and drop the viewer can understand?
Code example:
_itemCollectionGrid.GridControl.DoDragDrop("my text", DragDropEffects.Copy);
Any help would be greatly appreciated.
Thanks much,
Stephen
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Hello Stephen,
You will need to use the C++ interfaces for that like the ones mentioned in my code sample. As the Control itself is written in C++ i doubt that you can use the C# interfaces of D&D to work with it. As far as I have seen from your posts before you have implemented the D&D using the method I described so it's strange that you are having problems now.
Cheers,
Alex
You will need to use the C++ interfaces for that like the ones mentioned in my code sample. As the Control itself is written in C++ i doubt that you can use the C# interfaces of D&D to work with it. As far as I have seen from your posts before you have implemented the D&D using the method I described so it's strange that you are having problems now.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 123
- Joined: Wed Mar 25, 2015 10:59 pm
Re: Drag and drop content into PDF-XChange Editor
I am having one final problem.
The thumbnail pane supports page move, which I need. However, it also allows you to drop files from outside of the application into it which adds pages to the document. I do not want this behavior.
If I create my own drop target for the thumbnail pane, it disables the ability to page move.
Is there a way to turn off the ability to drop files from an outside source while still allowing for page move?
Thank you,
Stephen
The thumbnail pane supports page move, which I need. However, it also allows you to drop files from outside of the application into it which adds pages to the document. I do not want this behavior.
If I create my own drop target for the thumbnail pane, it disables the ability to page move.
Is there a way to turn off the ability to drop files from an outside source while still allowing for page move?
Thank you,
Stephen
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Hello Stephen,
Well that is not a simple task though we can try a different approach. When inserting pages via the D&D on the Thumbnails View the insert pages operation is always being called:
https://sdkhelp.pdf-xchange.com/vie ... nsertPages
What you can do is listening to the e.operBeforeExecute event as described in this topic:
https://www.pdf-xchange.com/forum3 ... 66&t=26224
Though in your case you will need the insetPages operation. The movePages operation is being called when you D&D pages in the Thumbnails View itself (as far as I remember).
And then try setting the event as handled when it's the insetPages operation so that it won't be executed.
Cheers,
Alex
Well that is not a simple task though we can try a different approach. When inserting pages via the D&D on the Thumbnails View the insert pages operation is always being called:
https://sdkhelp.pdf-xchange.com/vie ... nsertPages
What you can do is listening to the e.operBeforeExecute event as described in this topic:
https://www.pdf-xchange.com/forum3 ... 66&t=26224
Though in your case you will need the insetPages operation. The movePages operation is being called when you D&D pages in the Thumbnails View itself (as far as I remember).
And then try setting the event as handled when it's the insetPages operation so that it won't be executed.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 123
- Joined: Wed Mar 25, 2015 10:59 pm
Re: Drag and drop content into PDF-XChange Editor
Thank you Alex, I will try this.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 123
- Joined: Wed Mar 25, 2015 10:59 pm
Re: Drag and drop content into PDF-XChange Editor
Alex,
Setting the event to handled didn't seem to work. The pages still get inserted.
case "op.document.insertPages":
e.pEvent.Handled = true;
break;
Is there another way I could work around this?
Thank you,
Stephen
Setting the event to handled didn't seem to work. The pages still get inserted.
case "op.document.insertPages":
e.pEvent.Handled = true;
break;
Is there another way I could work around this?
Thank you,
Stephen
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Hello Stephen,
OK, then it's not as straightforward as I thought - will check this on Monday and will write you a code snippet on how to stop the operation execution.
Cheers,
Alex
OK, then it's not as straightforward as I thought - will check this on Monday and will write you a code snippet on how to stop the operation execution.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Hello Stephen,
Try this - just tested, should work:
Cheers,
Alex
Try this - just tested, should work:
Code: Select all
e.pEvent.Result = 1;
e.pEvent.Handled = true;
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 123
- Joined: Wed Mar 25, 2015 10:59 pm
Re: Drag and drop content into PDF-XChange Editor
Alex, this works great.
Thanks you,
Stephen
Thanks you,
Stephen
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Drag and drop content into PDF-XChange Editor
Glad that helped
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ