webviewer-ui icon indicating copy to clipboard operation
webviewer-ui copied to clipboard

Add SaveAsHandler for custom save as behavior

Open uwohlfeil opened this issue 3 years ago • 4 comments

This pull request is a proposal for an extended functionality in the area of the 'save as' functionality.

Currently the saveAs function of the file-saver library is always triggered here. In some cases, it may be useful to implement this event individually in the context of customizing. E.g. in the context of a document management system, the result should not be saved locally but stored directly as a new file in the DMS. There can also be problems in the context of the IFrame attribute sandbox (IFrame in IFrame case).

See also: https://community.apryse.com/t/intercept-overwrite-download-function-in-webviewer/7245

WebViewer(...)
  .then(function(instance) {
    // data: Blob|File , filename: string 
    function saveAsHandler(data, filename) {
      // Create  download Link, Open Tab, call individual api
    };

    instance.UI.setSaveAsHandler(saveAsHandler);
  });

uwohlfeil avatar Feb 14 '23 13:02 uwohlfeil

Hi @uwohlfeil,

Thanks for making this PR! We will add this to our following sprint to review. Our next sprint starts next Monday. Once we have completed our review we will provide feedback.

Thanks for taking the time to submit this, you will hear from us soon.

bollain avatar Feb 16 '23 01:02 bollain

I have added a few corrections in the area of the German translation:

Incorrect translations

  • action.addMark and pageRedactModal.addMark
  • old: Markus hinzufügen
  • new: Markieren (Long will be Markierung hinzufügen, but we think that will break the layout)
  • action.insertBlankPageBelow
    • old: Leere Seite unten einfügen page
    • new: Leere Seite unten einfügen"
  • redactionPanel.clearMarked
  • old: Klar (Clear like clear water, clear view and so on)
  • new: Abbrechen (cancel). The longer correct translation will be like Markierungen entfernen, but this may break the layout

Optimization

This translations are not wrong but we think they can be optimized.

  • action.selectAll
    • old: Wählen Sie Alle (sounds like a command)
    • new: Alle auswählen
  • redactionPanel.redactionSearchPlaceholder
    • old: Hinzufügen nach Schlüsselwortsuche oder Mustern
    • new: Schlüsselwortsuche oder Muster
  • settings.lightMode
    • old Lichtmodus not wrong but sound strange. The english version is very common in german
    • new Light-Mode
  • settings.darkMode
    • old Dunkler Modus works but we think the english version is very common in german
    • new Dark-Mode
  • settings.advancedSetting
    • old Erweiterte Einstellung
    • new Erweitert this text fits better (but the original works but then Erweiterte Einstellungen)
  • settings.disableFadePageNavigationComponent
    • old Deaktivieren Sie die Seitennavigationskomponente ausblenden sounds like a command
    • new Seitennavigationskomponente nicht automatisch ausblenden
  • settings.disableToolDefaultStyleUpdateFromAnnotationPopup
    • old Deaktivieren Sie die Aktualisierung des Werkzeug-Standardstils aus dem Anmerkungs-Popup - Command
    • new Aktualisierung des Werkzeug-Standardstils aus dem Anmerkungs-Popup deaktivieren"

Ideas

The toolbar names are a little bit confusing and very long.

  • option.toolbarGroup.toolbarGroup-FillAndSign
    • old Füllen und unterschreiben
    • new Formular (Forms)
  • option.toolbarGroup.toolbarGroup-Forms
    • old Formen
    • new Zeichnen (Draw/Sketch)

uwohlfeil avatar Feb 17 '23 11:02 uwohlfeil

We currently have the problem that the thumbnail multiselect checkbox input control is slightly shifted to the right. This makes it impossible to select the checkbox in the left part of the framed area. The problem seems to be the css rule "position: absolute". We suspect that our solution is not correct, but we hope that it shows the problem.

Before: grafik

After: grafik

uwohlfeil avatar Feb 23 '23 18:02 uwohlfeil

Thank you for you feedback and additions! Most of this looks good. For the checkbox issue, we are working on implementing a fix already so you can leave the css change out for now. The only other changes would be to use const instead of var in var handler = getSaveAsHandler();

@carlopdftron Thank you for your feedback and that you liked the changes. I tried to correct the noted points accordingly.

uwohlfeil avatar Mar 01 '23 08:03 uwohlfeil