From bb18d7ae735cdf546f983575ec28e1cacd6ab6f0 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Mon, 25 Mar 2024 20:35:51 -0500 Subject: [PATCH] Use Version: ImageMagick 7.1.1-29 Q16-HDRI x86_64 21991 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(5.0) Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg jxl lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib zstd Compiler: gcc (4.2) Usage: display [options ...] file [ [options ...] file ...] Image Settings: -alpha option on, activate, off, deactivate, set, opaque, copy transparent, extract, background, or shape -antialias remove pixel-aliasing -authenticate password decipher image with this password -backdrop display image centered on a backdrop -channel type apply option to select image channels -colormap type Shared or Private -colorspace type alternate image colorspace -comment string annotate image with comment -compress type type of pixel compression when writing the image -define format:option define one or more image format options -delay value display the next image after pausing -density geometry horizontal and vertical density of the image -depth value image depth -display server display image to this X server -dispose method layer disposal method -dither method apply error diffusion to image -endian type endianness (MSB or LSB) of the image -filter type use this filter when resizing an image -format string output formatted image characteristics -geometry geometry preferred size and location of the Image window -gravity type horizontal and vertical backdrop placement -identify identify the format and characteristics of the image -immutable displayed image cannot be modified -interlace type type of image interlacing scheme -interpolate method pixel color interpolation method -label string assign a label to an image -limit type value pixel cache resource limit -loop iterations loop images then exit -map type display image using this Standard Colormap -matte store matte channel if the image has one -monitor monitor progress -nostdin do not try to open stdin -page geometry size and location of an image canvas -profile filename add, delete, or apply an image profile -quality value JPEG/MIFF/PNG compression level -quantize colorspace reduce colors in this colorspace -quiet suppress all warning messages -regard-warnings pay attention to warning messages -remote command execute a command in an remote display process -repage geometry size and location of an image canvas (operator) -respect-parentheses settings remain in effect until parenthesis boundary -sampling-factor geometry horizontal and vertical sampling factor -scenes range image scene range -seed value seed a new sequence of pseudo-random numbers -set property value set an image property -size geometry width and height of image -support factor resize support: > 1.0 is blurry, < 1.0 is sharp -texture filename name of texture to tile onto the image background -transparent-color color transparent color -treedepth value color tree depth -update seconds detect when image file is modified and redisplay -verbose print detailed information about the image -visual type display image using this visual type -virtual-pixel method virtual pixel access method -window id display image to background of this window -window-group id exit program when this window id is destroyed -write filename write image to a file Image Operators: -auto-level automagically adjust color levels of image -auto-orient automagically orient image -border geometry surround image with a border of color -clip clip along the first path from the 8BIM profile -clip-path id clip along a named path from the 8BIM profile -colors value preferred number of colors in the image -contrast enhance or reduce the image contrast -crop geometry preferred size and location of the cropped image -decipher filename convert cipher pixels to plain pixels -deskew threshold straighten an image -despeckle reduce the speckles within an image -edge factor apply a filter to detect edges in the image -enhance apply a digital filter to enhance a noisy image -equalize perform histogram equalization to an image -extent geometry set the image size -extract geometry extract area from image -flip flip image in the vertical direction -flop flop image in the horizontal direction -frame geometry surround image with an ornamental border -fuzz distance colors within this distance are considered equal -gamma value level of gamma correction -monochrome transform image to black and white -negate replace every pixel with its complementary color -normalize transform image to span the full range of colors -raise value lighten/darken image edges to create a 3-D effect -resample geometry change the resolution of an image -resize geometry resize the image -roll geometry roll an image vertically or horizontally -rotate degrees apply Paeth rotation to the image -sample geometry scale image with pixel sampling -segment value segment an image -sharpen geometry sharpen the image -strip strip image of all profiles and comments -threshold value threshold the image -thumbnail geometry create a thumbnail of the image -trim trim image edges Image Sequence Operators: -coalesce merge a sequence of images -flatten flatten a sequence of images Miscellaneous Options: -debug events display copious debugging information -help print program options -list type print a list of supported option arguments -log format format of debugging information -version print version information In addition to those listed above, you can specify these standard X resources as command line options: -background, -bordercolor, -mattecolor, -borderwidth, -font, -foreground, -iconGeometry, -iconic, -name, -shared-memory, -usePixmap, or -title. By default, the image format of 'file' is determined by its magic number. To specify a particular image format, precede the filename with an image format name and a colon (i.e. ps:image) or specify the image type as the filename suffix (i.e. image.ps). Specify 'file' as '-' for standard input or output. Buttons: 1 press to map or unmap the Command widget 2 press and drag to magnify a region of an image 3 press to load an image from a visual image directory for company display values --- CHANGELOG.md | 17 +++++++++++++++++ README.md | 2 ++ Rakefile | 4 ++-- examples/invoice.pdf | Bin 13719 -> 13707 bytes examples/receipt.pdf | Bin 14638 -> 14700 bytes examples/statement.pdf | Bin 13526 -> 13522 bytes lib/receipts/base.rb | 6 +++--- 7 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 977e2a4..a6a6a2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ ### Unreleased +* Add `display: []` for configuring company details that are rendered + +```ruby +r = Receipts::Receipt.new( + company: { + name: "Example, LLC", + address: "123 Fake Street\nNew York City, NY 10012", + phone: "(555) 867-5309", + email: "support@example.com", + iban: "123456789", + logo: File.expand_path("./examples/images/logo.png"), + display: [:address, :phone, :email, :iban] + }, + # ... +) +``` + ### 2.3.0 * Add `column_widths:` option to specify line item column widths #35 diff --git a/README.md b/README.md index 2eb2574..e28fce2 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,8 @@ You can pass the following options to generate a PDF: logo: "https://www.ruby-lang.org/images/header-ruby-logo@2x.png" # Downloaded with OpenURI ``` + * `display: []` - Customize the company details rendered. By default, renders `[:address, :phone, :email]` under the company name. Items in the array should be Symbols matching keys in the `company` hash to be displayed. + * `details` - Array of details about the Receipt, Invoice, Statement. Typically, this is receipt numbers, issue date, due date, status, etc. * `line_items` - Array of line items to be displayed in table format. diff --git a/Rakefile b/Rakefile index 29cbf25..214f312 100644 --- a/Rakefile +++ b/Rakefile @@ -36,9 +36,9 @@ task :receipt do address: "123 Fake Street\nNew York City, NY 10012", phone: "(555) 867-5309", email: "support@example.com", - tax_id: "Tax ID: 123456789", + iban: "123456789", logo: File.expand_path("./examples/images/logo.png"), - printable_details: [:tax_id, nil, :address, :phone, :email] + display: [:address, :phone, :email, nil, :iban] }, details: [ ["Receipt Number", "123"], diff --git a/examples/invoice.pdf b/examples/invoice.pdf index db42db095c1f798eac5fedd5c1ead65231aac34c..f9ced245531d3f61dead4d3952251128585ee010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