prevent PDFXVwer from editing pdf inside iframe.

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

tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

hi

In my application I open a pdf file inside iframe with PDFXVwer.
I need the file to open as read only , not allowing the user to edit/save it until he press a button.
how can I prevent this editing and later permit it?

thanks
Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by Stefan - PDF-XChange »

Hello Tami,

Please take a look at the "How to Disable a Command" section of the Viewer AX manual. You can effectively forbid the user from doing anything to the document, and intercept any mouse + KB combination used by them and either tell the Viewer to ignore them or perform a custom action.

Best,
Stefan
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

can you please post the link where to Viewer AX manual .

I didn't found it.

thanks

Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by Stefan - PDF-XChange »

Hi Tami,

It should be invcluded as part of the Viewer AX SDK isntallation pacakge, and located in
<<Path to>>\Tracker Software\PDF-XChange Viewer SDK\SDKHelp

Best,
Stefan
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

hi

I downloaded PDF-XChange Viewer SDK.

I am looking for a tutorial / explanation how to merge it in my web-project.

I read the manuals but I didn't understand how to do it .

can you please explain what files I need to import to my project and how to use them .

thanks

Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by Stefan - PDF-XChange »

Hello Tami,

Have you checked the AspNetPDFXChangeAXSample sample that comes with the Viewer AX SDK?

Cheers,
Stefan
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

Hello Stefan

I looked at the example but I couldn't understand how to use it in my project.

I am creating web-application using java , on SpringSource Tool Suite 2.9.1.

I don't know witch part of the sdk I need to import to my project, do I need to change web.xml or any other configuration files etc..

Is there any project example or tutorial that explain how to use it in java web project ?

thanks
Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by Stefan - PDF-XChange »

Hi Tami,

I've passed this to a colleague of mine dealing with those samples, and if such a solution is possible we will let you know.

Best,
Stefan
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by Stefan - PDF-XChange »

Hi again Tamih,

I spoke with one of my colleagues and he recommended that you should check the "WebExamples" folder inside the Viewer SDK - which includes the PDFXChangeViewer.html sample showing some simple script to control our AX.

Best,
Stefan
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

Hi

Tanks for all the help so far...

I used the example you told me , but I still have few questions.

How can I disable/enable the user from editing the file ?
I need the file to be in 'read only' mode in the beginning , and only after some button is pressed and some checked are done I need to permit it's editing.

I saw there is 'DenyAllModifyOperations ' but I couldn't find any javascript example how to use it .
I tried

Code: Select all

PDFView.DenyAllModifyOperations(0); 
but it didn't work.

any javaScript code example would be great .

Thanks

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

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by Corwin - Tracker Sup »

Hello Tami,

Try to use this:

Code: Select all

PDFView.SetProperty("General.DenyAllModifyOperations", 1, 0);
HTH.
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

hi

I used

Code: Select all

PDFView.SetDocumentProperty(docID, "ReadOnly", "true", 0); // disables editing for specified document
and it works o.k .

when I tried to use the same code example and put it in html 4.01 it doesn't work .

why doesn't it work with html 4.01 ? how can I make it work ?

thanks for your help

Tami
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

I found my problem .

Thanks for all your help.

your support is great !!!
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by John - Tracker Supp »

Excellent :)

Pleased all is well.
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
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

Hi

I am trying to use "ShowAllBars" "HideAllBars" but it trow an error , I think my syntax is wrong .

I tried :

Code: Select all

 PDFView.DoVerb("", "ShowAllBars",0, 0, 0);
PDFView.DoVerb("", "ExecuteCommand", "ShowAllBars", 0, 0);

both of them don't work .

please write me the right syntax.

Thanks

Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by Stefan - PDF-XChange »

Hello Tami,

Please try something like the following:

Code: Select all

function btnToolbars_onclick() {
    try {
        document.all.PDFView.DoVerb("", "ExecuteCommand", "ToggleAllToolbars", 0, 0);
    }
    catch (err) { } 
}
There's a "ShowAllBars" command in the Viewer AX manual but no ShowAllToolbars - maybe that's causing your problem.

Best,
Stefan
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by tamih »

Hi

the command 'ToggleAllToolbars' works o.k , but before I use it I must check is it on Hide/Show mode .
I tried

Code: Select all

var num ;
PDFView1.DoVerb(NULL, "HasVisibleBars", num, 0, 0);
if(num == 0 ){...}
just like suggested in
but it trow error that num is undefined.

Is there a nice way to check if ToggleAllToolbars is on Hide/Show mode before toggling it ?

Tanks
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: prevent PDFXVwer from editing pdf inside iframe.

Post by Vasyl - PDF-XChange »

Hi, Tami.

Please try to use it:

Code: Select all

var stub = 0;
var num = 0;
PDFView1.DoVerb(NULL, "HasVisibleBars", stub, num, 0, 0);
If this does not work (because in java script can be problem with getting output by normal out-arguments, a known restriction of java-script) then please try this altrenative:

Code: Select all

var count = document.all.PDFView.Property("View.Bars.Count", 0);
var hasVisibleToolbars = 0;
for (i = 0; i < count; i++)
{
     var baseName = "View.Bars.Bars[" + i + "]"; 
     var barName = document.all.PDFView.Property(baseName + ".Name", 0);
     if (barName == "Menu" || barName == "Status" || barName == "Tab")
          continue; // to skip non-toolbars 
     var vis = document.all.PDFView.Property(baseName+".Visible", 0); 
     if (vis != 0)
     {
        hasVisibleToolbars = 1;
        break;   
     }
};
further - you may also check the visibility of a document's toolbars (such as "PagesNavigation", "PagesLayout") using path:

Code: Select all

var basePath = "Documents[#" + activeDocID + "].View.Bars";
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.