Drag and drop content into PDF-XChange Editor

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

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.
Post Reply
prosozial_schmitt
User
Posts: 52
Joined: Tue Dec 28, 2004 9:49 am

Drag and drop content into PDF-XChange Editor

Post by prosozial_schmitt » Tue Dec 15, 2015 3:49 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Wed Dec 16, 2015 3:58 pm

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

prosozial_schmitt
User
Posts: 52
Joined: Tue Dec 28, 2004 9:49 am

Re: Drag and drop content into PDF-XChange Editor

Post by prosozial_schmitt » Wed Dec 16, 2015 5:24 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Thu Dec 17, 2015 3:26 pm

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Wed Dec 23, 2015 3:59 pm

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 :wink:

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);
}
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

prosozial_schmitt
User
Posts: 52
Joined: Tue Dec 28, 2004 9:49 am

Re: Drag and drop content into PDF-XChange Editor

Post by prosozial_schmitt » Wed Dec 23, 2015 4:11 pm

Hello Alex,

thank you for your answer. I'll try it with the next build.

Greetings
Hans-Peter

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13539
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Tracker Supp-Stefan » Wed Dec 23, 2015 5:03 pm

:)

stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: Drag and drop content into PDF-XChange Editor

Post by stephen.starr » Thu Nov 24, 2016 12:05 am

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

stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: Drag and drop content into PDF-XChange Editor

Post by stephen.starr » Thu Nov 24, 2016 12:32 am

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Thu Nov 24, 2016 10:14 am

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: Drag and drop content into PDF-XChange Editor

Post by stephen.starr » Tue Nov 29, 2016 2:16 am

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Tue Nov 29, 2016 7:25 am

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: Drag and drop content into PDF-XChange Editor

Post by stephen.starr » Thu Dec 08, 2016 8:09 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Fri Dec 09, 2016 9:09 am

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:
http://sdkhelp.tracker-software.com/vie ... nsertPages
What you can do is listening to the e.operBeforeExecute event as described in this topic:
https://www.tracker-software.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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: Drag and drop content into PDF-XChange Editor

Post by stephen.starr » Fri Dec 09, 2016 4:58 pm

Thank you Alex, I will try this.

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Fri Dec 09, 2016 5:23 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: Drag and drop content into PDF-XChange Editor

Post by stephen.starr » Fri Dec 09, 2016 6:09 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Sun Dec 11, 2016 11:10 am

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Mon Dec 12, 2016 12:10 pm

Hello Stephen,

Try this - just tested, should work:

Code: Select all

e.pEvent.Result = 1;
e.pEvent.Handled = true;
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: Drag and drop content into PDF-XChange Editor

Post by stephen.starr » Tue Dec 13, 2016 12:20 am

Alex, this works great.

Thanks you,
Stephen

User avatar
Sasha - Tracker Dev Team
User
Posts: 4319
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Drag and drop content into PDF-XChange Editor

Post by Sasha - Tracker Dev Team » Tue Dec 13, 2016 10:22 am

Glad that helped :)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply