Thé*_*det 3 pdf ruby-on-rails docx prawn
我需要创建一个应用程序,它从字段中生成自动生成的CV.我需要将它们转换为PDF/HTML/DOC,但有许多宝石可用.
您认为哪种宝石最适合制作PDF,HTML和DOC格式的简历?
我找到了PDF的大虾,但它是否最适合制作类似CV的PDF?
先感谢您.
编辑:我找到了一个类似于Prawn的宝石,但是对于docx,也许你会感兴趣. https://github.com/trade-informatics/caracal/
用于创作PDF文件
我会和Prawn一起讨论Wicked-PDF.
我知道邪恶更方便,但是Prawn既是原生的又是更灵活的.
Wicked依赖于wkhtmltopdf并使用系统调用 - 系统调用可能会导致并发问题,并且就性能而言是昂贵的.
哪一个你使用,我可能会添加CombinePDF混合.(我有偏见)
这将允许您使用模板PDF文件 - 因此您可以使用Prawn或Wicked编写您的简历,并使用CombinePDF gem将其投放到设计精美的模板上.
CombinePDF也可用于创建简单的文本对象,数字页面或写表...
require 'combine_pdf'
pdf = CombinePDF.new
pdf.new_page.textbox "Hello World!", font_size: 18, opacity: 0.75
pdf.save 'test.pdf' # use pdf.to_pdf to render the PDF into a String object.
Run Code Online (Sandbox Code Playgroud)
...但我认为Prawn是一个更好的创作工具,而CombinePDF是一个很好的补充库,可以添加预制内容和设计:
require 'combine_pdf'
# get a "stamp" or page template.
# the secure copy will attempt to change the PDF data to avoid name conflicts.
template = CombinePDF.load(template_file_path).pages[0].copy(true)
# move the Prawn document into CombinePDF
pdf = CombinePDF.parse prawn_document.render
# add the template to each page, putting the template on the bottom
# (#>> for bottom vs. #<< for top)
pdf.pages.each {|page| page >> template}
# save the pdf file
pdf.save 'final.pdf' # or render to string, for sending over HTTP: pdf.to_pdf
Run Code Online (Sandbox Code Playgroud)
至于docx,我是无能为力的......坦率地说,这是一种专有的格式,在逆向工程时通常会出现问题.我会避免它,让人们复制并粘贴HTML,如果他们真的想要的话.
| 归档时间: |
|
| 查看次数: |
8023 次 |
| 最近记录: |