Highlighting words/phrases in PDF XChange Viewer
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Highlighting words/phrases in PDF XChange Viewer
dtSearch provides a function "MakePdfWebHighlightFile" that generates XML data used to highlight hits in Adobe Reader. The XML data file/string looks like this:
<XML>
<Body units=characters color=#ff00ff mode=active version=2>
<Highlight>
<loc pg=37 pos=911 len=9>
<loc pg=40 pos=1416 len=8>
<loc pg=42 pos=339 len=8>
<loc pg=70 pos=646 len=8>
...
</Highlight>
</Body>
</XML>
Note that dtSearch can be instructed to skip certain fields in calculating offsets with an instruction such as:
searchOptions.FieldFlags = FieldFlags.dtsoFfSkipFilenameField |
FieldFlags.dtsoFfSkipDocumentProperties;
Is there any way to pass this xml data or a translation to PDF XChange Viewer to have it do similar highlighting?
<XML>
<Body units=characters color=#ff00ff mode=active version=2>
<Highlight>
<loc pg=37 pos=911 len=9>
<loc pg=40 pos=1416 len=8>
<loc pg=42 pos=339 len=8>
<loc pg=70 pos=646 len=8>
...
</Highlight>
</Body>
</XML>
Note that dtSearch can be instructed to skip certain fields in calculating offsets with an instruction such as:
searchOptions.FieldFlags = FieldFlags.dtsoFfSkipFilenameField |
FieldFlags.dtsoFfSkipDocumentProperties;
Is there any way to pass this xml data or a translation to PDF XChange Viewer to have it do similar highlighting?
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
I guess another way to ask the question is: "Does PDF XChange Viewer support Adobe's PDF hit highlighting API."
- Also, we are developing for Vista 64.
- Also, we are developing for Vista 64.
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Highlighting words/phrases in PDF XChange Viewer
This possibility can be added into the next build (NBuild>=41) as:Is there any way to pass this xml data or a translation to PDF XChange Viewer to have it do similar highlighting?
AX(32|64)->HighlightText(XMLFile, Flags);
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
That sounds great. What is the probability of that happening and do you have any idea of the time frame?
-
- Site Admin
- Posts: 5223
- Joined: Tue Jun 29, 2004 10:34 am
Re: Highlighting words/phrases in PDF XChange Viewer
It will be added into build 41 and this should be available in late January or possibly before,
Hope that helps.
Hope that helps.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Thanks. That will certainly work for us.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
By the way, just as a nice-to-have, but certainly not a requirement, is there any way that the XML file could be used to create the same kind of search window for multiple hits that you currently have? That is, as an alternative to highlighting multiple hits in the PDF?
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Highlighting words/phrases in PDF XChange Viewer
The full search and highlight functionality will be added into the next build (NBuild > 41).
Thanks.
For now there is no window similar to the existing search window. In the future you will be able to use the search results (which will be contain complete info) for representation in your UI...is there any way that the XML file could be used to create the same kind of search window for multiple hits that you currently have? That is, as an alternative to highlighting multiple hits in the PDF?
Thanks.
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
I'm looking at build 41 and don't see any HighlightText() function. How is highlighting supposed to be done now?
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Highlighting words/phrases in PDF XChange Viewer
This feature is ready for usage.
We will to update AX help today, samples for this will be included also..
Please wait for new help.
We will to update AX help today, samples for this will be included also..
Please wait for new help.
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Look to new AX Help, bookmark:
Reference\Named Items\Named Objects\Documents\<Item>\Pages\<Item>\Text
Reference\Named Items\Named Objects\Documents\<Item>\Pages\<Item>\Text
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- Site Admin
- Posts: 5223
- Joined: Tue Jun 29, 2004 10:34 am
Re: Highlighting words/phrases in PDF XChange Viewer
Unchecked help file sent by email.
This will be added to the SDK download on Thursday - once checked/edited.
This will be added to the SDK download on Thursday - once checked/edited.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
I got the .chm file. It appears I should be using C# code such as:
try
{
AxCoPDFXCview1.DoVerb("Documents[#4095].Pages[0].Text",
"Highlight",
new x(1,
10,
0x800080,
0.65),
out dataOut,
0);
}
catch (Exception ex)
{
TraceErrorMessage(ex, out nRes);
if (zShowErrorMessage)
ShowErrorMessage(ex);
}
But this returns "Wrong Operation". Can you tell me what, if anything, is wrong with it?
try
{
AxCoPDFXCview1.DoVerb("Documents[#4095].Pages[0].Text",
"Highlight",
new x(1,
10,
0x800080,
0.65),
out dataOut,
0);
}
catch (Exception ex)
{
TraceErrorMessage(ex, out nRes);
if (zShowErrorMessage)
ShowErrorMessage(ex);
}
But this returns "Wrong Operation". Can you tell me what, if anything, is wrong with it?
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
BTW, just for test purposes, for the above code x is defined as:
class x {
private long first;
private long count;
private long color;
private double opacity;
public x(long zFirst,long zCount, long zColor, double zOpacity)
{
first = zFirst;
count = zCount;
color = zColor;
opacity = zOpacity;
}
class x {
private long first;
private long count;
private long color;
private double opacity;
public x(long zFirst,long zCount, long zColor, double zOpacity)
{
first = zFirst;
count = zCount;
color = zColor;
opacity = zOpacity;
}
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Highlighting words/phrases in PDF XChange Viewer
To pass more arguments through DoVerb you should pack them to an array of object's (that is to SAFEARRAY, as described in AX Help):
Code: Select all
object dataIn = null;
object dataOut = null;
object[] args = new object[4];
args[0] = 1;
args[1] = 10;
Color c = Color.FromArgb(0,0,255);
args[2] = ColorTranslator.ToWin32(c);
args[3] = 0.75;
dataIn = args;
AxCoPDFXCview1.DoVerb("Documents[#4095].Pages[0].Text", "Highlight", dataIn, out dataOut, 0);
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
OK, I got this to work. However, there is a MAJOR problem. Your offsets don't conform to the Adobe PDF Hit Higlighting Standard. So, the offsets returned by dtSearch don't work when they are passed to your routines. Is there any work-around?
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Highlighting words/phrases in PDF XChange Viewer
As I understand, here can be problem: for collect all text from document, we used own mechanism of text-collecting (this mechanism is undocumented, no Adobe documentation for it).
For test this case, please send me example of search results which received by you from dtSearch engine, and your code for highlights these results.
Also, in near future I planning to present AX-interface of own search engine..
Thanks.
For test this case, please send me example of search results which received by you from dtSearch engine, and your code for highlights these results.
Also, in near future I planning to present AX-interface of own search engine..
Thanks.
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Well you stated at the top of the thread that would provide an API that would support Adobe's PDF Hit Highlighting Standard. So, that was very disingenuous and misleading.
dtSearch is probably the most widely used search engine for PDF files and it is not likely that you will be able to compete with them any time soon. It would make you far more competitive to provide compatibility with dtsearch, by supporting the Adobe standard. It appears however, that you are taking the same path as Foxit in this regard - and I don't see that as an advantage.
We have large amounts of files to search and index and are dependent on dtSearch. Therefore, it looks like our only alternative here is to simply provide a 32 bit version of our program for Vista 64 until Adobe comes out with a native 64 bit version of Reader.
dtSearch is probably the most widely used search engine for PDF files and it is not likely that you will be able to compete with them any time soon. It would make you far more competitive to provide compatibility with dtsearch, by supporting the Adobe standard. It appears however, that you are taking the same path as Foxit in this regard - and I don't see that as an advantage.
We have large amounts of files to search and index and are dependent on dtSearch. Therefore, it looks like our only alternative here is to simply provide a 32 bit version of our program for Vista 64 until Adobe comes out with a native 64 bit version of Reader.
-
- Site Admin
- Posts: 3586
- Joined: Thu Jul 08, 2004 10:36 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Let make clear what would you like to have: just a function which will take XML file (or memory buffer with XML) as argument and makes highlighting?
Ok, but in this case there is problem - we cannot guaranty than indexes of words/chars will be the same into our viewer and into Adobe. (if dtSearch uses adobe library for working with PDF files, for sure, indexes will be the same into Adobe and dtSearch. But we don't use adobe library).
Ok, but in this case there is problem - we cannot guaranty than indexes of words/chars will be the same into our viewer and into Adobe. (if dtSearch uses adobe library for working with PDF files, for sure, indexes will be the same into Adobe and dtSearch. But we don't use adobe library).
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
I think the second post in this thread made it clear that dtSearch supports the Adobe Pdf Hit Highlighting Standard. That's why the dtSearch XML output file of offsets can be fed directly to Adobe.
In fact, your highlighting function is totally useless - since you don't provide the means for acquiring meaningful offsets. It currently has no purpose for anyone outside of your company.
So, you really need to read and follow the Adobe Pdf Hit Highlighting Standard if you want to be compatible with dtSearch and other tools which use the standard.
For test purposes, make sure to use Pdf files with image and other embedded data. It would seem you could get an eval version of dtSearch for test purposes.
Bert Craytor
In fact, your highlighting function is totally useless - since you don't provide the means for acquiring meaningful offsets. It currently has no purpose for anyone outside of your company.
So, you really need to read and follow the Adobe Pdf Hit Highlighting Standard if you want to be compatible with dtSearch and other tools which use the standard.
For test purposes, make sure to use Pdf files with image and other embedded data. It would seem you could get an eval version of dtSearch for test purposes.
Bert Craytor
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Ok. We understand you.
We will to support #xml parameter in input URL when document opening (as described in http://www.adobe.com/devnet/pdf/pdfs/Hi ... Format.pdf).
Please wait 1-2 days.
We will to support #xml parameter in input URL when document opening (as described in http://www.adobe.com/devnet/pdf/pdfs/Hi ... Format.pdf).
Please wait 1-2 days.
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Well, per the standard the recommended offsets are in characters. If I called your existing function with offset = 0, it would often land on the 3 or 4th character. So, you would have to change your offset to reflect the actual character (page,character offset, character length) position, i.e. offset= 10 means the 10 character on the page. - Just to be clear.
-
- Site Admin
- Posts: 3586
- Joined: Thu Jul 08, 2004 10:36 pm
Re: Highlighting words/phrases in PDF XChange Viewer
While methods (algorithm) of reconstruction text from PDF page isn't standardized (yes, sequence into which text is shown of PDF page isn't the same as this text is written into content of PDF page), we cannot say that the character (or word) with our index, say, 10, will be the same as into Adobe.
In other words, it is impossible to say that Adobe's hit-highlight format is a standard.
In other words, it is impossible to say that Adobe's hit-highlight format is a standard.
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
dtSearch has been able to generate the XML files which work just fine with Adobe Reader (32Bit). So, it's doable. Maybe you could contact them and get some information to allow your product to be compatible with theirs.
-
- Site Admin
- Posts: 3586
- Joined: Thu Jul 08, 2004 10:36 pm
Re: Highlighting words/phrases in PDF XChange Viewer
We will try. But if the are using Adobe PDF Library for extracting text from PDF files, it is "roadblock".
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 17
- Joined: Thu Dec 18, 2008 9:04 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Has there been any update to highlighting?
-
- User
- Posts: 7
- Joined: Sat Dec 03, 2011 9:58 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Hi to the developers and everybody else
Thanks for creating such a great software, I am loving it... The only problem so far is described by the links below
and after searching your website I decided to post in this thread instead of creating a new one. I hope that I am on topic
I am coming from
http://support.dtsearch.com/dts0229.htm
and
http://support.dtsearch.com/webhelp/dts ... files.html
I am trying to understand if this information is correct on their web site and your viewer is not compatible with this desktop search engine in this sense.
Have you made any progress with this feature?
thanks a lot
PF
Thanks for creating such a great software, I am loving it... The only problem so far is described by the links below
and after searching your website I decided to post in this thread instead of creating a new one. I hope that I am on topic

I am coming from
http://support.dtsearch.com/dts0229.htm
and
http://support.dtsearch.com/webhelp/dts ... files.html
I am trying to understand if this information is correct on their web site and your viewer is not compatible with this desktop search engine in this sense.
Have you made any progress with this feature?
thanks a lot
PF
-
- Site Admin
- Posts: 19885
- Joined: Mon Jan 12, 2009 8:07 am
Re: Highlighting words/phrases in PDF XChange Viewer
Hello PF4PDFX,
You have posted in a developer topic, and the answer to the (older) developer question is that the function mentioned by Vasyl was implemented as HighlightTextByFile in our Viewer AX.
For the moment our end user Viewer will most likely not work with the dtSearch highlighter, but we are working on a new major version of our Viewer:
https://forum.pdf-xchange.com/ ... hp?t=10100
Which when released will support plug-ins, and I will now pass this to our devs, and we could contact dtSearch and ask them if they are interested in creating such a plug-in for our Viewer as they have done for Adobe X.
Best,
Stefan
You have posted in a developer topic, and the answer to the (older) developer question is that the function mentioned by Vasyl was implemented as HighlightTextByFile in our Viewer AX.
For the moment our end user Viewer will most likely not work with the dtSearch highlighter, but we are working on a new major version of our Viewer:
https://forum.pdf-xchange.com/ ... hp?t=10100
Which when released will support plug-ins, and I will now pass this to our devs, and we could contact dtSearch and ask them if they are interested in creating such a plug-in for our Viewer as they have done for Adobe X.
Best,
Stefan
-
- User
- Posts: 7
- Joined: Sat Dec 03, 2011 9:58 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Hi StefanTracker Supp-Stefan wrote:Hello PF4PDFX,
You have posted in a developer topic, and the answer to the (older) developer question is that the function mentioned by Vasyl was implemented as HighlightTextByFile in our Viewer AX.
For the moment our end user Viewer will most likely not work with the dtSearch highlighter, but we are working on a new major version of our Viewer:
https://forum.pdf-xchange.com/ ... hp?t=10100
Which when released will support plug-ins, and I will now pass this to our devs, and we could contact dtSearch and ask them if they are interested in creating such a plug-in for our Viewer as they have done for Adobe X.
Best,
Stefan
Thanks for replying. I am not sure if I understand what you mean by Viewer AX, I could not find this listed on your product list.
Is this some sort of developer library or API?
thanks
PF
-
- Site Admin
- Posts: 19885
- Joined: Mon Jan 12, 2009 8:07 am
Re: Highlighting words/phrases in PDF XChange Viewer
Hello PF,
Yes this is a developer product. And as you posted in a developer topic - I did include that information in my reply for all developers that could read this topic.
As for when/if this can be implemented in our end user Viewer - we will need to check this with dtSearch directly and see if they are interested in developing a plug-in for our upcoming Viewer.
We will keep you posted here in this topic with any news on the subject.
Best,
Stefan
Yes this is a developer product. And as you posted in a developer topic - I did include that information in my reply for all developers that could read this topic.
As for when/if this can be implemented in our end user Viewer - we will need to check this with dtSearch directly and see if they are interested in developing a plug-in for our upcoming Viewer.
We will keep you posted here in this topic with any news on the subject.
Best,
Stefan
-
- User
- Posts: 7
- Joined: Sat Dec 03, 2011 9:58 pm
Re: Highlighting words/phrases in PDF XChange Viewer
Tracker Supp-Stefan wrote:Hello PF,
Yes this is a developer product. And as you posted in a developer topic - I did include that information in my reply for all developers that could read this topic.
As for when/if this can be implemented in our end user Viewer - we will need to check this with dtSearch directly and see if they are interested in developing a plug-in for our upcoming Viewer.
We will keep you posted here in this topic with any news on the subject.
Best,
Stefan
Now it is clear, I will patiently wait for the day when that feature will be available to mortals.
In the mean time I will just add here the fact that if you have Adobe Acrobat Reader installed on your system but Xchange PDF viewer configured as Default PDF viewer then you will be OK
dtSearch will use Acrobat Reader to show you where the keyword is (highlighting working) but if you double click on the doc it will be open in the default viewer (XCahve PDF). That is acceptable for now
thanks for the quick reply
PF
-
- Site Admin
- Posts: 19885
- Joined: Mon Jan 12, 2009 8:07 am
Re: Highlighting words/phrases in PDF XChange Viewer
Hello PF,
Thanks for the hint about using both products
And thanks for the patience!
Cheers,
Stefan
Thanks for the hint about using both products

And thanks for the patience!
Cheers,
Stefan