Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
.Chriss said:how far the rights management is supported by all pdf viewers after a file is generated encryped and wihtout print permission is beyond my knowledge, though
I try to set lPDFEncryptDocument = TRUE
lShowPrintBtn= .F.
lPDFCanPrint = .f.
but is the same result with no modification
LOCAL loPreview
loPreview = NULL
DO (_REPORTPREVIEW) WITH loPreview
loPreview.AllowPrintFromPreview = .F.
&& This is the important bit
loPreview.AllowPrintFromPreview = .F.
loListener = CREATEOBJECT("ReportListener")
loListener.PreviewContainer = loPreview
lolistener.ListenerType = 1
REPORT FORM MyReport OBJECT loListener
REPORT FORM MyReport.FRX OBJECT TYPE 10 TO FILE "MyPDF.PDF"
DO FoxyPreviewer.App && only necessary once in main, not for every report
* Make PDF
REPORT FORM yorreport ;
TO FILE "c:\TestReport.Pdf"
LOCAL loPreview
loPreview = NULL
DO (_REPORTPREVIEW) WITH loPreview
loPreview.AllowPrintFromPreview = .F.
&& This is the important bit
loPreview.AllowPrintFromPreview = .F.
loListener = CREATEOBJECT("ReportListener")
loListener.PreviewContainer = loPreview
lolistener.ListenerType = 1
REPORT FORM MyReport OBJECT loListener
DO FoxyPreviewer.App
#DEFINE PrintFromPreview .F.
LOCAL loPreviewContainer AS FORM, ;
loReportListener AS REPORTLISTENER, ;
loExHandler AS ExtensionHandler OF SYS(16)
loPreviewContainer = NULL
DO (_REPORTPREVIEW) WITH loPreviewContainer
loReportListener = NEWOBJECT('ReportListener')
loReportListener.LISTENERTYPE = 1 &&Preview
loReportListener.PREVIEWCONTAINER = loPreviewContainer
loPreviewContainer.AllowPrintfromPreview = PrintFromPreview
loPreviewContainer.TextOnToolbar = .F.
loExHandler = NEWOBJECT('ExtensionHandler')
loPreviewContainer.SetExtensionHandler( loExHandler )
REPORT FORM MYFORM NOCONSOLE PREVIEW FOR SOMETHING=msomething OBJECT loReportListener && Example only
DEFINE CLASS ExtensionHandler AS CUSTOM
*-- Ref to the Preview Container's Preview Form
PreviewForm = NULL
*-- Here you implement (hook into) the PreviewForm_Assign
*-- event of the preview container's parent proxy
PROCEDURE PreviewForm_Assign( loRef )
*-- Perform default behavior: assign obj ref.
THIS.PreviewForm = loRef
*-- Grab the obj ref to the preview form and bind to its
*-- ShowToolbar() method. This lets the
*-- STB_Handler() method of this extension handler
*-- to run code whenever the Preview toolbar is shown
*-- by the PreviewForm.ShowToolbar() method.
IF !ISNULL( loRef )
BINDEVENT(THIS.PreviewForm, ;
'ShowToolbar', THIS, 'STB_Handler')
ENDIF
ENDPROC
PROCEDURE STB_Handler(lEnabled)
*-- Here you work around the setting
*-- persistence problem in the Preview toolbar.
*-- The Preview toolbar class (frxpreviewtoolbar)
*-- already has code that you can use to enforce
*-- setting's persistence; it is just not called. Here,
*-- you call it.
WITH THIS.PreviewForm.TOOLBAR
.REFRESH()
*-- When you call frxpreviewtoolbar::REFRESH(), the
*-- toolbar caption is set to its Preview form,
*-- which differs from typical behavior. You must revert that
*-- to be consistent. If you did not do this,
*-- you would see " - Page 2" appended to the toolbar
*-- caption if you skipped pages.
.CAPTION = THIS.PreviewForm.formCaption
ENDWITH
ENDPROC
*-- A preview container requires these methods
*-- to be implemented in an associated preview extension handler.
*-- They are not used in this example, but still must be here.
PROCEDURE AddBarsToMenu( cPopup, iNextBar )
PROCEDURE SHOW( iStyle )
ENDPROC
PROCEDURE HandledKeyPress( nKeyCode, nShiftAltCtrl )
RETURN .F.
ENDPROC
PROCEDURE PAINT
ENDPROC
PROCEDURE RELEASE
RETURN .T.
ENDPROC
ENDDEFINE
loPreview loPreview = NULL
DO (_REPORTPREVIEW) WITH loPreview loPreview.AllowPrintFromPreview = .F.
&& This is the important bit
loPreview.AllowPrintFromPreview = .F. loListener = CREATEOBJECT("ReportListener") loListener.PreviewContainer = loPreview lolistener.ListenerType = 1
REPORT FORM MyReport OBJECT loListener