Skip to content

Commit

Permalink
Merge pull request #29 from hhandoko/feature/play27_support
Browse files Browse the repository at this point in the history
Feature - Play Framework 2.7 support
  • Loading branch information
hhandoko authored Mar 29, 2019
2 parents 0fe9ea2 + 149a34a commit 2f932f6
Show file tree
Hide file tree
Showing 41 changed files with 22,013 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Master Build Status](https://travis-ci.org/hhandoko/play2-scala-pdf.svg?branch=master)](https://travis-ci.org/hhandoko/play2-scala-pdf)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.hhandoko/play26-scala-pdf_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.hhandoko/play26-scala-pdf_2.12)

# Play [2.4 | 2.5 | 2.6] PDF module
# Play [2.4 to 2.7] PDF module

`play2-scala-pdf` is a Play Framework module to help generate PDF documents dynamically from Play Framework web application.

Expand All @@ -17,6 +17,7 @@ The supported Scala and Play versions as follows:
| Play 2.4 | `YES` | `YES` | |
| Play 2.5 | | `YES` | |
| Play 2.6 | | `YES` | `YES` |
| Play 2.7 | | `YES` | `YES` |

### Play Framework Java

Expand All @@ -40,7 +41,7 @@ Currently, the module is hosted at Maven Central Repository. Include the followi
``` scala
libraryDependencies ++= Seq(
...
"com.hhandoko" %% "play26-scala-pdf" % "4.0.0" // Use `play25-scala-pdf` for Play 2.5.x apps or `play24-scala-pdf` for Play 2.4.x apps
"com.hhandoko" %% "play27-scala-pdf" % "4.1.0" // Use `play26-scala-pdf` for Play 2.6.x apps, etc.
)
```

Expand Down
249 changes: 249 additions & 0 deletions examples/play27-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
###
# File : .gitignore
# License :
# The MIT License (MIT)
#
# Original - Copyright (c) 2014 Jöerg Viola, Marco Sinigaglia
# Derivative - Copyright (c) 2016 - 2019 play2-scala-pdf Contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
###

# Created by https://www.gitignore.io/api/windows,osx,linux,intellij,eclipse,netbeans,scala,sbt,sass,playframework

### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk


### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Linux ###
*~

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*


### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio

.idea/modules/root-build.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties


### Eclipse ###
*.pydevproject
.metadata
.gradle
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.cache-main
.cache-tests

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific
.buildpath

# sbteclipse plugin
.target

# TeXlipse plugin
.texlipse


### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/


### Scala ###
*.class
*.log

# sbt specific
.cache
.history
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/

# Scala-IDE specific
.scala_dependencies
.worksheet


### SBT ###
# Simple Build Tool
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control

target/
lib_managed/
src_managed/
project/boot/
.history
.cache


### Sass ###
.sass-cache/
*.css.map


### PlayFramework ###
# Ignore Play Framework working directory #
db/
.eclipse
lib/
logs/
modules/
project/project/
project/target/
target/
tmp/
test-result
server.pid
*.iml
*.eml
dist/
.cache/


### Others ###
RUNNING_PID
54 changes: 54 additions & 0 deletions examples/play27-example/app/com/hhandoko/ApplicationModule.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* File : ApplicationModule.scala
* License :
* The MIT License (MIT)
*
* Original - Copyright (c) 2014 Jöerg Viola, Marco Sinigaglia
* Derivative - Copyright (c) 2016 - 2019 play2-scala-pdf Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.hhandoko

import com.google.inject.{AbstractModule, Provides}
import net.codingwell.scalaguice.ScalaModule

import _root_.play.api.Environment

import com.hhandoko.play.pdf.PdfGenerator

class ApplicationModule extends AbstractModule with ScalaModule {

/** Module configuration + binding */
override def configure(): Unit = {}

/**
* Provides PDF generator implementation.
*
* @param env The current Play app Environment context.
* @return PDF generator implementation.
*/
@Provides
def providePdfGenerator(env: Environment): PdfGenerator = {
val pdfGen = new PdfGenerator(env)
pdfGen.loadLocalFonts(Seq("fonts/opensans-regular.ttf"))
pdfGen
}

}
Loading

0 comments on commit 2f932f6

Please sign in to comment.