Hello!
A new question: how can I determine, whether a PDF document is opened in the Viewer (with the OpenDocument method) or not?
Thanks!!!
Viewer status (a document opened?)
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: Viewer status (a document opened?)
Hello relapse,
You can obtain the file name for any open document via one of the three ways below (in pseudocode):
where 4095 is an example of an unique document ID
And compare it with the file you are planning to open.
The default action for the Viewer if a file is already open in it is to just set that document as the active one (if more than one document is displayed in tabs and this document is not currently the active one).
Best,
Stefan
You can obtain the file name for any open document via one of the three ways below (in pseudocode):
Code: Select all
...
DoVerb("Documents[#4095].FileName", "get", DataIn, DataOut, 0);
// or:
GetProperty("Documents[#4095].FileName", DataOut, 0);
// or:
GetDocumentProperty(4095, "FileName", DataOut, 0);
...
And compare it with the file you are planning to open.
The default action for the Viewer if a file is already open in it is to just set that document as the active one (if more than one document is displayed in tabs and this document is not currently the active one).
Best,
Stefan
-
- User
- Posts: 167
- Joined: Wed Jan 18, 2012 11:10 am
Re: Viewer status (a document opened?)
Sorry, I haven't formulated my question precisely enough:
I properly wanted to know how I can find out, whether ANY document is opened at all. I solved this issue with the GetActiveDocument() function (C# example):
If no document is active, you get a negative value via the out parameter!
Thanks for your reply!
I properly wanted to know how I can find out, whether ANY document is opened at all. I solved this issue with the GetActiveDocument() function (C# example):
Code: Select all
int currentDocId;
pdfViewer.GetActiveDocument(out currentDocId);
if (currentDocId > 0)
{
pdfViewer.CloseDocument(_documentId, (int) PDFXCviewAxLib.PXCVA_Flags.PXCVA_NoUI);
}
pdfViewer.OpenDocument(_tempFile, string.Empty, out _documentId, 0);
Thanks for your reply!
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: Viewer status (a document opened?)
Hi Relapse,
You are welcome and glad that you found your solution!
Cheers,
Stefan
You are welcome and glad that you found your solution!
Cheers,
Stefan