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 7035097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:15:51+00:00 2026-05-28T01:15:51+00:00

I need to generate a barcode png/image using Barby , and then show the

  • 0

I need to generate a barcode png/image using Barby, and then show the image in a view.

I can create a barcode PNG image like this Barby::Code39.new("STRING", true).to_png

Which returns a string like:

\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x03`\x00\x00\x00x\x01\x00\x00\
\xD0Mj\x83@\x00\xC5\xF1\x92\xBB\x98\xA2\x90\xEE\xDA;\xE8\xC4,Fi\xC8\x98m\v
D\xAE\x01\xA5\xF10)^\xC2E\xF2\xDE\xFA\x0F?x\xB3\xEB\x84\x9B=L8`\xC0\x80M\x
8\xAF\x15\x0F\x997\x88\xBC-\xE7\xA9\x8C\b\xDF:u\x7F\xFEl\xD4^F\xD6\x989}[\
\xEBL\x8A\x15\x0F<oX\xAE\xDB\xEC}\xCC\xC2\xC4[\xDE\xF4\x8D\xC0\x80\x01\x03
80\x01\x03\x06\f\x180`\xC0\x80\x01\x03\x06\f\x180`\xC0\x80\x01\x03\x06\f\x
CD\xD0\xA2\xAF\xC7$\x15\x85\xC6|\xD3\xBD\x844V\xC9\xAE\xB2\xF5\xC5\x9BE64n

Since I’m using Heroku/Sinatra, it’s possible to create the file with t = Tempfile.new("temp"); t.write ... but when I call t.path in the view I get something like /tmp/qimst7, and of course it’s a 404 error.

How do I show the PNG image in the view?

  • 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-05-28T01:15:52+00:00Added an answer on May 28, 2026 at 1:15 am

    I know it’s an extra step, but since you’re using Heroku, an S3 account might not be a bad idea. It’s free for a year as long as you keep your data under 5GB and your requests under 20,000/month. You could just drop the png there temporarily and delete it after a certain period of time.

    If you’re just using it on the fly and don’t want to cache or store it anywhere, you may be able to set the Content-Type header:

    headers 'Content-Type' => 'img/png'
    

    and then return that data directly. This would need to be from a different route, though, which you would reference from an img tag in your view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to generate 1D barcode image and set it to ImageView according to
Im using http://www.ashberg.de/php-barcode/ scripts to generate a barcode. I now need to import the
I need generate action links outside controllers. I can use Html.Action in Views, Url.Action
I need to generate some passwords, I want to avoid characters that can be
I need to generate a directory in my makefile and I would like to
I need to generate a .PO file from a .properties file using msgcat from
I need to generate real Spotify playlists (not a text string that you can
I'm using pyBarcode to generate PNGs and the number below the barcode is getting
Can someone point in the right direction for printing barcode labels using Java? I
I am using iTextSharp in my application to generate a barcode. Though everything is

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.