Choose between linking PDF files or Mark of the Web? Really?

This forum is for all Flare issues not related to any of the other categories.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Choose between linking PDF files or Mark of the Web? Really?

Post by parsonsv »

Is it true that I have to choose one or the other, but I can't have both?

1) Attached PDF files to my TOC that open in Adobe Reader from my WebHelp output

or

2) Mark of the Web turned on in my compiled WebHelp to keep the user from seeing the script message every time they run my help file

I want both. I want to add some quick starts and release notes into my table of contents that my users can open, and I don't want that stupid message to appear every time they open my help (I have older users who will freak out if they see messages about potentially unsafe files).

Currently, I have MOTW turned on, and my links to the PDF aren't working. I thought I heard somewhere that I can't have those links unless I turn off MOTW. Does anyone know for sure. If that is true, does anyone know a workaround or hack that I can use to resolve this?

Thanks
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by LTinker68 »

False for Firefox (which doesn't need MOTW, so it's a moot point). True for Internet Explorer.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by LTinker68 »

I found a workaround that works with Flare and the users won't get the warning message. I tested it in IE6 and Firefox and it works. Someone else will have to test in IE7.
  1. Copy the PDF to a location in your project. In the example below, I put it in a folder called "Docs" located in the Resources folder.
  2. Create a new topic that will be the container for the PDF file.
  3. Open the PDF container file using the Internal Text Editor. Replace all of the page code (including the XML and MadCap schema lines) with the code below.
  4. Replace the src tag in the embed line with the path and name of the PDF file.
  5. Save the topic.
  6. Compile the help.
When you look at the PDF container topic in the XML Editor, all you'll see is a little square in the upper left corner and nothing else. That's fine -- the contents will be replaced with the PDF when you compile the help.

Code for the PDF container page:

Code: Select all

<!-- saved from url=(0014)about:internet -->
<html style="margin:0;padding:0;">
<head>
<title>PDF</title>
</head>
<body>
<embed src="Resources/Docs/brochure.pdf" width="100%" height="100%"></embed>
</body>
</html>
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by parsonsv »

Thanks for trying. I am using IE7. When I create the link as suggested, I get a blank page. When I hover over the page, I see an outline of a box and I get the message to "Click here to activate this control". I click, the box goes away, but the page stays blank. So sad :( Thanks for trying!

My method, in case you see something that's perhaps an error on my part, was to create a topic called "Test". I then opened that topic in the text editor and replaced all the code inside with your code. I edited the path to the location of my PDF file, which I stored in a Content | LinkedDocs folder within my project.

Then, I rebuilt the project, published my output, and ran my project from the publish location on my local drive. That's when I encountered the empty page.
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by LTinker68 »

From what I've read on the web, the MOTW is still supposed to work in IE7 like it did in IE6. Make sure you delete the Output folder before compiling again, and it wouldn't hurt to clear the browser cache and history.

I just tried moving my Docs folder to the root instead of under Resources, and it still worked, so it's not that. Do you have any spaces or special characters in the PDF's file name? It's generally not a problem with regular hyperlinks if the destination file name has spaces in it, but maybe it's a problem when you're using the embed tag. (I don't put spaces in my file names due to the fact that some browsers and servers don't like spaces or don't handle them consistently.)
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by parsonsv »

It works! I deleted the Ouput and Publish folders. I had to move the LinkedDocs folder directly into the topic folder that contained my dummy topic with the embedded code. So, it's obviously a path problem for me. The current code must mean the topic and file are in the same root location. Mine was like this:

Topic location: Content | Topics | General | Test.htm (this topic contains my embed code)

PDF location: Content | LinkedDocs | ReleaseNotes.pdf (this is the PDF file I wanted to embed in my Test.htm topic)

When I moved my LinkedDocs folder with the PDF file inside it to this location: Content | Topics | General (same location as the Test.htm file), then my PDF successfully embedded in the output.

Thanks for your help Lisa

Oh - and for anyone reading this post, I also talked with Scott Deloach, and he told me that if you run WebHelp from a Web server (which we do for some of our help), then you do not need to turn on MOTW. So, this workaround is unnecessary for those people.
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by LTinker68 »

