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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:03:57+00:00 2026-06-06T00:03:57+00:00

i´m trying to render PDF with renderpdf grails plugin, but their documentation is very

  • 0

i´m trying to render PDF with renderpdf grails plugin,
but their documentation is very short.

i made a button in my gsp view/file

<button type="button">PDF Me!</button>

and

ByteArrayOutputStream bytes = pdfRenderingService.render(template: "/pdfs/report", model: [data: data])

in a view for binding images

<rendering:inlinePng bytes="${imageBytes}" class="some-class" />

model data is domainInstance and how do i connect the button with this renderpdf?

may be i should more specify my code

def invoice ={
    def vermittlungInstance = Vermittlung.get(params.id)


    def aa = vermittlungInstance.lieferungen.id
    def lieferungInstance = Lieferung.get(aa)

    def bb = lieferungInstance.packete.id // .id
    def packetInstance = Packet.findAllByIdInList(bb)

    if (!vermittlungInstance & !lieferungInstance) {
        flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'vermittlung.label', default: 'Vermittlung'), params.id])}"
        redirect(action: "list")
    }
    else {
        if(vermittlungInstance.rechnungen.id!=null || vermittlungInstance.lieferungen.id!=null || lieferungInstance.packete.id!=null ){
            def a = vermittlungInstance.rechnungen.id
            def rechnungList = Rechnung.findById(a)

            def b = vermittlungInstance.lieferungen.id
            def lieferungList = Lieferung.findById(b)

            def c = lieferungInstance.packete.id
            //println c
            def packetList = Packet.findAllByIdInList(c)//findById(c)

            def d = packetInstance.artikel.id//id
            def artikelList = Artikel.findAllByIdInList(d)//findById(d)

            def e = lieferungInstance.adressen.id
            def adresseList = Adresse.findById(e)

            [vermittlungInstance: vermittlungInstance,
                    rechnungInstanceList:rechnungList,
                    lieferungInstanceList:lieferungList,
                    packetInstanceList: packetList,
                    artikelInstanceList: artikelList,
                    adresseInstanceList: adresseList
            ]



            //System.out.println(c)

        }

        else{

            def rechnungList = Rechnung.all
            def lieferungList = Lieferung.all
            def packetList = Packet.all
            def artikelList = Artikel.all
            def adresseList = Adresse.all

            [vermittlungInstance: vermittlungInstance,
                    rechnungInstanceList:rechnungList,
                    lieferungInstanceList:lieferungList,
                    packetInstanceList: packetList,
                    artikelInstanceList: artikelList,
                    adresseInstanceList: adresseList
            ]
        }



    }

}

this is my def in a controller, i tried to put this renderpdf on many places, but it won’t render the page, actually i am changing some values in html (browser), so it should render in html.

the controller seems to be a wrong place to renderpdf than, but there is no render function for .gsp

thanks

  • 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-06T00:03:59+00:00Added an answer on June 6, 2026 at 12:03 am

    Add a new action which generates the pdf version of your invoice and link them from your view.

    Here is your link:

    <g:link action="downloadInvoice" id="${yourInvoiceID}">Download invoice</g:link>
    

    In your controlle add following:

    def downloadInvoice = {
        def invoice = Invoice.get(params.id) //replace with your logic
    
       renderPdf(template: '/templates/pdf/invoice', model: [invoice: invoice], filename: "yourTitle")
    } 
    

    Your invoice template is a simple gsp view where you could place all your HTML (including images) and CSS:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
        <head>
            <title>Invoice</title>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <link rel="stylesheet" href="${resource(dir:'css',file:'your.css')}" />        
        </head>
        <body>
            <img src="${resource(dir:'images',file:'invoiceLogo.png')}" />
            <h1>Invoice: ${invoice.id}</h1>
             .
             .
             .
        </body>
    </html>    
    

    Hope that example helps!

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

Sidebar

Related Questions

I'm trying to save to databse a pdf file generated by itextsharp. But, I
I'm trying to simply open a PDF from my application when a certain button
I am trying to render PDF content to a GDI device context (a 24bit
Im trying to render PDF pages to images on a background thread, is there
I'm new to programing and trying to open a pdf to view in my
I'm trying to get ghostscript to render a pdf file from a Windows box.
I am trying to extract all the images from a pdf using itextsharp but
I'm trying to isolate the single words in a pdf file, but when reading
I'm trying to render a pdf (with pdf-renderer or jpedal), and it can't handle
I'm trying to use the pdf-reader gem (https://github.com/yob/pdf-reader) on my app (RoR with Mongoid).

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.