mirror of
https://github.com/bringout/euro-office.git
synced 2026-04-18 02:02:00 +02:00
Based on onlyoffice_odoo by Ascensio System SIA (ONLYOFFICE, LGPL-3). Rebranded and adapted for Euro-Office by bring.out d.o.o. Modules: - eurooffice_odoo: base integration - eurooffice_odoo_templates: document templates - eurooffice_odoo_oca_dms: OCA DMS integration (replaces Enterprise documents) All references renamed: onlyoffice -> eurooffice, ONLYOFFICE -> Euro-Office. Original copyright notices preserved.
39 lines
887 B
Python
39 lines
887 B
Python
# TODO: add convert docx to pdf
|
|
|
|
|
|
def is_pdf_form(text):
|
|
if not text:
|
|
return False
|
|
|
|
index_first = text.find(b"%\xcd\xca\xd2\xa9\x0d")
|
|
if index_first == -1:
|
|
return False
|
|
|
|
p_first = text[index_first + 6 :]
|
|
|
|
if not p_first.startswith(b"1 0 obj\x0a<<\x0a"):
|
|
return False
|
|
|
|
p_first = p_first[11:]
|
|
|
|
signature = b"Euro-OfficeFORM"
|
|
index_stream = p_first.find(b"stream\x0d\x0a")
|
|
index_meta = p_first.find(signature)
|
|
|
|
if index_stream == -1 or index_meta == -1 or index_stream < index_meta:
|
|
return False
|
|
|
|
p_meta = p_first[index_meta:]
|
|
p_meta = p_meta[len(signature) + 3 :]
|
|
|
|
index_meta_last = p_meta.find(b" ")
|
|
if index_meta_last == -1:
|
|
return False
|
|
|
|
p_meta = p_meta[index_meta_last + 1 :]
|
|
|
|
index_meta_last = p_meta.find(b" ")
|
|
if index_meta_last == -1:
|
|
return False
|
|
|
|
return True
|