'&' is encoded as '&' for external link in web viewer

30 views
Skip to first unread message

pra...@contentraven.net

unread,
Sep 20, 2017, 6:25:35 PM9/20/17
to PDFTron WebViewer
Need solution for the following scenario,

When i click on external link in the document. It is opened in a new tab. But '&' in the external link is converted into '&'.

Ex:

http://example.com/?product=1234&utm_source=google

Converted to

http://example.com/?product=1234&utm_source=google

I want the exact URL to be open in new tab. I need solution for this as soon as possible. Also i have attached XOD document for your reference.

URL : https://drive.google.com/file/d/0B-5SPduuq3YDVjdUSWJLbkFzSmM/view?usp=sharing

Note : It is working correctly in IE.

Matt Parizeau

unread,
Sep 21, 2017, 5:08:55 PM9/21/17
to PDFTron WebViewer
Would you be able to send the original PDF that generated that XOD file? This will allow us to determine if the problem is in the original PDF or in the conversion to XOD.

Re: IE, it seems like IE automatically formats & to & with window.open which is why it seems to work. For example https://jsfiddle.net/sc9ek049/

Matt Parizeau
Software Developer
PDFTron Systems Inc.

pra...@contentraven.net

unread,
Sep 22, 2017, 1:30:37 PM9/22/17
to PDFTron WebViewer
It is not PDF, it is Word Document. I have attached URL for original Word Document,

pra...@contentraven.net

unread,
Sep 25, 2017, 12:42:03 PM9/25/17
to PDFTron WebViewer
Need solution urgently.

Matt Parizeau

unread,
Sep 25, 2017, 2:19:08 PM9/25/17
to PDFTron WebViewer
We'll be continuing to investigate as there seems to be some inconsistent behavior. However for now you should be able to use the following code in a config file to override window.open to fix the URL.

var originalOpen = window.open;
window
.open = function(url, name, features) {
  url
= url.replace('&', '&');
  originalOpen
.call(this, url, name, features);
};

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Matt Parizeau

unread,
Sep 25, 2017, 3:11:36 PM9/25/17
to PDFTron WebViewer
How did you convert your docx to XOD? We've tried converting it on our side but didn't end up with the same XOD file that had the issue so the error might be in the particular method in which it's converted.

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages