Hi all, I'm currently working on building an application that uses a FormService, retrieving data from JSON and then parsing it into a PDF form.
Currently, from the JSON response I get a field with notes. The notes field is text that I would like to add into a blank pdf page.
{ "field" => "12345", "value" => "Some text to add to a PDF blank page" }
I would like that text into a Blank PDF.
def pdf_scrie_application(submission)
user_data = submission['data']
binding.pry
pdf = CombinePDF.new
file_name = name_file(submission)
pdf_path = PdfScrie.new(user_data, formstack_fields).export(file_name)
pdf << CombinePDF.load(pdf_path)
attach_docs_from_submission(user_data).each do |file|
data = client.download_file(file)
is_pdf = (data =~ /\%PDF-\d+\.?\d+/) == 0
unless is_pdf
format_image = StringIO.new(data)
pdf_prawn = Prawn::Document.new(page_size: 'LETTER', margin: 0)
pdf_prawn.image(
format_image,
fit: [
PDF_PAGE_WIDTH,
PDF_PAGE_LENGTH
],
position: :center,
position: :center
)
data = pdf_prawn.render
end
pdf << CombinePDF.parse(data)
end
I'm looking for some guidence on how to accomplish this. Any information regarding adding text to a blank page in prawn is highly appreciated