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

  • Home
  • SEARCH
  • 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 8958149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:08:50+00:00 2026-06-15T15:08:50+00:00

My question is that how can we create image form byte array without response.

  • 0

My question is that how can we create image form byte array without response.
currently I am using .

response.setHeader('Content-length', image.imageSize)
            response.contentType = image.imageFormat // or the appropriate image content type
            response.outputStream << image.imageData
            response.outputStream.flush()

but it gave error because we done have an request object as I am running this by back end job

  • 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-15T15:08:51+00:00Added an answer on June 15, 2026 at 3:08 pm

    Don’t know how you are creating your pdf files at the moment, but one way would be using the Grails Rendering Plugin for pdf generation. With this, you could use any view/template to generate a pdf file.

    To send these pdfs from backend you’ll need:

    A View:

    <html>
        <head>...</head>
        <body>
            <h1>Your PDF Content</h2>
            <g:each in="${images}" var="image">
                <img src="${createLink(action:'displayImage', id:image.id)}" alt="${image.name}"/>
            </g:each>
        </body> 
    </html>
    

    An action in your controller:

    def displayImage = {
        def image = Image.get(params.id)
        response.setHeader("Content-disposition", "attachment; filename=${image.name}")
        response.contentType = image?.mimeType
        response.contentLength = image?.data.length
        response.outputStream.write(attachment?.data)
    }
    

    A grails job that sends the multipart mail (using the mail plugin ) with the rendered pdf:

    def execute() {
        def pdfBytes = pdfRenderingService.render(template: '/path/to/your/template', model: [images: yourImages]).toByteArray() 
    
        sendMail {
            multipart true
            to "yourmail"
            subject "yoursubject"
            body (view: "/path/to/your/mailview", model: yourModel) attachBytes "yourTitle.pdf", CH.config.grails.mime.types['pdf'], pdfBytes
        } 
    }
    

    The code is not complete, it just demonstrate the basics.

    Hope that helps!

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

Sidebar

Related Questions

The answer to this SO question says that you can create an api by
I am using ANTLR 3 , I have a question is that How can
I am working currently on a web project where users can create image galleries
I have a C# form that I am creating completely manually (i.e. without using
In Win Form, we can create non-rectangular forms by creating a bitmap that have
When I create a PDF form (for instance using Acrobat) that contains text fields
I have a question that can I use AS400ConnectionPool in Spring if then pls
Just a quick question that I can't seem to find a proper answer to
I have a quick question that I can't seem to find online. I am
This is a really silly question that I can't fine a difinitive answer 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.