[thelist] PDF page with close button

Chris at globet.com Chris at globet.com
Wed Apr 5 11:53:32 CDT 2006


Michael

[..]

>   I need to be able open up a pop-up window from each of 39 
> different links on a page to display various different 
> specific sections of a large pdf file.  The resulting page 
> needs to have a Close button on it.

Even though there is a close button in the top right-hand corner of the
browser window?

>   <a href="rm1001nonb.pdf#nameddest=naf" Target="_blank">
>
>   The above gets me a pop-up window with my specific page in 
> the pdf file displayed, but I am not sure what the best 
> method is, to get a Close button on the page.
>
>   I was thinking frames, but how do I open a frameset with a 
> close button in one frame and 1 of 39 different pdf sections 
> in the other?  I could do it with 39 different frame sets, 
> but I was kind of hoping one of you js gurus might have a 
> more elegant, less repetitive solution.  

Have you got access to a server-side scripting technology? If so, you
could specify an id for each PDF, and then display the appropriate PDF
according to the id. So, your anchor tag would look something like the
following:

<a href='pdfFrame.asp?id=1' target='_blank'>..</a>

The file pdfFrame.asp (or php, or whichever technology you're using)
would then have some logic along the following lines:

// Get id from querystring
// Find pdf filename for id from data structure (text file, database,
array etc.)
// Output HTML, including the correct PDF file path as a frame src
attribute value

>   My gut tells me that this is possible in js, but my brain 
> isn't getting me the rest of the way there, and neither is my 
> searching the web.

It would be possible using similar logic to that shown above, but you
would have to work very hard to make it accessible. Instead of
outputting the HTML, though, you could use the DOM to change the value
of the src attribute of the frame to reflect the path to the PDF. Ensure
that you do not allow XSS exploits if you take this route
<http://en.wikipedia.org/wiki/XSS>.

Personally, I would argue that (IMHO) a PDF is not a webpage, and trying
to treat it as such will lead to nothing but woe. Don't forget that a
system like this will only work for browsers that are configured to
display a PDF, the rest will only offer a download anyway.

HTH

Chris Marsh
Web Developer
http://www.globet.com/
Tel: +44 20 8246 4804 Ext 828
Fax: +44 20 8246 4808

Any opinions expressed in this email are those of the individual and not
necessarily the Company. This message is intended for the use of the
individual or entity to which it is addressed and may contain
information that is confidential and privileged and exempt from
disclosure under applicable law. If the reader of this message is not
the intended recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly prohibited.
If you have received this communication in error, please contact the
sender immediately and delete it from your system. 



More information about the thelist mailing list