hyperlinks are broken after annotations import

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

hyperlinks are broken after annotations import

Post by Rene »

I have a pdf document with hyperlinks. When i load an document that hase some hyperlinks, the hyperlinks works perfect. But after i import some annotations the hyperlinks are broken. There is some weird rectangle arround the hyperlinks that causes this issue. When i move the rectangele, the hyperlink works again. For my end-users this workarround is not an option. Can anyone tell me why this rectangle appears but most important how i get rid of this rectangle when i import an annotation file.

i'v added some images to reproduce the issue.

tnx

René
Attachments
hyperlinks failure.zip
(276.29 KiB) Downloaded 145 times
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: hyperlinks are broken after annotations import

Post by Will - Tracker Supp »

Hi Rene,

Thanks for the post - I'm not seeing the same thing here, in my tests. I notice that you have posted in the SDK forum: is this being done programmatically, or are you importing the comments through the UI? Also, please detail how the links were created and provide a sample document with the hyperlinks and a sample FDF that contains the annotation information.

Cheers,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Will,

The import and export are done by code. So i tested the functionality in the user interface to be sure it has nothing to do with my code, but the UI has the same result. I use the C# full demo project for the ui testing.

The Links are made in Microsoft Word (out of the box nothing special). This morning i saw different behavior between importing an .fdf file and importing an .xfdf file. The .fdf file works fine, the .xfdf file fails. so i suppose there is something wrong with the xfdf format.

Please let me know, if the xfdf file also fails in your environment.

Rene
Attachments
sample documents.zip
(8.94 KiB) Downloaded 151 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinks are broken after annotations import

Post by Tracker Supp-Stefan »

Hello Rene,

there might be some differences in how the Viewer (and the ActiveX SDK) handle the two file types, so can you try via your own code to export and import the links using the .fdf format rather than .xfdf and let us know if that works?

Regards,
Stefan
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Stefan,

The problem is that we have to use the xfdf file because this file has a xml markup. In our code behind we use this xml to show or hide annotations based on the author in the xml tag.

The viewer we use is the Active x Component, so we have to export it as a xfdf file. You can find some code below of our solution.

That brings me back to my fist question of how i get ride of the rectangle. For me it's not a problem if i have to do something by code after importing the xfdf file to remove the rectangle(s), but then i have to know wat code i can use.

Rene

import code

Code: Select all

  [ComVisible(true)]
        public void ImportAnnotation()
        {
                axCoPDFXCview.RunJavaScript("this.importAnXFDF(\"" + jsAnnotation + "\")");
        }
export code

Code: Select all

       [ComVisible(true)]
        public void ExportAnnotation()
        {
            string userName = FileHelper.User;

            RemoveForeignAnnotation(userName);

            string annotation = string.Format(CultureInfo.InvariantCulture, "{0}\\{1}.{2}", FileHelper.TempFolder(), userName, "xfdf");
            
            string jsAnnotation = annotation.Replace("\\", "//");
            axCoPDFXCview.RunJavaScript("this.exportAsXFDF(true, true, null, \"" + jsAnnotation + "\", true)");
         }
Remove Foreign annotations

Code: Select all

         private void RemoveForeignAnnotation(string userName)
        {
            string result;
            axCoPDFXCview.RunJavaScript("var myAnnotList = this.getAnnots(); if (myAnnotList) { for (var i = 0; i < myAnnotList.length; i++)  { if (myAnnotList[i].author != \"" + userName + "\") { myAnnotList[i].destroy(); } } }", out result, 0, 0);
        }
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinks are broken after annotations import

Post by Tracker Supp-Stefan »

Hello Rene,

Am I correct that you are modifying the .xml externally between the export and the following import back? This might be what is breaking the file and making it unable to be imported later.

If you want to only show comments from a given user - then simply just hide all the rest of the annotations in the file - no need to import/export them or modify them ixternally. You can use JS code inside the Viewer AX directly for this:

Code: Select all

