Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8841099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:37:42+00:00 2026-06-14T10:37:42+00:00

How can I add a border to an image with Prawn (pdf library)? If

  • 0

How can I add a border to an image with Prawn (pdf library)? If this is possible, can you add padding as well?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:37:43+00:00Added an answer on June 14, 2026 at 10:37 am

    You can add a border using a bounding_box and stroke_bounds. In this example, I’ve put a border around an image. I’ve even given it padding of 15. It should be relatively easy to make this a function where a padding parameter could be used to calculate the difference between the image width and the bounding_box width.

    require 'prawn'
    
    Prawn::Document.generate("test.pdf") do
        text "Boxed Image", :align=>:center, :size=>20
        bounding_box([0, cursor], :width => 330) do
            move_down 15
            image "image.jpg", :fit => [300, 600], :position => :center
            move_down 15
            stroke_bounds
        end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I want to add a border to galleria big image. How can I
can you set the the image size of this control with css? <img style=border-width:
Can I add colored border or frame to an image (not Image View) at
how can i add media player without controls and border in visual basic....
We can add an image to an photo album using UIImage *img = [UIImage
I wrote library which can add and update objects in salesforce. I use beatbox
i would like to add an image that acts like a border after every
I know that in IE9 I can add more than one image in a
I'm trying to format my ListBoxItem template to include a image. I can add
I need some JQuery code so that I can add a CSS border to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.