
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Slim2pdf renders slim template with data hash and saves the results as pdf file.
Add this line to your application's Gemfile:
gem 'slim2pdf'
And then execute:
$ bundle
Or install it yourself as:
$ gem install slim2pdf
require 'slim2pdf'
writer = Slim2pdf::Writer.new
writer.template = 'template.slim'
writer.data = {name: 'John', surname: 'Doe'}
writer = Slim2pdf::Writer.new('template.slim', {name: 'John', surname: 'Doe'})
writer.render_to_html # return rendered html as string
writer.save_to_html('output.html') # saves rendered html to file
writer.save_to_pdf('output.pdf') # saves rendered html as pdf file
writer = Slim2pdf::Writer.new
writer.wkhtmltopdf_path = '/your/path/to/wkhtmltopdf'
Wkhtmltopdf params will be generated automatically.
writer = Slim2pdf::Writer.new
writer.wkhtmltopdf_command = '/bin/some_wrapper /your/path/to/wkhtmltopdf --your --params'
Input (html) and output (pdf) files will be added automatically.
require 'slim2pdf'
writer = Slim2pdf::Writer.new('simple.slim')
writer.save_to_pdf('simple.pdf')
See: doc/examples/simple
writer = Slim2pdf::Writer.new('agreement.slim')
writer.data = {date: '2014-01-14', part1: 'Google', part2: 'Microsoft'}
writer.footer_text = 'Agreement footer'
writer.save_to_pdf('agreement.pdf')
writer = Slim2pdf::Writer.new('invoice.slim')
buyers = ['Buyer A', 'Buyer B', 'Buyer C', 'Buyer D']
buyers.each_with_index do |buyer, index|
number = index + 1
writer.data = {
seller: 'Seller', buyer: buyer, number: "#{number}/2014",
item_name: 'Service', price: '$100', date: '2014-01-14'
}
writer.save_to_pdf("invoice-#{number}.pdf")
end
require 'logger'
writer = Slim2pdf::Writer.new
writer.logger = Logger.new(STDERR)
If you use Slim2pdf with Rails, the Rails.logger will be set automatically.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that slim2pdf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.