parsonsv wrote:Oh - and for anyone reading this post, I also talked with Scott Deloach, and he told me that if you run WebHelp from a Web server (which we do for some of our help), then you do not need to turn on MOTW. So, this workaround is unnecessary for those people.
And in some cases, having MOTW enabled when you run from a web server actually causes problems with the display.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Richard Ferrell
Propellus Maximus
Posts: 840
Joined: Mon May 01, 2006 10:11 am
Location: Inside California

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by Richard Ferrell »

Scott is correct, MOTW is not need if your help is on a websever. MOTW is only needed to turn off the activeX warning if your webhelp is on your local system.
Richard Ferrell

Certified Madcap Trainer
Image
jamesw
Propeller Head
Posts: 30
Joined: Thu Jan 04, 2007 7:21 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by jamesw »

Thank you LTinker68 for that excellent workaround!
I have a web help system deployed on a web server and also on local windows xp SP2 machines. I've got hyperlinks to external PDFs that weren't working locally and I was just about stuck after reading everything I could find about this issue. I implemented your workaround and the <embed> links to the PDFs are working just fine.
p.s. I have IE7
James Willoughby
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by RamonS »

Great workaround! Just to bad that we all have to do extra work just because Microsoft cannot code a web browser correctly. :roll:
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by parsonsv »

Hi all

Has anyone had any problems displaying the PDFs in Tinker's PDF containers, but only on some machines? I have two machines that either won't display the PDF file at all, or when they do display it, only 1/3 of the PDF shows in the window and there's no way to zoom into the book to read it. It's really weird. Has anyone experienced this?
Victoria Clarke
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by NorthEast »

Had a quick look at this and had some comments...
LTinker68 wrote:
  1. Copy the PDF to a location in your project. In the example below, I put it in a folder called "Docs" located in the Resources folder.
  2. Create a new topic that will be the container for the PDF file.
  3. Open the PDF container file using the Internal Text Editor. Replace all of the page code (including the XML and MadCap schema lines) with the code below.
  4. Replace the src tag in the embed line with the path and name of the PDF file.
  5. Save the topic.
  6. Compile the help.
As far as I can tell, you don't need step 3 at all - only step 4 ; i.e. the only thing you need to do is insert the embed tag.
The rest of the page code is unnecessary, you can include that embed tag in any ordinary topic.

Also, the MOTW tag would be included (or not included) in the page according to your target settings.
parsonsv wrote:Has anyone had any problems displaying the PDFs in Tinker's PDF containers, but only on some machines? I have two machines that either won't display the PDF file at all, or when they do display it, only 1/3 of the PDF shows in the window and there's no way to zoom into the book to read it. It's really weird. Has anyone experienced this?
I've get this in FireFox, but not IE.
I've not found an ideal solution yet, other than to set the height using absolute values (i.e. in px, not as a %).


Also you might find this useful:
http://www.adobe.com/devnet/acrobat/pdf ... meters.pdf

They're command parameters you can use with the PDF link; e.g. to switch off the toolbar use:

<embed src="test.pdf#toolbar=0" ... />
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by LTinker68 »

Dave Lee wrote:As far as I can tell, you don't need step 3 at all - only step 4 ; i.e. the only thing you need to do is insert the embed tag.
The rest of the page code is unnecessary, you can include that embed tag in any ordinary topic.
My original post was in response to the original request, which was to open a PDF as if MOTW wasn't enabled. If MOTW wasn't enabled and you clicked on a link to open a PDF then you'd see the PDF by itself, without any intro text or anything above it, so replacing the entire page code simulates that. If you want intro text above a PDF, then you could certainly just insert the embed code into a normal topic.

I should also mention after looking at the code again that if you're using a masterpage that has text or other items in it then those items would appear above and/or below the embedded PDF. If you don't want the masterpage elements on the PDF container page then you'd need to create a second masterpage without those items and apply that masterpage to the PDF container page.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by NorthEast »

LTinker68 wrote:My original post was in response to the original request, which was to open a PDF as if MOTW wasn't enabled. If MOTW wasn't enabled and you clicked on a link to open a PDF then you'd see the PDF by itself, without any intro text or anything above it, so replacing the entire page code simulates that. If you want intro text above a PDF, then you could certainly just insert the embed code into a normal topic.

I should also mention after looking at the code again that if you're using a masterpage that has text or other items in it then those items would appear above and/or below the embedded PDF. If you don't want the masterpage elements on the PDF container page then you'd need to create a second masterpage without those items and apply that masterpage to the PDF container page.
Not really, adding an embed code to a (blank) normal topic is actually no different to your suggestion. The only bit of your code that is doing anything (i.e. makes it into the output) is the margin/padding setting on the html tag.

