Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic profile image preview #14

Open
lazka opened this issue Apr 17, 2023 · 0 comments
Open

Automatic profile image preview #14

lazka opened this issue Apr 17, 2023 · 0 comments

Comments

@lazka
Copy link
Member

lazka commented Apr 17, 2023

Currently the frontend hardcodes specific images for a signature profile and the width/height as configured in pdf-as. Ideally the activity would just get a profile ID to use, or figure out which profiles are available for the current user and everything else would be auto-magic.

pdf-as provides a visblock endpoint which provides a preview and allows selecting the profile and a resolution:

http://127.0.0.1:8080/pdf-as-web/visblock?r=100&p=BASE_NORMAL

image

esign could provide a "profiles" API which contains the profile name, size (can be derived from the vizblock)

profile:
  id: "my-profile"
  name: "My Profile"
  width: 123 (in points)
  height: 45 (in points)
  previewimage: "data:image/png;base64,..."
  supportsUserText: true

width/height could be derived from the image:

profile width/height: round((pixel / resolution) * 72) -> points

To do:

  • add a profiles resource
  • add a bundle config setting for a user visible profile name
  • cache the profile image
  • derive the width/height from it
  • make visblock accessible in the firewall config
  • expose if user text is configured

Open questions:

  • name translation? -> leave up to the bundle config I guess?
  • previewimage resolution? -> a multiple for 72 works nicely because of rounding, e.g. 360, or 504, use to calc width/height, and scale down.
  • If we allow to extend the signature block the preview wont show that -> but that's already a problem
  • We currently allow setting a different width when signing via the API, there is no way to get a preview for that though, unless we patch pdf-as. The frontend uses the default width though, so that's not a problem there.

All in all this would mean the following

<dbp-official-signature-pdf-upload
    signature-width="162"
    signature-height="28"
    signature-placeholder-image-src="official-signature-placeholder.png">
</dbp-official-signature-pdf-upload>

could be reduced to:

<dbp-official-signature-pdf-upload
    profile-id="official">
</dbp-official-signature-pdf-upload>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant