Created
April 1, 2020 13:10
-
-
Save arvindvyas/0b2c4d6623aeb634fc130c0e3975d0e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img_paths = ["/Users/workspace/ARVIND/2.jpeg", "/Users/workspace/ARVIND/2.jpeg", "/Users/workspace/ARVIND/REDCAPTIN/2.jpeg"] | |
Prawn::Document.generate("/Users/workspace/ARVIND/red_captain/my-file.pdf") do |pdf| | |
img_paths.each do |img_path| | |
# PDF regions involve bounding boxes. | |
# The default bounding box is simply the page itself. | |
# The :fit option tells Prawn to scale the image to the current | |
# bounding box (in other words, the current page) | |
pdf.image img_path, :fit => [pdf.bounds.right, pdf.bounds.top] | |
# Insert a page break, unless this is the last page | |
pdf.start_new_page unless pdf.page_count == img_paths.length | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment