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.
I'm encountering an issue with DocInfoBar. I'm trying to add a button ton the bar, however an OutOfMemoryException is being thrown. Here is my code I've been playing with:
Private Sub cmdDocInfoBar_Click(sender As System.Object, e As System.EventArgs) Handles cmdDocInfoBar.Click
If pdfCtrl.Inst.ActiveDoc IsNot Nothing Then
Dim Doc As IPXV_Document = pdfCtrl.Inst.ActiveDoc
Dim InfoBar As IPXV_DocInfoBar = Doc.InfoBar
Dim MyIcon As IUIX_Icon = GetIcon(PathToImageFile)
InfoBar.AddSpan(1, 1, 125)
InfoBar.AddButton(1, 1, "Text", "Tooltip", MyIcon)
InfoBar.Hidden = False
InfoBar.Minimized = False
End If
End Sub
Public Function GetIcon(IconPath As String) As PDFXEdit.IUIX_Icon
Dim Icon As PDFXEdit.IUIX_Icon = Nothing
If System.IO.File.Exists(IconPath) Then
Dim name As PDFXEdit.IAFS_Name = fsInst.DefaultFileSys.StringToName(IconPath)
Dim file As PDFXEdit.IAFS_File = fsInst.DefaultFileSys.OpenFile(name, CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read) Or CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_ShareRead))
Icon = uiInst.CreateIconFromIStream(file.GetStream())
End If
Return Icon
End Function
The error occurs on the InfoBar.AddButton(1, 1, "Text", "Tooltip", Icon) line. FYI, my icons are fine when I add them to cmds.
This is working well now and I've been able to add a button to an info bar but I'm looking for some guidance on the following minor issue.
I would like to add two buttons to the infobar, much like the infobar that appears by default from the control when you place a signature/initial on the document. When I use the following code to add two buttons, I only see the second button but not the first.
Private Sub DisplaySignaturesDocInfoBar()
Try
If pdfCtrl.Inst.ActiveDoc IsNot Nothing Then
Dim Doc As IPXV_Document = pdfCtrl.Inst.ActiveDoc
Dim InfoBar As IPXV_DocInfoBar = Doc.InfoBar
If Not Doc.InfoBar.HasSpan(Doc.ID) Then
InfoBar.AddSpan(Doc.ID, 100, 15247393)
InfoBar.SetText(Doc.ID, "MyText")
InfoBar.AddButton(Doc.ID, enumInfoBarButton.Yes, "1Yes", "Click 'yes'", Nothing)
InfoBar.AddButton(Doc.ID, enumInfoBarButton.No, "1No", "Click 'no'", Nothing)
InfoBar.HighlightSpan(Doc.ID)
InfoBar.Callbacks = m_oDocInfoBarCallbacks
InfoBar.Hidden = False
InfoBar.Minimized = False
End If
End If
Catch ex As Exception
mWriteLog(1, "DisplaySignaturesDocInfoBar(): There was an error in displaying the stamps info bar.")
mGenericError(ex)
End Try
End Sub
It seems that there's some sort of a bug when adding even number of buttons to the document's info bar - we'll investigate this and will try to fix it.
OK, thanks. I did try with 3 buttons and it works fine. I also tried adding 3 buttons and then removing 1 of them, but this ultimately removes all buttons, maybe due to another bug or the same one.
Yes - this needs to be investigated. The problem is that this code was never used before as a part of the Editor's functionality thus these problems occur. We will try to fix them asap.