add pdf/a-3b
This commit is contained in:
@@ -88,6 +88,10 @@ module Docuseal
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pdf_format
|
||||||
|
@pdf_format ||= ENV['PDF_FORMAT'].to_s.downcase
|
||||||
|
end
|
||||||
|
|
||||||
def trusted_certs
|
def trusted_certs
|
||||||
@trusted_certs ||=
|
@trusted_certs ||=
|
||||||
ENV['TRUSTED_CERTS'].to_s.gsub('\\n', "\n").split("\n\n").map do |base64|
|
ENV['TRUSTED_CERTS'].to_s.gsub('\\n', "\n").split("\n\n").map do |base64|
|
||||||
|
|||||||
@@ -81,7 +81,12 @@ module Submissions
|
|||||||
end
|
end
|
||||||
|
|
||||||
composer = HexaPDF::Composer.new(skip_page_creation: true)
|
composer = HexaPDF::Composer.new(skip_page_creation: true)
|
||||||
composer.document.task(:pdfa) if FONT_NAME == 'GoNotoKurrent'
|
|
||||||
|
if Docuseal.pdf_format == 'pdf/a-3b'
|
||||||
|
composer.document.task(:pdfa, level: '3b')
|
||||||
|
elsif FONT_NAME == 'GoNotoKurrent'
|
||||||
|
composer.document.task(:pdfa)
|
||||||
|
end
|
||||||
|
|
||||||
composer.document.config['font.map'] = {
|
composer.document.config['font.map'] = {
|
||||||
'Helvetica' => {
|
'Helvetica' => {
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ module Submissions
|
|||||||
|
|
||||||
pdf.trailer.info[:Creator] = "#{Docuseal.product_name} (#{Docuseal::PRODUCT_URL})"
|
pdf.trailer.info[:Creator] = "#{Docuseal.product_name} (#{Docuseal::PRODUCT_URL})"
|
||||||
|
|
||||||
|
if Docuseal.pdf_format == 'pdf/a-3b'
|
||||||
|
pdf.task(:pdfa, level: '3b')
|
||||||
|
pdf.config['font.map'] = GenerateResultAttachments::PDFA_FONT_MAP
|
||||||
|
end
|
||||||
|
|
||||||
if pkcs
|
if pkcs
|
||||||
sign_params = {
|
sign_params = {
|
||||||
reason: Submissions::GenerateResultAttachments.single_sign_reason(submitter),
|
reason: Submissions::GenerateResultAttachments.single_sign_reason(submitter),
|
||||||
|
|||||||
@@ -30,6 +30,13 @@ module Submissions
|
|||||||
bold_italic: FONT_BOLD_ITALIC_NAME
|
bold_italic: FONT_BOLD_ITALIC_NAME
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
PDFA_FONT_VARIANS = {
|
||||||
|
none: FONT_NAME,
|
||||||
|
bold: FONT_BOLD_NAME,
|
||||||
|
italic: FONT_NAME,
|
||||||
|
bold_italic: FONT_BOLD_NAME
|
||||||
|
}.freeze
|
||||||
|
|
||||||
SIGN_REASON = 'Signed by %<name>s with DocuSeal.com'
|
SIGN_REASON = 'Signed by %<name>s with DocuSeal.com'
|
||||||
|
|
||||||
RTL_REGEXP = TextUtils::RTL_REGEXP
|
RTL_REGEXP = TextUtils::RTL_REGEXP
|
||||||
@@ -48,6 +55,13 @@ module Submissions
|
|||||||
'Courier' => 1.6
|
'Courier' => 1.6
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
PDFA_FONT_MAP = {
|
||||||
|
FONT_NAME => PDFA_FONT_VARIANS,
|
||||||
|
'Helvetica' => PDFA_FONT_VARIANS,
|
||||||
|
'Times' => PDFA_FONT_VARIANS,
|
||||||
|
'Courier' => PDFA_FONT_VARIANS
|
||||||
|
}.freeze
|
||||||
|
|
||||||
MISSING_GLYPH_REPLACE = {
|
MISSING_GLYPH_REPLACE = {
|
||||||
'▪' => '-',
|
'▪' => '-',
|
||||||
'✔️' => 'V',
|
'✔️' => 'V',
|
||||||
@@ -599,6 +613,11 @@ module Submissions
|
|||||||
|
|
||||||
pdf.trailer.info[:Creator] = info_creator
|
pdf.trailer.info[:Creator] = info_creator
|
||||||
|
|
||||||
|
if Docuseal.pdf_format == 'pdf/a-3b'
|
||||||
|
pdf.task(:pdfa, level: '3b')
|
||||||
|
pdf.config['font.map'] = PDFA_FONT_MAP
|
||||||
|
end
|
||||||
|
|
||||||
sign_reason = fetch_sign_reason(submitter)
|
sign_reason = fetch_sign_reason(submitter)
|
||||||
|
|
||||||
if sign_reason && pkcs
|
if sign_reason && pkcs
|
||||||
|
|||||||
Reference in New Issue
Block a user