Change the Tab description SOLVED
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.
Change the Tab description
Hi,
Could you please let me know how to change the description on the document tab?
I load the document using the following code:
oPDFCtrl.OpenDocFromPath(strPDFFileName)
Then I have the following code:
doc = oPDFCtrl.Doc
doc.CoreDoc.Info.InfoStr(PXC_DocumentInfoKey.DocInfo_Title) = "TEST 123"
But this doesn't change the description of the tab. I still see the file name.
Please provide me some code snippet to solve this.
Thanks,
Bijalkumar Patel
Logistics Health, Inc.
Could you please let me know how to change the description on the document tab?
I load the document using the following code:
oPDFCtrl.OpenDocFromPath(strPDFFileName)
Then I have the following code:
doc = oPDFCtrl.Doc
doc.CoreDoc.Info.InfoStr(PXC_DocumentInfoKey.DocInfo_Title) = "TEST 123"
But this doesn't change the description of the tab. I still see the file name.
Please provide me some code snippet to solve this.
Thanks,
Bijalkumar Patel
Logistics Health, Inc.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Change the Tab description SOLVED
Hello bpatel,
You should change the document's properties so that it would show the custom title, not the file name. To do that, you will need to use this:
Cheers,
Alex
You should change the document's properties so that it would show the custom title, not the file name. To do that, you will need to use this:
Code: Select all
Doc.CoreDoc.Props.set_ViewPrefFlag(PDFXEdit.PXC_DocumentViewFlags.DocViewFlag_DisplayDocTitle, true);
Doc.CoreDoc.SrcInfo.CustDispTitle = "Custom Title"; Doc.CoreDoc.Props.set_ViewPrefFlag(PDFXEdit.PXC_DocumentViewFlags.DocViewFlag_DisplayDocTitle, true);
var evtID = pdfCtl.Inst.Str2ID("e.document.propsChanged", false);
IntPtr unkPtr = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(Doc);
PDFXEdit.IEvent evt = Doc.EventServer.CreateNewEvent(evtID, (uint)unkPtr, (uint)PDFXEdit.PXC_DocumentViewFlags.DocViewFlag_DisplayDocTitle);
Doc.EventServer.FireEvent(evt, Doc);
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Change the Tab description
Thank you Alex!
It works as expected now.
Thanks,
Bijalkumar Patel
Logistics Health, Inc.
It works as expected now.
Thanks,
Bijalkumar Patel
Logistics Health, Inc.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Change the Tab description
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Change the Tab description
Hello, It appears that the example provided is prone to Arithmetic overflow exception when you cast to the IntPtr to an UInt. I think this is because IntPtr can be larger the max value for UInt (32 bit).
Is there another way to show a custom title? Is this a possible bug?
thanks,
-jlucas
-Logistics Health Incorporated.
Code: Select all
IntPtr unkPtr = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(Doc);
PDFXEdit.IEvent evt = Doc.EventServer.CreateNewEvent(evtID, (uint)unkPtr, (uint)PDFXEdit.PXC_DocumentViewFlags.DocViewFlag_DisplayDocTitle);
thanks,
-jlucas
-Logistics Health Incorporated.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Change the Tab description
Hello jlucas,
If you are using the x64 then the ulong should be used in this case.
Cheers,
Alex
If you are using the x64 then the ulong should be used in this case.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Change the Tab description
Thanks for the Reply Alex,
We are using 32bit dll. Okay I looked at it a bit more, the IntPtr in our application is a Size of 4 (32bit) IntPtr. So the cast should be good then, unless if IntPtr is a negative. So I am thinking the the GetIUnknownForObject is returning a negative which then causes the Arithmetic overflow exception when cast it to UInt. Below is our code, similar to the previous example. Could their be something up with the Doc? Is there anything that we should check before doing this logic? I think going forward we will at least to a UInteger.TryParse check first.
Thanks,
jlucas
We are using 32bit dll. Okay I looked at it a bit more, the IntPtr in our application is a Size of 4 (32bit) IntPtr. So the cast should be good then, unless if IntPtr is a negative. So I am thinking the the GetIUnknownForObject is returning a negative which then causes the Arithmetic overflow exception when cast it to UInt. Below is our code, similar to the previous example. Could their be something up with the Doc? Is there anything that we should check before doing this logic? I think going forward we will at least to a UInteger.TryParse check first.
Code: Select all
oPDFCtrl.OpenDocFromPath(strPDFFileName, m_oReadOnlyParams)
doc = oPDFCtrl.Doc
'Display the OrderItemDocId instead of the PDFFileName in the editor's document tab bar
doc.CoreDoc.SrcInfo.CustDispTitle = kvpOIDPDFFile.Key.ToString
Dim evtID = oPDFCtrl.Inst.Str2ID("e.document.propsChanged", False)
Dim unkPtr As IntPtr = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(doc)
Dim evt As PDFXEdit.IEvent = doc.EventServer.CreateNewEvent(evtID, CUInt(unkPtr), PXC_DocumentViewFlags.DocViewFlag_DisplayDocTitle)
doc.EventServer.FireEvent(evt, doc)
jlucas
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Change the Tab description
Hello jlucas,
We will need a working sample project and detailed instructions to recreate this.
Cheers,
Alex
We will need a working sample project and detailed instructions to recreate this.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Change the Tab description
Hello,
I work with Jade and Bijal. It seems the issue is that we are getting a 64 bit pointer back when making the call to, but this only happens when our application is being hosted through RD Web Access. An example value I logged was 830407840720. Other hosting options we have and directly accessing the application executable does not result in the same issue (i.e pointer returned has a 32 bit value).
We are in the process of upgrading to the 64 bit DLL. However, unless I am missing something, in the x64 DLL the method signature of IEventServer.CreateNewEvent still has nParam1 typed as UInteger. I tried passing this 64 bit pointer typed as a ULong to IEventServer.CreateNewEvent. I did not get an error, however the titles still did not show.
Please advise on how to get this to work with 64 bit pointers
I work with Jade and Bijal. It seems the issue is that we are getting a 64 bit pointer back when making the call to
Code: Select all
Marshal.GetIUnknownForObject
We are in the process of upgrading to the 64 bit DLL. However, unless I am missing something, in the x64 DLL the method signature of IEventServer.CreateNewEvent still has nParam1 typed as UInteger. I tried passing this 64 bit pointer typed as a ULong to IEventServer.CreateNewEvent. I did not get an error, however the titles still did not show.
Please advise on how to get this to work with 64 bit pointers
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Change the Tab description
Hello tnickel,
Well I do not know what did you achieve with that piece of code previously, but I tried this code snippet and it worked smoothly:
Also, be sure to read the description to the event's parameters:
https://sdkhelp.pdf-xchange.com/vi ... opsChanged
Cheers,
Alex
Well I do not know what did you achieve with that piece of code previously, but I tried this code snippet and it worked smoothly:
Code: Select all
Dim nEventID = pdfCtl.Inst.Str2ID("e.document.propsChanged", False)
Dim evt = pdfCtl.Doc.EventServer.CreateNewEvent(nEventID, PDFXEdit.PXV_ChangeDocPropsFlag.CDPF_Author)
pdfCtl.Doc.EventServer.FireEvent(evt, pdfCtl.Doc)
https://sdkhelp.pdf-xchange.com/vi ... opsChanged
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Change the Tab description
I will try that and let you know how it works. Just curious though, if a managed pointer to the PXV_Document is not required to pass to the IEventServer.CreateNewEvent, why did you suggest that in the first code snippet you gave to Bijal? Is that an artifact from an older version of the SDK?
Re: Change the Tab description
thanks Alex. The new code snippet you gave us seems to be working for all our hosted environments
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Change the Tab description
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