Get fileName on op.attachments.delete

PDF-XChange Editor SDK for Developers

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

Get fileName on op.attachments.delete

Post by lidds »

I was wondering how I can get the fileName of the attachment that is being deleted when intercepting the op.attachments.delete operation?

Thanks

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

Re: Get fileName on op.attachments.delete

Post by Sasha - Tracker Dev Team »

Hello Simon,

You can acquire the Attachments List from the operation's options:
https://sdkhelp.pdf-xchange.com/vi ... nts_delete
Then you can get IPXC_FileSpec from the list and it has all of the properties that you need, for example IPXC_FileSpec::FileName

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Get fileName on op.attachments.delete

Post by lidds »

Alex,

Thank you for your help, however this returns the list of all attachments and not the attachment that is actually being deleted. I am intercepting the op.attachments.delete event, however I can't seem to get the information on the file that is actually being deleted?

Thanks

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

Re: Get fileName on op.attachments.delete

Post by Sasha - Tracker Dev Team »

Hello Simon,

Please give a code piece that you are using to do this.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Get fileName on op.attachments.delete

Post by lidds »

Alex,

Please see code below. I know what the issue is that I am looping through the current attachment list, however I need to determine the actual attachment that is being deleted, however I am unsure how to do this?

Code: Select all

		Private Sub docPreview_OnEvent(sender As Object, e As AxPDFXEdit._IPXV_ControlEvents_OnEventEvent) Handles docPreview.OnEvent
			If e.nEventID = nIDS(CInt(IDS.e_operExecuted)) Then
                Try                    
					If oper.ID = Me.docPreview.Inst.Str2ID("op.attachments.delete", False) Then
                        Dim Tree As PDFXEdit.IPXC_NameTree = Me.docPreview.Doc.CoreDoc.GetNameTree("EmbeddedFiles")
                        Dim nAttachmentsCount As UInteger = Tree.Count
                        Dim sName As String

                        For i As UInteger = 0 To nAttachmentsCount - 1
                            Dim pValue As PDFXEdit.IPXS_PDFVariant
                            Tree.Item(i, sName, pValue)
                            Dim FS As PDFXEdit.IPXC_FileSpec = Me.docPreview.Doc.CoreDoc.GetFileSpecFromVariant(pValue)
                        Next
                    End If
				Catch ex As Exception
					MsgBox(ex.message)
				End Try
			End If
		End Sub
Thanks

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

Re: Get fileName on op.attachments.delete

Post by Sasha - Tracker Dev Team »

Hello Simon,

Please read my previous post carefully.
Sasha - Tracker Dev Team wrote: You can acquire the Attachments List from the operation's options:
https://sdkhelp.pdf-xchange.com/vi ... nts_delete
https://sdkhelp.pdf-xchange.com/vi ... te_Options

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply