Skip to main content
Prateek_T1
Participating Frequently
October 3, 2013
Question

RH10 - Hyperlink an external pdf to chm file

  • October 3, 2013
  • 1 reply
  • 3624 views

Hi,

I am Prateek, India. I am a technical writer & am working on RoboHelp. I am facing few issues with hyperlinks.

Let me straight away take to a scenario:

I have generated a chm file, name: "dynamic.chm" ( folder: D\Dynamic)

In this chm there are 3 links. viz: one.pdf, two.pdf, three.pdf ( folders random & each pdf is 50kb)

When I generated a chm file without giving hyperlinks, the size was 50kb.

I gave hyperlinks in a standard(robohelp -> create a project -> topic1 -> some text -> create hyperlink -> link to dropdown -> file -> select a pdf from a location) manner and generated chm output, the size was about 200kb.

My requirement: While having the chm size at 50kb, I need all the 3 hyperlinks to work fine. How can this be done?

Is there anyway where we can dynamically hyperlink the pdf files to the content?

As like in a word document, while giving hyperlink we provide "same folder", is there any option in RH? - I mentioned this because, we will be having a whole set of 100 documents in a single folder, and we will place the help file in the same folder. So, whenever a hyperlink is clicked, it must trigger the related .pdf file.

Thanks a lot in advance.

Regards,

Prateek Thungathurthy

This topic has been closed for replies.

1 reply

RoboColum_n_
Legend
October 3, 2013

Hi Prateek.

By linking to a PDF as you have, the file is added as a baggage file inside your project. That is why the CHM file increases. If you want to maintain the CHM size at 50kb you'll have to host the PDFs somewhere and hyperlink by adding a URL to them. That way the files are NOT part of the project.

Out of interest, why is 200kb such a big issue?

Prateek_T1
Participating Frequently
October 4, 2013

Hi,

Thanks for your reply.

Got your point. But let me be more specific with the actual scenario.

We need to deliver a customer a set of files. These files are clubbed in a folder called "user". The user folder contains "300+ pdfs and 2 chms". Each chm has about 100 or so links to pdfs. We will add more links in future though.

These chms(when generated) should contain only the links, but not embedded, so that whenever I click on a link, it should pull the pdf from these 300+ pdfs. Can be be done? If yes, please let me know the process too.

*I am not sure how we give the "user" folder to the customer. It may be through a hard disk/server access/something else.

For now, we have the 'user' folder in SVN repository.

Second part, 200kb is really not a concerning factor, but that was just an example. our chms(embedded) have crossed 1.2gb already. We want to cut down the weight.

Regards.

Prateek_T1
Participating Frequently
October 17, 2013

How are you linking to the PDFs? Are you using the above Shortcut method?
Can you post the HTML code and any scripting you're using?


Hi JeradHess,

My issue got cleared and its dynamically pulling the pdf file from the desired location.

However for your reference, the following is a javascript file. MyConfig.js

function myFunction()

{

var sHref = document.getElementById('link').href;

sHref  = sHref.substring(sHref.lastIndexOf('/') + 1);

var path = "file://Server location";

sHref  = path.concat(sHref);

document.getElementById('link').href = sHref;

}

----

This is the html content in the tool.

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Adobe RoboHelp 10" />
<title>Oscar Award</title>
<link rel="StyleSheet" href="default.css" type="text/css" />
</head>

<body>
<script src="MyConfig.js" type="text/javascript"></script>
<h1 style="color: #008080;">Oscar Award</h1>
<p><img src="Camera.jpg" alt="" style="border: none;" width="80" height="85"
   border="0" />The Academy Awards, commonly known as <span style="font-weight: bold;">The
Oscars</span>, are a set of awards given annually for excellence of cinematic
achievements. The Oscar statuette is officially named the Academy Award
of Merit.</p>
<p>&#160;</p>
<p>For more info on Oscars --&gt;

<a id="link" href="Oscars.pdf" onclick="myFunction()" target="_blank">Oscars and Details</a>

</p>
</body>
</html>

---

Bolded words description...

  1. The scricpt src calls the .js file.
  2. The .js file is added as a baggage file to the robohelp project.
  3. Place all the pdf files in the sever location. (ex. Oscars.pdf, booker.pdf, nobel.pdf, etc.)
  4. sHref  = path.concat(sHref); --> This will cancatenate the server location and the file name and then pulls the desired file (oscars.pdf in this case)
  5. When you click on Oscars hyperlink, the myFunction() method of MyConfig.js is called.

Note: Make sure the user has all rights to the server. (read / write / copy - Full Access)

This helped me.

Regards.