Forum How do I...?

Cross-references with ambiguous targets

jerkob
I have a PDF that needs intra-PDF links, but where the item to be linked to may or may not exist in the PDF. For example, we have issues and equipment. The user can include one or both of those in the PDF they generate. If they choose both, then any references to equipment in the issues section should be a link to that page, and vice versa. However, if they only choose to print issues then references to equipment should not be a link.

It would be problematic for us to determine whether the item should be a link or not while generating the content, so we would rather handle this via CSS rules or some sort of post-processing. Is this possible with cross-references? Or is there another solution that you would recommend? We have discussed post-processing via JavaScript as well as a modernizr-style technique of setting attributes on the body specifying included items and then using CSS rules to target the display property of the links based on the presence (or not) of those attributes.
mikeday
CSS generated content may be sufficient for what you want to do, if combined with the prince-script() extension that allows you to pass generated content values to JavaScript and manipulate them.
Chella
Hi,

I want to generate cross-reference with these two elements in the PDF like below

<a title="t1">Test</a>

<div id="t1>Test is a cross reference</div>

While am clicking the anchor link it should go to the corresponding div id attribute element.

Can I achieve this in pdf using prince. is it possible can u give me some example.

Thanks & Regards,
Chella|TNQ Technologies
+91 98 84 504995

mikeday
Use <a href="#t1">Test</a>
Chella
Hi Mike,

I want to know without changing the html content can I set cross-reference? I have checked actual example it was working in pdf. I just want to know is this possible?

Thanks & Regards,
Chella|TNQ Technologies
+91 98 84 504995

mikeday
Ah you could use CSS, like this:
a[title] { prince-link: attr(title, idref) }