GithubHelp home page GithubHelp logo

oophpdf's People

Contributors

djolly avatar gchildsei avatar mhiley avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mhiley

oophpdf's Issues

Update drawable classes to set up/restore context in uniform way

All of the drawable classes, such as MultiCell, tend to require setting up the TCPDF context to get metrics and actually draw the item.

Here is my plan for managing the context:

  • When setting up the context, only set properties that were specified by the caller. For example, only set the font size if the caller set a font size on the object.
  • After the method that needs to set up the context is done using the context (for example, done drawing), it should restore the context.
  • To restore the context, it should revert only the properties that it changed back to their previous values. For example, if before setting up the context the font size was 12 and when setting up the context we set it to 24, it should be restored to 12.

Benefits:

  • A TCPDF property that isn't used by the caller behaves the same as a property that isn't implemented in a class. For example, if line-height isn't implemented in the class, we end up drawing with the current line-height in the TCPDF object. If we don't set a font size, a property which is implemented in the class, we end up drawing with the current font size from the TCPDF object. Of course some class properties, like the text of a MultiCell, should have reasonable defaults, such as the empty string, since it isn't a TCPDF property.
  • Using one of these drawable classes doesn't affect the TCPDF context. We leave things exactly as we found them, so we play nicely with the rest of the user's PDF writing code.

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.