GithubHelp home page GithubHelp logo

prawn-templates's People

Contributors

fale avatar mckramer avatar mojavelinux avatar ndbroadbent avatar nspring avatar packetmonkey avatar petergoldstein avatar pevik avatar pointlessone avatar practicingruby avatar wkirby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prawn-templates's Issues

page layout ignored when generating pdf from template pdf

This is a prawnpdf/prawn#293. I ran into this issue and figured out the cause and a workaround that I'm using via monkey patching. I'm posting my analysis of the bug here since apparently there's an attempt to revive the templates code.

The problem lives in PDF::Core::Page. Basically when templates are used, the size instance variable does not get set, so calls to page.size just return the dimensions. However, when this value is fed back into Page.new to create a new page, it reverses the coordinates if the layout is landscape. Since page.size already gives you the coordinates in landscape, reversing them makes it portrait. The below change to the method ensures that the size method always returns coordinates as if the layout was portrait

module PDF
  module Core
    class Page
      def size
        return @size if defined?(@size) && @size

        case(layout)
        when :portrait
           dimensions[2,2]
        when :landscape
           dimensions[2,2].reverse
        end
      end
    end
  end
end

This would be tricky to fix for real since it's in pdf core, but it might represent a legitimate bug there too.

Version 0.1.2 messing up (cross-OS) rendering

After updating we started seeing our PDFs (UNIX-generated) stopped working in Windows machines. Apparently a font issue, but we did nothing other than update the gem version...

See Expected and Result pictures attached (details blurred out purposefully).

Actual
Expected

Still maintained?

@pointlessone Is this repo still maintained as part of the prawnpdf set? Should I get it working with GitHub Actions, prawn-dev, etc?

Redefine PDF::Core methods without causing a warning

There are ways in Ruby to override a method without generating a warning. Please consider using one of those approaches to override the methods in PDF::Core. This will avoid the following warnings:

../gems/prawn-templates-0.0.5/lib/pdf/core/document_state.rb:4: warning: method redefined; discarding old initialize
../gems/pdf-core-0.7.0/lib/pdf/core/document_state.rb:4: warning: previous definition of initialize was here
../gems/prawn-templates-0.0.5/lib/pdf/core/object_store.rb:4: warning: method redefined; discarding old initialize
../gems/pdf-core-0.7.0/lib/pdf/core/object_store.rb:16: warning: previous definition of initialize was here
../gems/prawn-templates-0.0.5/lib/pdf/core/page.rb:4: warning: method redefined; discarding old initialize
../gems/pdf-core-0.7.0/lib/pdf/core/page.rb:24: warning: previous definition of initialize was here
../gems/prawn-templates-0.0.5/lib/pdf/core/page.rb:43: warning: method redefined; discarding old dimensions
../gems/pdf-core-0.7.0/lib/pdf/core/page.rb:150: warning: previous definition of dimensions was here

Here are some strategies:

Prawn content is vertically mirrored for PDFs exported by Google Chrome

I've collected the following links that demonstrate the problem:

There's also a very comprehensive StackOverflow answer that might explain what's going on.

See also:

This is a critical issue for my app, so I will attempt to fix it myself. I'll submit a PR if I manage to solve the problem. Any assistance would be greatly appreciated!

Can't modify frozen array with Prawn 2.2.0

This change to prawn will result in:

RuntimeError: can't modify frozen array
       << at org/jruby/RubyArray.java:1240
   <main> at /home/tyler/source/github/jenkins-infra/jenkins.io/build/tmp/asciidoctor/gems/prawn-templates-0.0.3/lib/prawn/templates.rb:246
  require at org/jruby/RubyKernel.java:961
  require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
   <main> at /home/tyler/source/github/jenkins-infra/jenkins.io/build/tmp/asciidoctor/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf/converter.rb:1
  require at org/jruby/RubyKernel.java:961
   (root) at /home/tyler/source/github/jenkins-infra/jenkins.io/build/tmp/asciidoctor/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf/converter.rb:10
   <main> at uri:classloader:/jruby/kernel/kernel.rb:1
  require at org/jruby/RubyKernel.java:961
  require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
   <main> at uri:classloader:/jruby/kernel/kernel.rb:13
     load at org/jruby/RubyKernel.java:979
   <main> at /home/tyler/source/github/jenkins-infra/jenkins.io/build/tmp/asciidoctor/bin/asciidoctor-pdf:22

Since prawn-template tries to append to the, now frozen, Prawn::Document::VALID_OPTIONS array.

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.