Custom stamps general questions via code

PDF-XChange Editor SDK for Developers

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

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.
lidds
User
Posts: 528
Joined: Sat May 16, 2009 1:55 pm

Custom stamps general questions via code

Post by lidds »

Please feel free to separate the questions below into individual questions; however, I think this would encumber the majority:

In my application, I introduced the feature to design your own custom stamps a few years ago (utilising PDF XChange features); however, I have noticed that you have added this feature with enhanced capabilities, including dynamic date fields and interactive text fields.

Could you answer the following:

1. How can I display the "Stamp Elements" property window?
e.g. Me.docPreview.ShowPane("commentsView", False)
2. Can I remove the "Add" dropdown from the "Stamp Elements" form?
3. How can I use code to execute the following commands:
a. Date field
b. Interactive Field
e.g.
Dim cmd As PDFXEdit.IUIX_Cmd = uiInst.get_CmdManager.Cmds.Find("cmd.tool.annot.polygon")
Me.docPreview.Inst.ExecUICmd2(cmd.ID)

Thanks

Simon
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12219
Joined: Wed Jan 03, 2018 6:52 pm

Re: Custom stamps general questions via code

Post by Daniel - PDF-XChange »

Hello, lidds

Thank you for the post, I have passed this along to the Dev team for review and hopefully we will hear from them soon.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
lidds
User
Posts: 528
Joined: Sat May 16, 2009 1:55 pm

Re: Custom stamps general questions via code

Post by lidds »

Hi Dan,

Is there any update from the Dev team on this?

Thanks

Simon
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12219
Joined: Wed Jan 03, 2018 6:52 pm

Re: Custom stamps general questions via code

Post by Daniel - PDF-XChange »

Hello, lidds

Nothing yet, SDK topics generally require a much more involved response from the dev team, so it could be over a week, possibly longer before they have the time to sit down and get back to us.

In the meantime, you may want to look through our github examples, as they main contain the answers you seek: https://github.com/pdf-xchange

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2468
Joined: Thu Jun 30, 2005 4:11 pm

Re: Custom stamps general questions via code

Post by Vasyl - PDF-XChange »

Hi Simon.
1. How can I display the "Stamp Elements" property window?
It is always visible, the user cannot hide it, so I don't understand why you need it.
2. Can I remove the "Add" dropdown from the "Stamp Elements" form?
Complicated but is possible:

Code: Select all

public static void RemoveCmds(PDFXEdit.IUIX_Obj obj, ref List<int> cmds)
{
	foreach (PDFXEdit.IUIX_Obj child in obj.Children)
	{
		IntPtr impl = IntPtr.Zero;
		try
		{
			child.QueryImpl(typeof(PDFXEdit.IUIX_CmdBar).GUID, null, out impl);
		}
		catch { impl = IntPtr.Zero; }

		if (impl != IntPtr.Zero)
		{
			PDFXEdit.IUIX_CmdBar cbar = (PDFXEdit.IUIX_CmdBar)Marshal.GetObjectForIUnknown(impl);
			if (cbar != null)
			{
				foreach (int cmd in cmds)
				{
					int pos = cbar.FlatFindFirstItemByCmdID(cmd);
					if (pos >= 0)
						cbar.FlatDeleteItem(pos);
				}
					
			}
		}
		else
		{
			RemoveCmds(child, ref cmds);
		}
	}
}

public partial class UIEventDemoMon : PDFXEdit.IUIX_EventMonitor
{
	public UIEventDemoMon(PDFXEdit.PXV_Inst inst)
	{
		m_inst = inst;
		m_dlgID = m_inst.Str2ID("DlgAddCustomStamp");
	}

	public int m_dlgID = 0;
	public PDFXEdit.PXV_Inst m_inst;

	public void OnEventMonitor(PDFXEdit.IUIX_Obj pTarget, PDFXEdit.IUIX_Event pEvent)
	{
		if (pEvent.Code == (int)UIX_EventCodes.e_ShowModal)
		{
			if (pTarget.ID == m_dlgID)
			{
				// remove unnecessary toolbar-item(s)
				int cmd = m_inst.Str2ID("cmd.stampCustom.add");
				List<int> cmds = new List<int>();
				cmds.Add(cmd);
				RemoveCmds(pTarget, ref cmds);
			}
		}
	}
}
....
....

// install event-monitor to intercept the e_ShowModal event for the "DlgAddCustomStamp" modal dialog:
UIEventDemoMon em = new UIEventDemoMon3(pdfCtl.Inst);
uiInst.get_CurrentThreadCtx().RegisterEventMonitor(em);
3. How can I use code to execute the following commands:
Impossible at the moment, unfortunately.

Best,
Vasyl.
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.