我目前正在使用 Prawn 和 CombinePDF 开发 Ruby on Rails 5.2 应用程序。我请求将文件发送到 Box api。我从框中得到的文件然后转换为字符串StringIO.new(image),然后使用它添加到虾文档中,如图所示。
attach_docs_from_submission(user_data).each do |file|
image = client.download_file(file)
format_image = StringIO.new(image)
pdf_prawn = Prawn::Document.new
pdf_prawn.image format_image
pdf_data = pdf_prawn.render
pdf << CombinePDF.parse(pdf_data)
end
有没有办法适合全尺寸的图像?问题是来自 Prawn 还是 CombinePDF?
