Forum How do I...?

href for div,td, th and tr elements?

JohnClarke
I'm able to do something like this:
_img src="photo.gif" href="#somelocation" />


But I can't seem to get the following to work:
_td href="#someotherlocation">Some content</td>

or
_div href="#someotherlocation">Some content</div>

or
_span href="#someotherlocation">Some content</span>

*-- note that I've replaced the initial < with _ due to this forum's parser

I want to be able to specify an element such that it becomes a PDF link. Is this possible?

-John

John Clarke
Cornerstone Systems Northwest Inc.

Lynx
Try CSS
[href]
	{prince-link:attr(href)}



The following example seems to work fine in Prince:

<html>
<head>
<title>CSS Linking extensions</title>
<style>
[href]
	{prince-link:attr(href)}
</style>
</head>
<body>
<div href='http://princexml.com'>link</div>
</body>
</html>

Edited by Lynx

mikeday
Just a quick note: if you toggle "Disable HTML in this post" then the forum will not eat your tags. I'm not sure why this behaviour isn't on by default.
JohnClarke
Thanks Lynx,
Yes, this worked for TD and TH (which is great!). However, I couldn't get it to work for TR. Perhaps this is due to TR being "behind" the TD. The reason for wanting this is to have the visual effect of selecting an entire table row on click rather than just a single cell when viewing the PDF in Acrobat.
-John

John Clarke
Cornerstone Systems Northwest Inc.

alyda
am i to understand that this person is attempting to link to anchors within their page/xml file ? because that is what i am trying to do. i have a list of xml files generated into one pdf and i have made a visual table of contents. in trying to link it up with the correct data here's what i've done:



<toc>
      <h3>Table of Contents, click on a box to be taken the corresponding information.</h3>
      <ol>
        <a href="A. Identification (Adult)"><li>A. Identification</li></a>
        <a href="B. Emergency Contact #1 (Adult)"><li>B. Emergency Contact #1</li></a>
        <a href="B. Emergency Contact #2 (Adult)"><li>B. Emergency Contact #2</li></a>
        <a href="C. Healthcare Provider #1 (Adult)"><li>C. Healthcare Provider #1</li></a>
        <a href="insuranceProviders.pdf"><li>D. Insurance Providers #1</li></a>
        <a href="legalDocuments.pdf"><li>E. Legal Documents / Medical Directives #1</li></a>
        <a href="F. Medical History (Adult)"><li>F. Medical History</li></a>
        <a href="G. Infectious Diseases (Adult)"><li>G. Infectious Diseases</li></a>
        <a href="H. Immunizations (Adult)"><li>H. Immunizations</li></a>
        <a href="I. Allergies / Drug Sensitivities (Adult)"><li>I. Allergies / Drug Sensitivities</li></a>
        <a href="J. Family Member History (Adult)"><li>J. Family Member History</li></a>
        <a href="K. Lifestyle (Adult)"><li>K. Lifestyle</li></a>
        <a href="L. Health Log (Adult)"><li>L. Health Log</li></a>
        <a href="M. Medications (Adult)"><li>M. Medications</li></a>
        <a href="O. Hospitalizations (Adult)"><li>O. Hospitalizations</li></a>
        <a href="P. Surgeries (Adult)"><li>P. Surgeries</li></a>
        <a href="Q. Lab or Imaging (Adult)"><li>Q. Lab or Imaging</li></a>
        <a href="U. Dental Health (Adult)"><li>U. Dental Health</li></a>
        <a href="N. Doctor Visits (Adult)"><li>N. Doctor Visits</li></a>
        <a href="R. Medical Devices (Adult)"><li>R. Medical Devices</li></a>
        <a href="T. Vision (Adult)"><li>T. Vision</li></a>
        <a href="S. Physical / Occupational Therapy (Adult)"><li>S. Physical / Occupational Therapy</li></a>
        <a href="soap:Body"><li>Scanned Documents</li></a>
      </ol>
    </toc>


now i have added

[href] {prince-link:attr(href)}


to the css, and it is creating links, but it thinks they are external, i do have 2 external files ( D and E above and they work as they should)

essentially, how can i link to an ANCHOR in xml? here's the xml i'm working with http://www.jestercom.net/prince/TableofContents.xml

also, the last element in the table of contents will need to link to a page that has not yet been created, how can i make sure that the last link links to the page number that logically follows the last page number of the prince-created document? in other words, IF prince makes a 26-page document, how do i make the last link link to page 27 (without hard-coding since i'll never know how many pages there will be)
mikeday
Use an ID attribute on the link target, place a hash before it on the link source href, and ensure that the ID is one word with no spaces. eg.
<a href="#chapter_seven">link to chapter seven</a>
...
<chapter id="chapter_seven">
mikeday
Oh, and I don't think it's possible to generate a page number outside the document yet. You can get the page number of the last page of the document with the pages counter; perhaps in the future we can provide a method to add one to this?