I have combined two pdf
files as follows
pdf = CombinePDF.new
pdf << CombinePDF.parse(Net::HTTP.get_response(URI.parse(@task.assignable.pdf_file.try(:file).try(:url))).body, allow_optional_content: true)
pdf << CombinePDF.load(file1_path) # one way to combine, very fast.
pdf.save "combined.pdf"
I can check and see my combined file by downloading as follows:
send_data pdf.to_pdf, filename: "combined.pdf", type: "application/pdf"
This all working fine but I want to store this pdf in @signed_pdf
record.
It is allowing to to store the pdf in my record as follow:
@signed_pdf.signed_file = pdf.to_pdf
but it seems not to good approach. I want to store it as object.
@signed_pdf.signed_file = pdf
but in this case using @signed_pdf.signed_file.to_pdf
for downloading purpose or any other purpose showing the error:
undefined method `to_pdf' for "#<CombinePDF::PDF:0x000000000dabd5d0>":String Did you mean? to_f to_d
What would be the beeter way to store combined pdf
in my record?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…