Previous | Next | (P-PDF) JavaScript
Topic: Disabling the 'Save As...' button using Javascript
Conf: (P-PDF) JavaScript, Msg: 66112
From: Brad Saide
Date: 6/3/2002 07:57 AM
Hi All.
We finally developed a solution whereby we distributed a customised pdf reader, without the save functionality. Unfortunately the development team here could not work out how to do it using the acrobat reader application, even with the subtle clues and hints given by other members of the forum who obviously knew the answer all along.
I was under the impression that a forum was a way to pass on knowledge, rather than a way to make people think you are smarter. This is why I love Microsoft's forums so much - the knowledge is shared, and those receiving the knowledge (in most cases) learn from it. I'll get off my soapbox now. Anyway, in the hope that the knowledge is used elsewhere, here is the code for the VB app we developed.
First, we added the Acrobat Control ActiveX object (I think it is part of the SDK), then -
Dim intZoom As Integer
Private Sub Form_Activate()
On Error GoTo Err1
intZoom = 100
cmpPdf1.Top = 420
cmpPdf1.Left = 30
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'The following code was put in an If-Then conditional statement to prevent errors occuring when setting
'the height and width of the cmpPdf1 part and the command button that covers the menu
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If frmWOWReader.Height > 1000 Then
cmpPdf1.Height = frmWOWReader.Height - 890
cmpPdf1.Width = frmWOWReader.Width - 150
cmdHideBtn.Top = 420
cmdHideBtn.Left = frmWOWReader.Width - 375
End If
Exit Sub
Err1:
MsgBox "There has been an error." & vbCrLf & _
"Please contact the Woolworths National Customer Service Centre on 1800 623 557," & vbCrLf & _
"ask them to raise a PCMS to Web Services, and to include the following information ->" & _
vbCrLf & vbCrLf & "Err ID = " & Err.Number & vbCrLf & "Source = " & Err.Source & vbCrLf & "Desc = " & Err.Description & vbCrLf & "Form = frmWOWReader, Sub = Form_Resize", vbOKOnly & vbCritical, "Error"
End Sub
Private Sub Form_Resize()
On Error GoTo Err1
cmpPdf1.Top = 420
cmpPdf1.Left = 30
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'The following code was put in an If-Then conditional statement to prevent errors occuring when setting
'the height and width of the cmpPdf1 part and the command button that covers the menu
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If frmWOWReader.Height > 1000 Then
cmpPdf1.Height = frmWOWReader.Height - 890
cmpPdf1.Width = frmWOWReader.Width - 150
cmdHideBtn.Top = 420
cmdHideBtn.Left = frmWOWReader.Width - 375
End If
Exit Sub
Err1:
MsgBox "There has been an error." & vbCrLf & _
"Please contact the Woolworths National Customer Service Centre on 1800 623 557," & vbCrLf & _
"ask them to raise a PCMS to Web Services, and to include the following information ->" & _
vbCrLf & vbCrLf & "Err ID = " & Err.Number & vbCrLf & "Source = " & Err.Source & vbCrLf & "Desc = " & Err.Description & vbCrLf & "Form = frmWOWReader, Sub = Form_Resize", vbOKOnly & vbCritical, "Error"
End Sub
Private Sub Form_Terminate()
Unload Me
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error GoTo Err1
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This Select Case statement checks for what value is returned when one of the menu buttons is
'pressed, and then performs a particular operation depending on the value returned to the code.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Select Case Button.Key
Case Is = "["
cmpPdf1.gotoFirstPage
Case Is = "<"
cmpPdf1.gotoPreviousPage
Case Is = ">"
cmpPdf1.gotoNextPage
Case Is = "]"
cmpPdf1.gotoLastPage
Case Is = "p"
cmpPdf1.printAllFit (True)
Case Is = "h"
frmHelp.Visible = True
Case Is = "+"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'The user wants to increase the zoom size of the current PDF file
'This conditional statement checks to see if the current value of intZoom
'Is = or > than 10. If it is, then 10 is added to the current value , and the
'zoom of the current pdf doc is set to the new value of intZoom.
'Else, the value of intZoom is set to 100% (IE when the button is first pressed and intZoom = 0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If intZoom >= 10 Then
intZoom = intZoom + 10
Else
intZoom = 100
End If
cmpPdf1.setZoom (intZoom)
Case Is = "-"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'The user wants to decrease the zoom size of the current PDF file
'This conditional statement checks to see if the current value of intZoom
'Is = or > than 10. If it is, then 10 is subtracted from the current value, and the
'zoom of the current pdf doc is set to the new value of intZoom.
'Else, the value of intZoom is set to 100% (IE when the button is first pressed and intZoom = 0,
'or when the value drops below 10 due to repeated clicking.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If intZoom >= 10 Then
intZoom = intZoom - 10
Else
intZoom = 100
End If
cmpPdf1.setZoom (intZoom)
End Select
Exit Sub
Err1:
MsgBox "There has been an error." & vbCrLf & _
"Please contact the Woolworths National Customer Service Centre on 1800 623 557," & vbCrLf & _
"ask them to raise a PCMS to Web Services, and to include the following information ->" & _
vbCrLf & vbCrLf & "Err ID = " & Err.Number & vbCrLf & "Source = " & Err.Source & vbCrLf & "Desc = " & Err.Description & vbCrLf & "Form = frmWOWReader, Sub = Form_Resize", vbOKOnly & vbCritical, "Error"
End Sub