开发者

Relative Links in PDF

开发者 https://www.devze.com 2023-01-03 01:18 出处:网络
Need some advice on what course of action to take next. Have written an ASP.Net application. Part of the application deals with being able to view PDFs. The initial PDF viewed acts as an index to acc

Need some advice on what course of action to take next.

Have written an ASP.Net application. Part of the application deals with being able to view PDFs. The initial PDF viewed acts as an index to access other PDF documents. You click a link in the Index PDF and it jumps to another PDF file. Legal documents, agreements, etc.

This scenario works on some computers and on others it doesn't. I managed to figure out what the problem was. On some of the computers the initial Index PDF was being hosted within the browser and on some other computers it was actually jumping out of the browser and directly into Adobe Acrobat. As soon as the PDF jumps out of the browser and into Acrobat the relative links in the Index PDF stop working because it is hosted client side via Acrobat but the additional PDFs it is trying to access are on the server.

I figured out why some computers stay in browser and why some jump out. There is an option within Acrobat itself that determines this behavior. It is under Edit--> Preferences ----> Display PDF in Browser.

I am in a jam because I am not in control of the PDF documents themselves and how they are written, and I obviously have no control over the options selected in Acrobat on each and every computer. My problem is also compounded by the fact that our firm has just recently purchased a new PDF reader called Nuance that will be pushed out firm wide soon and I don't think it even has the option to have PDFs hosted in browser.

I can get what I need to work if I create the index in HTML, but the problem is I don't write the Indexes and the people who do are not trained in HTML. I can get the people who write the indexes to change from relative开发者_StackOverflow社区 links to absolute links, but then I run into the problem of what if we change where we are hosting the PDF files? All the links will break again? I think we are stuck with relative URLs, but how can I make it work?

I am thinking about maybe hosting the PDFs within Silverlight?

Looking for any thoughts or ideas?

Thanks.


Silverlight isn't going to help you here.

The solution really is in finding a better way to create the index document. Just how sophisticated is the index document content anyway?

If you don't want to have to train the authors of these indexes in HTML then can you provide them with a simple tool that they can use to describe the content. You could then have code server side to generate the HTML (even PDF) dynamically.


What you need is a simple redirector ASPX page whose URLs you can use in the PDF documents. Put the paths of the PDFs in a database. Give an ID for each PDF. The ASPX page should accept the ID as a parameter, do a lookup on the database, and response.redirect to the current location of the PDF. You can use URLs based on this ASPX page in the PDFs. If you keep database up to date, then the links in the PDF documents will always lead to the correct location.

In the Database

  1. http://someserver/somepath/abc.pdf
  2. ttp://anotherserver/apath/sdf.pdf

Links in the PDF documents

  1. http://yoursite.com/pdf_redirect.aspx?id=1
  2. http://yoursite.com/pdf_redirect.aspx?id=2
0

精彩评论

暂无评论...
验证码 换一张
取 消