mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 16:38:59 -04:00
Add letter validation preview functionality
- add get/post view - create a pdf upload form - add a template where user can upload the file - check boundaries of the letter by calling template-preview - display banner messages with boundaries validation result - display pages of the document, with visible boundaries overlay if the document did not pass validation, and without overlay if they do pass validation
This commit is contained in:
@@ -43,3 +43,11 @@ def get_page_count_for_letter(template, values=None):
|
||||
page_count = json.loads(page_count.decode('utf-8'))['count']
|
||||
|
||||
return page_count
|
||||
|
||||
|
||||
def validate_letter(pdf_file):
|
||||
return requests.post(
|
||||
'{}/precompiled/validate?include_preview=true'.format(current_app.config['TEMPLATE_PREVIEW_API_HOST']),
|
||||
data=pdf_file,
|
||||
headers={'Authorization': 'Token {}'.format(current_app.config['TEMPLATE_PREVIEW_API_KEY'])}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user