Compare commits

...

3 Commits

Author SHA1 Message Date
300b6f46f1
Add signatureZoneIndex to published message
The 'signatureZoneIndex' field is now included in the message body published to the outbound exchange. This change ensures that all necessary information is transmitted.
2024-09-03 14:34:05 +02:00
ed81eb749c
Remove unused import in worker.py
Deleted import of the 'io' module from worker.py as it was not being used. This helps clean up the code and potentially reduce memory usage. Cleaning up unused imports also makes the codebase more maintainable.
2024-09-03 14:33:53 +02:00
41ba98ee91
Fix signature box placement calculation
Adjusted the calculation of the signature box's bottom boundary to subtract the height instead of adding it. This change ensures that the signature is placed correctly within the designated zone on the PDF.
2024-09-03 14:33:45 +02:00

View File

@ -1,5 +1,4 @@
import base64
import io
import json
import logging
import os
@ -42,7 +41,7 @@ def on_message(channel, method_frame, header_frame, body):
try:
box_place = (body_content['signatureZone']['x'], body_content['signatureZone']['y'],
body_content['signatureZone']['x'] + body_content['signatureZone']['width'],
body_content['signatureZone']['y'] + body_content['signatureZone']['height'])
body_content['signatureZone']['y'] - body_content['signatureZone']['height'])
LOGGER.debug("will try signature")
signed = orchestrator.sign(reason=body_content['reason'], signature_index=body_content['signatureZoneIndex'],
box_place=box_place, on_page=body_content['signatureZone']['PDFPage']['index'],
@ -59,6 +58,7 @@ def on_message(channel, method_frame, header_frame, body):
channel.basic_publish(exchange=EXCHANGE_OUT,
body=json.dumps({'signatureId': body_content['signatureId'],
'signatureZoneIndex': body_content['signatureZoneIndex'],
'content': base64.b64encode(signed.read()).decode('utf-8')}),
properties=pika.BasicProperties(content_type='application/json',
delivery_mode=pika.DeliveryMode.Transient),