var annots = this.getAnnots()
for (i = 0; i < annots.length; i++)
{
  if (annots[i].author != "DESIRED NAME HERE") {
    annots[i].hidden = true;
  }
  else {
    annots[i].hidden = false;
  }
}
(you will of course need to put the above inside a axCoPDFXCview.RunJavaScript();

When an annotation is hidden - it will not appear in the comments pane or on the screen at all nor can be interacted with in any way other than via code. At the end of the session - you can un-hide all comments before closing the file if you want with a separate script.

Regards,
Stefan
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: hyperlinks are broken after annotations import

Post by Ivan - Tracker Software »

Can you let me know the version of Viewer SDK do you use? I just tested with 312.1 and the issue is not reproducible there.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

@ Stefan,
The problem is that we have multiple users that work's on the same document on the same time, So we have to export the annotations to different files. Otherwise the second user overwrite the annotations of the first user when saving the annotation file at the same time. We've create checkboxes above the document for each user that has made an annotation on the document, so the user can check the checkbox to load the annotations separately.

We don't modify the xml structure in de xfdf file, so that cannot be the problem.

@Ivan,

Good point, i had an older version, so i downloaded the latest version of PDF-XChange Viewer Pro SDK from tracker-software.com (Version: 2.5.312.1 (Updated on 16 Feb 2015) ) After testing there were no rectangles anymore arround the links after the import (little hurray ! :-) ), but the links are still broken. So i record each step i do with the microsoft step recorder and uploaded it to wetransfer.com because it was more than the 5mb. The link to we transfer.com --> http://we.tl/bQmy6DBpMd

Please let me know if you have the same issues after following my steps.

Rene
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: hyperlinks are broken after annotations import

Post by Ivan - Tracker Software »

Your .xfdf/.fdf files contain links, and there are links already on the page before import.

Links annotations have different names in file and in .fdf/.xfdf files, so, they will no be replaced but added during the import.

And as I see, the .xfdf file does not contain information about link URLs. Will check why it happens and come back.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Ivan,

Did you already have more information? Is its something you can reproduce or is it caused by something in my environment?

Rene
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinks are broken after annotations import

Post by Tracker Supp-Stefan »

Hello Rene,

Just spoke with Ivan, and he asked me to post here. He does see a problem with .xfdf files and the way links are exported to them, so he will be looking into that. In the mean time please use .fdf. And he gave an explanation why the original links are no longer active - as they get replaced by the ones from the .fdf/.xfdf and the current .xfdf files the Viewer makes do not export the URL properly so newly created links from such an .xfdf file will also not work.

