Add a footer to each document and create a single .pdf file all in one command.
### Example 1
**Filename**:
```5--HEADING--Subheadline.png```
```ruby
{
footer__table__left__top__text: '<<--ENUMERATOR_INTEGER-->>. <<--HEADLINE-->>',
footer__table__left__bottom__text: '<<--TIMESTAMP-->>',
footer__table__center__top__text: '',
footer__table__center__bottom__text: '',
footer__table__right__top__text: '<<--PAGE_CURRENT-->>',
footer__table__right__bottom__text: '',
}
```
**Output**
### Example 2
**Filename**:
```5--HEADING--Subheadline.png```
```ruby
{
footer__table__left__top__text: '<<--ENUMERATOR_ROMAN-->>. <<--HEADLINE-->>',
footer__table__left__bottom__text: '<<--SUBHEADING-->>',
footer__table__center__top__text: 'Application',
footer__table__center__bottom__text: 'John Doe',
footer__table__right__top__text: '<<--TIMESTAMP-->>',
footer__table__right__bottom__text: '<<--PAGE_CURRENT-->> of <<--PAGE_TOTAL-->>',
selectors__timestamp__strf: '%A, %e %B %Y'
}
```
**Output**
### Example 3
**Filename**:
```5--HEADING--Subheadline.png```
```ruby
{
footer__table__left__top__text: '<<--TIMESTAMP-->>',
footer__table__left__bottom__text: '',
footer__table__center__top__text: '<<--ENUMERATOR_CHAR-->> <<--HEADLINE-->>',
footer__table__center__bottom__text: '',
footer__table__right__top__text: '<<--PAGE_CURRENT-->>',
footer__table__right__bottom__text: '',
}
```
1. [Quickstart](#quickstart)
2. [Parameters](#parameters)
3. [Options](#options)
4. [Selectors](#selectors)
5. [Contributing](#contributing)
6. [Limitations](#limitations)
7. [Credits](#credits)
8. [License](#license)
9. [Code of Conduct](#code-of-conduct)
10. [Support my Work](#support-my-work)
```ruby
require 'documents_with_footer_to_pdf'
your_folder = './1-test/'
DocumentsWithFooterToPdf.generate(
your_folder,
:short,
{}
)
```
Add this line to your application's Gemfile:
```ruby
gem 'documents_with_footer_to_pdf'
```
And then execute:
$ bundle install
Or install it yourself as:
$ gem install documents_with_footer_to_pdf
On Rubygems:
- Gem: https://rubygems.org/gems/test
- Profile: https://rubygems.org/profiles/a6b8
### .get_options()
```ruby
require 'documents_with_footer_to_pdf'
hash = DocumentsWithFooterToPdf.get_options()
# => { path:
```
### .generate()
```ruby
require 'documents_with_footer_to_pdf'
hash = DocumentsWithFooterToPdf.generate(
folder,
console_mode,
options
)
```
**Input**
| **Type** | **Required** | **Description** | **Example** | **Description** |
|------:|:------|:------|:------|:------|
| **headline** | ```String``` | Yes | "./test/" | Define path to folder |
| **console mode** | ```Symbol``` | Yes | ```:hash``` | Set test console output mode. Use ```:silent```, ```:short```, or ```:detail``` |
| **options** | ```'Hash'``` | No | ```{}``` | Change defaut options, please refer: Options for more info |
**Return**
Boolean
### Path
| Nr | Name | Key | Default | Type | Description |
| :-- | :-- | :-- | :-- | :-- | :-- |
| A.1. | Children Tmp Name |:path__children__tmp__name | `"tmp-{{SALT}}"` | String | Change temporary folder name, {{SALT}} will replaced with current unix timestamp |
| A.2. | Children Pdf_combined Name |:path__children__pdf_combined__name | `"0-result-{{SALT}}"` | String | Change result folder name, {{SALT}} will replaced with current unix timestamp |
### Footer
| Nr | Name | Key | Default | Type | Description |
| :-- | :-- | :-- | :-- | :-- | :-- |
| B.1. | Position Top |:footer__position__top | `[0, 20]` | Array | Set footer position top. |
| B.2. | Position Bottom |:footer__position__bottom | `[0, 10]` | Array | Set footer position bottom. |
| B.3. | Table Left Top Text |:footer__table__left__top__text | `"<<--FILENAME-->>"` | String | Set text in field left-top |
| B.4. | Table Left Bottom Text |:footer__table__left__bottom__text | `""` | String | String | Set text in field left-bottom |
| B.5. | Table Center Top Text |:footer__table__center__top__text | `""` | String | String | Set text in field center-top |
| B.6. | Table Center Bottom Text |:footer__table__center__bottom__text | `""` | String | String | Set text in field center-bottom |
| B.7. | Table Right Top Text |:footer__table__right__top__text | `"<<--TIMESTAMP-->>"` | String | String | Set text in field right-top |
| B.8. | Table Right Bottom Text |:footer__table__right__bottom__text | `"<<--PAGE_CURRENT-->> from <<--PAGE_TOTAL-->>"` | String | String | Set text in field right-bottom |
### Selectors
| Nr | Name | Key | Default | Type | Description |
| :-- | :-- | :-- | :-- | :-- | :-- |
| C.1. | Timestamp Gsub |:selectors__timestamp__gsub | `"<<--TIMESTAMP-->>"` | String | Change marker for timestamp. |
| C.2. | Timestamp Strf |:selectors__timestamp__strf | `"%d.%m.%Y"` | String | Change format of date and time |
| C.3. | Page_current Gsub |:selectors__page_current__gsub | `"<<--PAGE_CURRENT-->>"` | String | Change marker for current page. |
| C.4. | Page_total Gsub |:selectors__page_total__gsub | `"<<--PAGE_TOTAL-->>"` | String | Change marker for total page size |
| C.5. | Enumerator_original Gsub |:selectors__enumerator_original__gsub | `"<<--ENUMERATOR_ORIGINAL-->>"` | String | Change marker for original enumeration |
| C.6. | Enumerator_integer Gsub |:selectors__enumerator_integer__gsub | `"<<--ENUMERATOR_INTEGER-->>"` | String | Change marker for integer enumeration |
| C.7. | Enumerator_char Gsub |:selectors__enumerator_char__gsub | `"<<--ENUMERATOR_CHAR-->>"` | String | Change marker for char enumeration |
| C.8. | Enumerator_roman Gsub |:selectors__enumerator_roman__gsub | `"<<--ENUMERATOR_ROMAN-->>"` | String | Change marker for roman letters enumeration |
| C.9. | Filename Gsub |:selectors__filename__gsub | `"<<--FILENAME-->>"` | String | Change marker for filename |
| C.10. | Path Gsub |:selectors__path__gsub | `"<<--PATH-->>"` | String | Change marker for full path |
| C.11. | Heading Gsub |:selectors__heading__gsub | `"<<--HEADLINE-->>"` | String | Change marker for headline |
| C.12. | Subheading Gsub |:selectors__subheading__gsub | `"<<--SUBHEADING-->>"` | String | Change marker for sub headline |
More Information on ```strf``` format: https://apidock.com/ruby/DateTime/strftime
### Params
| Nr | Name | Key | Default | Type | Description |
| :-- | :-- | :-- | :-- | :-- | :-- |
| D.1. | Footer Font_size |:params__footer__font_size | `9` | Integer | Set footer font size |
| D.2. | Document Width |:params__document__width | `500` | Integer | Set document width |
| D.3. | Image Density |:params__image__density | `300` | Integer | Set image density |
| D.4. | Search Subfolders |:params__search__subfolders | `false` | Boolean | Set if subfolders should be included in search |
| D.5. | Search Suffixs |:params__search__suffixs | `["jpg", "png", "pdf"]` | Array | Types of suffixes which are included (Supported jpg, png, pdf) |
| D.6. | Console Length |:params__console__length | `50` | Integer | Change length of console output |
Filename: ```C--HEADING--Subheadline.png```
> Use double hyphens '--' as limiter
| Selector | Example | Description |
| :--- | :--- | :--- |
| ```"<<--TIMESTAMP-->>"``` | 24.05.2021 | Show current Timestamp, to change for format use option: :selectors__timestamp__strf |
| ```"<<--PAGE_CURRENT-->>"``` | ```1``` | Show current Page |
| ```"<<--PAGE_TOTAL-->>"``` | ```3``` | Show total Page size |
| ```"<<--ENUMERATOR_ORIGINAL-->>"``` | ```"C"``` | Show original Enumerator |
| ```"<<--ENUMERATOR_INTEGER-->>"``` | ```3``` | Show Enumerator as Integer |
| ```"<<--ENUMERATOR_CHAR-->>"``` | ```"C"``` | Show Enumerator as Char |
| ```"<<--ENUMERATOR_ROMAN-->>"``` | ```"III"``` | Show Enumerator in Roman Letters |
| ```"<<--FILENAME-->>"``` | ```"C--HEADING--Subheadline.png"``` | Show filename |
| ```"<<--PATH-->>"``` | ```"../C--HEADING--Subheadline"``` | Show file path|
| ```"<<--HEADLINE-->>"``` | ```"HEADING"``` | Show Headline |
| ```"<<--SUBHEADING-->>"``` | ```"Subheading"``` | Show Subheading |
Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/documents-with-footer-to-pdf. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/a6b8/documents-with-footer-to-pdf/blob/master/CODE_OF_CONDUCT.md).
- Made for local usage
- Some pdf fonts are not supported.
This gem depend on following gems:
- **local_path_builder**
https://github.com/a6b8/local-path-builder-for-ruby
- **FileUtils**
https://ruby-doc.org/stdlib-2.4.1/libdoc/fileutils/rdoc/FileUtils.html
- **combine_pdf**
https://github.com/boazsegev/combine_pdf
- **prawn**
https://github.com/prawnpdf/prawn
- **image magick**
https://imagemagick.org/script/convert.php
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
Everyone interacting in the documents-with-footer-to-pdf project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a6b8/documents-with-footer-to-pdf/blob/master/CODE_OF_CONDUCT.md).
Donate by [https://www.paypal.com](https://www.paypal.com/donate?hosted_button_id=XKYLQ9FBGC4RG)