Giter VIP home page Giter VIP logo

Comments (7)

westonganger avatar westonganger commented on June 7, 2024

Are you using prawn_document(options) do |pdf| in your view files as described in the readme?

from prawn-rails.

atstockland avatar atstockland commented on June 7, 2024

No I wasn't. My PDFs inherit from "< Prawn::Document" so I don't call "pdf.text"---I just call "text". To use this gem would I place "prawn_document(options) do |pdf|" inside my PdfReport < Prawn::Document class?

from prawn-rails.

westonganger avatar westonganger commented on June 7, 2024

Show an example file / piece of code

from prawn-rails.

atstockland avatar atstockland commented on June 7, 2024
# frozen_string_literal: true
class SamplePdf < Prawn::Document

  def initialize(user_id, options = {})
    super top_margin: 30, left_margin: 50, page_size: 'LETTER', page_layout: :portrait
    define_grid(columns: 2, rows: 16, gutter: 10)

    grid([1,0],[1,1]).bounding_box do
        text "some text"
    end

end

from prawn-rails.

westonganger avatar westonganger commented on June 7, 2024

Should probably work if you change your class name from Prawn::Document to PrawnRails::Document then you shouldnt use super anymore.

from prawn-rails.

westonganger avatar westonganger commented on June 7, 2024

Seems like maybe documentation can be added for this style of usage.

from prawn-rails.

westonganger avatar westonganger commented on June 7, 2024

Ok I've confirmed this all works.

I've written some missing tests for the config feature and I also added tests which use the alternate usage you have described.

I've also added documentation to the readme for this style of usage: https://github.com/cortiz/prawn-rails#without-using-the-prawn_document-helper

Closing.

from prawn-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.