Dynamically changing TfrxDigitalSignatureView.Kind

edited November 2021 in FastReport VCL

[Please disregard for the time being - the traditional "we didn't change anything, but it just started working" seems to have kicked in and TfrxDigitalSignatureView.Kind changes are suddenly being picked up.]


We're attempting to add the new digital signature facility to PDF exports from an existing FastReport VCL-based implementation.

The starting point was a working form with a TfrxPreview that displayed the user's report, with a ribbon to control display options and trigger PDF exports. For the export TfrxPDFExport.ShowDialog = False, and we do all necessary setup in our own code.

To add the signing we put a TfrxDigitalSignatureView component in the report template, and extra items to the ribbon to allow the user to choose between a .pfx + password signature (and supply details of both), or an "empty" signature area they can complete from system-level certificates after opening the exported PDF. From experimentation I think these require Kind = skInvisible or Kind = skEmpty respectively.

Unfortunately while we can get either of those options to work correctly in isolation, what we can't make happen is the export pick up changes to TfrxDigitalSignatureView.Kind made after the initial display of the preview; it seems that the Kind is set initially in in the course of the TfrxPreview setup, and that setting's what the export works with.

We've tried adding code of the form:

theSigHandler := frxReport.FindObject('dsSignature') As TfrxDigitalSignatureView ;

if <PFX Signing> then

  theSigHandler.Kind := skInvisible

 else

  theSigHandler.Kind := skEmpty ;

in multiple places (prior to the export, on OnBeforeXXX handlers) and adding a frxReport.RefreshActivePreviewedReport immediately before the frxReport.Export(frxPDFExport), but this doesn't affect the signature handling in the export itself. (Checking the preview's state in the report designer the Kind is being set in the instantiated components, just not - apparently - being picked up by the export).

Could you advise on how to get the TfrxDigitalSignatureView.Kind change handled by the export, or if nothing else let us know if we're attempting something that's impossible?

Comments

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.