Skip to content

Commit

Permalink
Set PDF title metadata to @filename (cortiz#24)
Browse files Browse the repository at this point in the history
The browser tab title is taken from the PDF documents Title metadata attribute. This now sets the Title attribute of the metadata based on the @filename without the file extension.
  • Loading branch information
westonganger authored and cortiz committed Jan 17, 2017
1 parent f1e3b20 commit da56c51
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/prawn-rails/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ module PrawnRails
module RailsHelper
def prawn_document(options={})
options.reverse_merge!(:page_layout => PrawnRails.config.page_layout,
:page_size => PrawnRails.config.page_size)
:page_size => PrawnRails.config.page_size,
:info => {
:Title => @filename.sub(/\.(p|P)(d|D)(f|F)$/, '')
})

options.reverse_merge!(:skip_page_creation => true) if PrawnRails.config.skip_page_creation

Expand Down

0 comments on commit da56c51

Please sign in to comment.