P.S. Ivan just confirmed that he has fixed the issue with links exported in .xfdf files. The fix will be available in the next build of the Viewer (and it's SDK) and the Editor.

Regards,
Stefan
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Stefan,

As mentioned before, the .fdf file is not an workaround for us. So we have to wait on the new build to solve our production problem. Can you tell me when the new release is expected?

Rene
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinks are broken after annotations import

Post by Tracker Supp-Stefan »

Hello Rene,

I do not have a fixed date yet, sorry.

Regards,
Stefan
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Stefan,

Is there already more information about the release date ? Our company is still waiting for this fix

tnx

René
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinks are broken after annotations import

Post by Tracker Supp-Stefan »

Hello Rene,

The plan is for the end of this month. The date is not yet fixed but the new build is coming soon.

Regards,
Stefan
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Stefan,

I just downloaded PDF-XChange Viewer Pro SDK Current Version:2.5.313.0(Updated on 27 May 2015) but the problem still exists. The fix didn't make the release?

After your last forum post we made the promise to our end-users that this issue will be fixed this month. So, i'm a little annoyed, as you might understand...

Is it possible to get a hotfix for this issue?

Tnx

Rene
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: hyperlinks are broken after annotations import

Post by John - Tracker Supp »

Rene, As previously advised by Stefan in his post :
Just spoke with Ivan, and he asked me to post here. He does see a problem with .xfdf files and the way links are exported to them, so he will be looking into that. In the mean time please use .fdf. And he gave an explanation why the original links are no longer active - as they get replaced by the ones from the .fdf/.xfdf and the current .xfdf files the Viewer makes do not export the URL properly so newly created links from such an .xfdf file will also not work.

P.S. Ivan just confirmed that he has fixed the issue with links exported in .xfdf files. The fix will be available in the next build of the Viewer (and it's SDK) and the Editor.

Regards,
Stefan
This fix was included in the new release and is available - but as you will see from the explanation above your problem is not entirely resolved by the fix because there is a fundamental issue with the content located on the page which places 2 annotations in the same location - one has links and one does not and we cannot dictate that the one with links as required in the foreground - so there is absolutely no fix possible as it is not an issue with the xfdf or the fdf export/import - you just cannot place 2 annotations in the same place (one existing and one imported) and expect the links to be in the foreground - to test this ensure the imported annotations are not located over an existing annotation location and you will see the links are now available.

So it is not something we can fix.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi John,

I’m a very confused... in the quote you say
Ivan just confirmed that he has fixed the issue with links exported in .xfdf files. The fix will be available in the next build of the Viewer (and it's SDK) and the Editor.
But then you say
so there is absolutely no fix possible as it is not an issue with the xfdf or the fdf export/import


So... what exactly has been fixed to resolve what kind of issue... There is no difference if I compare the current xfdf file with the xfdx file of the previous version.

You say
you just cannot place 2 annotations in the same place (one existing and one imported) and expect the links to be in the foreground
Exactly! But this is not something I do, is done by the out of the box import and export annotation functionality. So, I've not made an annotation on the hyperlink of the pdf file. The default import annotation functionality puts a rectangle over the existing hyperlink. So, there is an issue with importing an xfdf file on a document that has a hyperlink. Importing fdf files works fine it’s only a problem with the xfdf. But we have to use the xfdf file because we need the xml structure.

I've added a print screen to reproduce the issue:
- Create a document with a link (Microsoft word) and save it a pdf
- Open the document in the full demo project (browse - open)
- Create an annotation on the document
- Export the annotation as xfdf
- Restart the full demo project
- Open the document in the full demo project (browse - open)
- Import the annotation
- The link is broken.

Rene
Attachments
full demo.zip
(474.94 KiB) Downloaded 140 times
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: hyperlinks are broken after annotations import

Post by Ivan - Tracker Software »

It seems you are still using an old version of the Viewer SDK.
The New build (2.5.313.0) has the issue with exporting actions to xfdf files fixed.
For comparison, there is content of your XFDF file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"
><f href="Link to google.pdf"
/><ids original="373F3C600C560C4EAC884698C6670E42" modified="373F3C600C560C4EAC884698C6670E42"
/><annots
><link Highlight="Invert" page="0" flags="print" name="0e11e1a9-eb78-4ec9-99481f35d71bdcb7" rect="68.6,757.53,170.87,771.07" width="0"
/><link Highlight="Invert" page="0" flags="print" name="4c38809d-341b-4e52-828cb2708b873d78" rect="68.6,730.45,190.62,743.99" width="0"
/><link Highlight="Invert" page="0" flags="print" name="358a422d-5fdd-479e-9ae8499312d445a5" rect="68.6,703.37,198.96,716.91" width="0"
/><circle fringe="0.5,0.5,0.5,0.5" title="testuser" creationdate="D:20150306094118+01'00'" subject="Oval" page="0" date="D:20150306094118+01'00'" flags="print" name="55c1389a-1ed4-4668-ae0ed7c6f903ea77" rect="222.682671,724.216136,300.659094,800.686163" color="#FF0000"
/><circle fringe="0.5,0.5,0.5,0.5" title="testuser" creationdate="D:20150306094119+01'00'" subject="Oval" page="0" date="D:20150306094119+01'00'" flags="print" name="4e7fd7bd-8133-41d2-910118a506653119" rect="127.461461,582.521675,258.671789,666.488763" color="#FF0000"
/></annots
></xfdf
>
and the XFDF file generated by new build:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"
><f href="Link to google.pdf"
/><ids original="373F3C600C560C4EAC884698C6670E42" modified="373F3C600C560C4EAC884698C6670E42"
/><annots
><link Highlight="Invert" page="0" flags="print" name="41edf76c-c0b1-433a-a2afbe30f9deaa31" rect="68.6,757.53,170.87,771.07" width="0"
><OnActivation
><URI Name="http://www.google.com/"
/></OnActivation
></link
><link Highlight="Invert" page="0" flags="print" name="dc7f611c-5b26-41df-9ebd6e9f136cbd91" rect="68.6,730.45,190.62,743.99" width="0"
><OnActivation
><URI Name="file://cache/cache"
/></OnActivation
></link
><link Highlight="Invert" page="0" flags="print" name="097a689c-297c-4b3a-82eafe4f5305be10" rect="68.6,703.37,198.96,716.91" width="0"
><OnActivation
><URI Name="file:///c:/test.pdf"
/></OnActivation
></link
></annots
></xfdf
>
Please update ...
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Ivan,

I've done some testing but still have the same issue. Even when i download and install the pdf x change viewer on a new installed pc, make an annotation and export and import the annotation file due the user interface the problem exists.

I will test a couple of other scenarios today and give you an update.

Rene
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Ivan,

I uploaded a test solution to http://we.tl/AJxjYiWQiI (7mb). Can you check of this solution works on your machine by following the steps below?

run the TestApplication.exe,
load the settings.dat file that can be found in de "Files" directory
Load the document "Link to google.pdf" that can be found in de "Files" directory
create an annotation
export the annotation

close the TestApplication.exe

run the TestApplication.exe again,
load the settings
load the document
import the annotation
the link to google.com isn't working on my machine

I've checked the version of the PDFXCview.exe and PDFXCviewAx.dll and they are both signed on the 27 may 2015. Can you tell me what i'm doing wrong?

Tnx,

René
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinks are broken after annotations import

Post by Tracker Supp-Stefan »

Thanks for this Rene,

I've passed it to Ivan and asked him to take a look.

Cheers,
Stefan
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: hyperlinks are broken after annotations import

Post by Ivan - Tracker Software »

Thanks for the sample app, Rene.

I have found where the problem was into the Viewer. I'm ready to build and send you a test version of the Viewer for testing if it works now as you expected.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Ivan,

Good to hear that the issue is found. If you have a download link i can test it for your.

Tnx

René
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinks are broken after annotations import

Post by Tracker Supp-Stefan »

Hi Rene,

Is the e-mail from your signature the one to which we should send the link for the custom test build?
If we should use another (and you don't want to share it in the forums) - please send an e-mail to support@pdf-xchange.com with the -e-mail we should use.

Regards,
Stefan
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi stefan,

Yes you can send it to that e- mailaddress.

Regards,

Rene
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: hyperlinks are broken after annotations import

Post by Ivan - Tracker Software »

Please check your email.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Ivan,

Tnx for the e-mail. i'm testing the new build at the moment, i lett you know the results when i'm done.

René
Rene
User
Posts: 39
Joined: Tue May 22, 2012 1:24 pm

Re: hyperlinks are broken after annotations import

Post by Rene »

Hi Ivan,

The solution works fine. Can i use this build in my production environment?

I saw that the fix only works with new added annotations. Annotations that have been made with a previous version have still the issue. I suppose this is not something you can fix because than you have to manipulate the xml. It's a nice to have but not a prerequisite.

Rene
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinks are broken after annotations import

Post by Tracker Supp-Stefan »

Hi Rene,

Most likely that custom build is the same as the official 313.1 with the only change being the fix for your particular case. So I'd presume it's safe to use it in your production environment, but just to be sure - I will check with Ivan when he comes to work.

As for the second question - the fix will affect how new ones are generated, and will not automatically apply to broken ones already exported to the .xml file.

Regards,
Stefan
Post Reply