However, you can't use the page code in your solution if you use any master page at all - that's why I couldn't work out why you needed it.

When the master page is applied (which includes topics without Flare's XML tag), then only the content inside the body tag is included in the output page - i.e. it would not include the margin/padding or the MOTW tag (which is never passed through anyway).

Anyway, I'd just use the embed tag in a normal page, and if you need special margin/padding settings, set those in the master page (not the topic, as they're not included).
matuszed
Jr. Propeller Head
Posts: 4
Joined: Wed Jul 29, 2009 2:23 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by matuszed »

Is there any way to easily re size the embed tag to fit the full size of the browser
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by LTinker68 »

The height and width are already set to 100%, so it'll fit the size of the browser. That said, I haven't tested/compared IE to Firefox to see if they both dynamically adjust the size as you resize the browser. Seems like IE -- or maybe just IE6 and lower -- didn't dynamically adjust DIVs or tables set to 100%, so it may not adjust the embed element either.

Or are you saying you want the embedded PDF to dynamically change its zoom level, depending on the size of the browser window?
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
matuszed
Jr. Propeller Head
Posts: 4
Joined: Wed Jul 29, 2009 2:23 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by matuszed »

I just want the size of the PDF Window to be the size of the body element when the page containing the PDF is opened. I used the code below to grab the windows size and then used those parameters to set the width and height of the embed tag to the window size. The window sizes are right but the embed tag (id="window") won't readjust in size. The code worked in the MadCap viewer but fell apart when I tried it in firefox.

var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
document.getElementById("window").style.height=myHeight;
document.getElementById("window").style.width=myWidth;
scooter262
Propeller Head
Posts: 37
Joined: Wed Mar 11, 2009 11:14 am

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by scooter262 »

Does this work in IE 8? I tried the workaround, and embedded a PDF, but it doesn't display, just the page outline with an "x" in the top left of the page.
alaltenburg
Sr. Propeller Head
Posts: 342
Joined: Mon Nov 03, 2008 9:33 am
Location: The heart of America

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by alaltenburg »

Is there a way to embed a pdf when using HTML help? I tried your suggestion, but when I view the output, I get a big block with a red X and am not sure what I am doing wrong. Thank.
Andrea
The Moon is the first milestone on the road to the stars.

— Arthur C. Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by LTinker68 »

Sorry, I don't build HTML Help and it's so old that it might not understand the code.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
alaltenburg
Sr. Propeller Head
Posts: 342
Joined: Mon Nov 03, 2008 9:33 am
Location: The heart of America

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by alaltenburg »

Can anyone tell me if this also works with HTML? I tried to embed the PDF into my project, but upon build, I get a red x like it cannot find the file. Thanks.
The Moon is the first milestone on the road to the stars.

— Arthur C. Clarke
rob hollinger
Propellus Maximus
Posts: 661
Joined: Mon Mar 17, 2008 8:40 am

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by rob hollinger »

I highly doubt HH.exe (HTML Help) can envoke an embedded PDF file. It would need access to Reader and that violates its security.
You can use a standard link to the PDF file and include it in the build. The down side to this is that the PDF file will have to be downloaded out of HTML Help to be opened in Reader (outside of the HTML Help file).
You should be able link to them outside the CHM file from the file system or hosted on a web-server provided the URLs are correct.
Rob Hollinger
MadCap Software
alaltenburg
Sr. Propeller Head
Posts: 342
Joined: Mon Nov 03, 2008 9:33 am
Location: The heart of America

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by alaltenburg »

I was afraid it would not work for HTML. The downside is that the computers will not have adobe reader access. Thank you.
The Moon is the first milestone on the road to the stars.

— Arthur C. Clarke
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by RamonS »

You could convert the PDFs to HTML and include that. I know, it is not the same, but it at least delivers the content.
alaltenburg
Sr. Propeller Head
Posts: 342
Joined: Mon Nov 03, 2008 9:33 am
Location: The heart of America

Re: Choose between linking PDF files or Mark of the Web? Really?

Post by alaltenburg »

I tried that last week, but the html when it is embedded had the text off of the images and looked like a little kid slapped it together the way it matched up. I did not like the output at all.
The Moon is the first milestone on the road to the stars.

— Arthur C. Clarke
Post Reply