Annotation on seperate layers...

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

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

lidds
User
Posts: 514
Joined: Sat May 16, 2009 1:55 pm

Annotation on seperate layers...

Post by lidds »

I need some advise on how to acheive the following, I am knew to PDF X-Change so I do not know all the functionality:

What I want to do is have a PDF on a network that multiple users can open at the same time, which is not a problem. However I want the users to be able to mark-up the PDF, but then for their mark-ups to be be saved in a seperate file/layer/PDF (NOT the original that they have opened). Then I want the ability to load each users mark-ups into a single PDF but for them to be on seperate layers so I can easily turn them on and off.

As I said I am new to the whole PDF thing, so layers may not be the best option, but hopefully it illistrates my problem quite well.

Thanks in advance

Simon
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Annotation on seperate layers...

Post by Corwin - Tracker Sup »

You can export comments to an FDF file (in main menu: Comments->Export Comments to Data File...) and then import them from this file to the same PDF document.
lidds
User
Posts: 514
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation on seperate layers...

Post by lidds »

I saw the export option, however I could not see an import option. Could you also give me some guidance as to the commands to export and import the annotations, as I can't seem to find it in the manual and it would make it easier for me to find if I knew the command syntax.

Thanks for you help

Simon
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Annotation on seperate layers...

Post by Corwin - Tracker Sup »

Using Viewer UI:
Comments->Export Comments to Data File... - export comments and forms values to FDF (or XFDF) file.
Comments->Import Comments... - import comments from FDF (or XFDF) file to current opened document.
You can also export/import comments via code by using next JS functions:
"exportAsFDF" and "importAnFDF". How to use this functions you can read at JavaScript for Acrobat API Reference.
lidds
User
Posts: 514
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation on seperate layers...

Post by lidds »

Thanks Corwin,

For your help, this is exacually what I wanted. However I am not to sure how to actually implement the code in VB.Net. Would it be possible for you to give me some example code?

Thanks in advance

Simon
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Annotation on seperate layers...

Post by John - Tracker Supp »

Hi,

will try and get a code snippett together and post ASAP

Thanks for your patience
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
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Annotation on seperate layers...

Post by Corwin - Tracker Sup »

In VB.NET to export annotations you can use next code:

Code: Select all

Dim bsResult As String = ""
Try
   AxCoPDFXCview1.RunJavaScript("this.exportAsFDF(true, true, null, true, ""/c/annots.fdf"", true);", bsResult, 0, 0)
Catch ex As Exception
End Try
(this will export annotations to c:\annots.fdf file)
and for import:

Code: Select all

AxCoPDFXCview1.RunJavaScript("this.importAnFDF(""/c/annots.fdf"");", bsResult, 0, 0)
lidds
User
Posts: 514
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation on seperate layers...

Post by lidds »

Corwin,

Once again you have answered my questions perfectly.

Thanks for all your help

Simon
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Annotation on seperate layers...

Post by John - Tracker Supp »

Yes Simon - he's a good guy and we are lucky to have someone who works so hard and does such a dilligent job !
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
lidds
User
Posts: 514
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation on seperate layers...

Post by lidds »

Corwin,

1) As I said awhile ago this worked fine, however what I want to do is be able to save the file to a location that is stored within a variable

e.g.

Code: Select all

Dim bsResult As String = ""
Dim strDir as string = "C:\temp\annots.fdf"
Try
   AxCoPDFXCview1.RunJavaScript("this.exportAsFDF(true, true, null, true, " & strDir & ", true);", bsResult, 0, 0)
Catch ex As Exception
End Try
[code]

I have tried a number of variations but can't get it to work.

2) Also once I have imported the annotations is there a way that I can then unload them e.g. switch .fdf files on and off?

3) Also is it possible to import annotations from a .fdf file into a PDF but make all these annotations readonly?

Thanks

Simon
lidds
User
Posts: 514
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation on seperate layers...

Post by lidds »

bump.... Is anyone able to help me with this?

Thanks

Simon
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Annotation on seperate layers...

Post by Corwin - Tracker Sup »

Hi Simon.
Sorry to have kept you waiting.

1. In your code you forgot to add quotes for the path to file. Also you should use doubled backslash for a JS file path.
So your code should look as below:

Code: Select all

Dim bsResult As String = ""
Dim strDir As String = "C:\\Temp\\annots.fdf"

Try
   AxCoPDFXCview1.RunJavaScript("this.exportAsFDF(true, true, null, true, """ & strDir & """, true);", bsResult, 0, 0)
Catch ex As Exception
End Try
Please note, that to make this code work, "C:\Temp" directory should already exist.

2. No, you cannot do this. But you can reopen the PDF document (if it was not saved after the import of annotations) and then import another FDF file.

3. Only way to do this is to make all annotations in the document read-only.

HTH.
lidds
User
Posts: 514
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation on seperate layers...

Post by lidds »

Hi Corwin,

Thanks for your help.

Just had a thought with regards to point 3. I have modified the annotation properties to contain the users name from my application e.g. after they log in. Is it at all possible to override the annotation selection code in your ActiveX so that when the user selects an annotation element it checks their current login name with the login name saved on the annotation element. If they do not match then it deselects the annotation element, therefore not allowing them to manipulate it as it is not selected.

This was just a thought and I have no idea how to override this selection, therefore if it is possible would you mind providing me with a code snippit.

FYI I am coding in VB.Net

Thanks in advance

Simon
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3586
Joined: Thu Jul 08, 2004 10:36 pm

Re: Annotation on seperate layers...

Post by Ivan - Tracker Software »

Hi,

No, there is no way to override the selection.
PDF-XChange Co Ltd. (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.