I have a couple of .chms developed with RH 7. In these, I have a couple of merged CHMs that contain topics whose only function is to launch a PDF file.
The HTML/JS code that does this is below. It is not clear to me that this code has anything to do with what I am seeing. I don't know where the script came from. If there is a better way, please share it!
My prefererence is to have the PDF launched within the CHM's window frame. And it does do this, but only when the CHM is launched by another program. So if you view the "primary layout" from withing RH and select the topic, the .pdf opens up right in the frame. This is also the case if the .chm is launched from our application executable using HTMLHelp() from the Windows SDK.
But, if you click on the .CHM file and open it directly from windows, when you select the topic that maps to the .PDF, the .PDF is opened in an independent launch of Adobe Reader, not in the .CHM frame.
Does anyone know why this works this way, and if there is a way to correct it? I would like the operator to be able to open the .CHM directly and still have the .PDF displayed within that frame.
Here is the HTML code that launches the .PDF:
<meta stuff blah blah blah...>
<h1 style="font-family: Arial, sans-serif;">External PDF</h1>
Here is the script:
var X, Y, sl, a, ra, link;
ra = /:/;
a = location.href.search(ra);
if (a == 2)
X = 14;
X = 7;
sl = "\\";
Y = location.href.lastIndexOf(sl) + 1;
link = 'file:///' + location.href.substring(X, Y) + fn;
location.href = link;