Coder Social home page Coder Social logo

play2-scala-pdf's People

Contributors

fhars avatar gertv avatar hhandoko avatar joergviola avatar marcosinigaglia avatar mgosk avatar raisercostin avatar wolfert 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

play2-scala-pdf's Issues

Scala 2.13 release

Play 2.7.3 is compiled against Scala 2.13, and scalatestplus-play is also available for 2.13, so I think it should be possible to release play2-scala-pdf as well.

Thanks!

Chore - Update Play Framework 2.4 and 2.5 to latest

Context

Play Framework 2.5 branch's latest version is 2.5.15 and 2.4 branch is 2.4.11. The module and examples are several patch versions behind.


Definition of Done

The module and examples are updated to the latest Play Framework version.

Chore - Update `flying-saucer` version

Context

The latest flying-saucer library is available, which fixes issues with broken links to older bouncycastle dependencies.


Definition of Done

Update flying-saucer to version9.1.6 on both modules (Play 2.4 and 2.5).

Arabic characters not converted to PDF

Expected Behaviour

Aabic Charaters are not converted to pdf format


Actual Behaviour

Arabic text is left blank on pdf file, while it's correctly displayed on html format:
image


Steps to Reproduce

1- set an exemle.scala.html with arabic characters
2- Load an arabic font in ApplicationModule.scala using pdfGen.loadLocalFonts(Seq("fonts/TAHOMA_0.TTF"))
-->

Bundled `routes` file overrides root / parent project routes

Expected Behaviour

Application pages should be able to be accessed normally after importing the PDF generation library.


## Actual Behaviour

Play framework shows Action not found info page instead of the desired application page.


## Steps to Reproduce 1. Import the library and use it in an existing project (or new project with defined routes) 2. Try to access the existing project route (e.g. `/` or `/login`) 3. Observe `Action not found` info page will be displayed.

Failure to build: Could not find a suitable constructor in com.hhandoko.play.pdf.PdfGenerator.

Expected Behaviour

A simple project should build.


Actual Behaviour

Could not find a suitable constructor in com.hhandoko.play.pdf.PdfGenerator. 

Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument 
constructor that is not private.
 at com.hhandoko.play.pdf.PdfGenerator.class(PdfGenerator.scala:53)

Steps to Reproduce

build.sbt

 name := "testpdf"
 version := "1.0" 
 lazy val `testpdf` = (project in file(".")).enablePlugins(PlayScala)
resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases"
resolvers += "Akka Snapshot Repository" at "http://repo.akka.io/snapshots/"
scalaVersion := "2.12.2"
libraryDependencies ++= Seq( jdbc , ehcache , ws , specs2 % Test , guice,
"com.hhandoko" %% "play2-scala-pdf" % "3.0.0.P26"  )
unmanagedResourceDirectories in Test <+=  baseDirectory ( _ /"target/web/public/test" )  

HomeController.scala

package controllers

import com.hhandoko.play.pdf.PdfGenerator
import javax.inject._
import play.api.mvc._

/**
 * This controller creates an `Action` to handle HTTP requests to the
 * application's home page.
 */
@Singleton
class HomeController @Inject()(pdfGen:PdfGenerator,cc: ControllerComponents) extends 
AbstractController(cc) {

  /**
  * Create an Action to render an HTML page with a welcome message.
  * The configuration in the `routes` file means that this method
  * will be called when the application receives a `GET` request with
  * a path of `/`.
  */
  def index = Action {
   pdfGen.ok(views.html.index("Your new application is ready."),"http://localhost:9000")
 }

 }

Exception thrown when trying out the provided example

Context

Running you example, I would expect it to work, instead I experience the following exception:
Could not find a suitable constructor in com.builtamont.play.pdf.PdfGenerator. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at com.builtamont.play.pdf.PdfGenerator.class(PdfGenerator.scala:53)
while locating com.builtamont.play.pdf.PdfGenerator

Also, this coed does not compile since your "example" template expect a message, and you call it without.


Definition of Done

Working code, or updated documentation that explain the use of inject into HomeController

Is it possible to get rid of the margin on the generated PDF?

Hi,

I'm trying to generate a PDF using this HTML:

<html>
<head>
<style>
  body {background-color: grey; margin: 0 }
</style>
</head>
<body>
 Howdy!
 <br/><br/>
 You may not know it yet, but this is best PDF in the world!
 <br/><br/>
 Keep it green!
</body>
</html>

and feeding it into the PdfGenerator.toBytes method. However, the PDF that gets generate always has a white margin around the body.

For this specific toy example, I wanted the whole page to have a grey background. Is this possible? Maybe I'm missing any specific CSS (definitely not my strongest asset).

Thanks!

Scala 2.12 version?

Hi!

Do you have any plans for releasing the version for Scala 2.12? It seems that the library already works fine with Play 2.6, but a proper release that supports new Scala would be great.

Thanks!

Support for PDF encryption

It would be nice to add support for PDF encryption (which the underlying rendering library already implements).
I imagine this would be exposed via optional parameters to the toBytes and toStream generator methods.

Replace dependency on itextpdf with openpdf

Outcome Desired

Remove dependency on itextpdf, as its licensing requirements are restrictive. Replace with dependencies to openpdf.

https://github.com/LibrePDF/OpenPDF


In build.sbt
libraryDependencies += "org.xhtmlrenderer" % "flying-saucer-pdf" % "9.1.6"
libraryDependencies += "org.xhtmlrenderer" % "flying-saucer-core" % "9.1.6"
libraryDependencies += "com.github.librepdf" % "openpdf" % "1.0.4"

Definition of Done

  • All tests pass
  • PDF examples are generated as before
  • itextpdf-*.jar is no longer required

How to Demo

Confirm all test cases complete successfully.

flyingsaucer update 9.1.18

Hi, i would like to use the library (with Play 2.6 and scala 2.11) for creating PDFs. Unfortunately there is still a bug with box sizing which should be fixed with the flyingsaucer v9.1.18 release.
Can you update the version?

Vertical text

Outcome Desired

Write vertical text in @right-middle.

I tried

@@right-middle {
  content: "test;
  writing-mode: vertical-rl;
}

But it doesn't work. Any suggestion?

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.