Skip to content

Commit

Permalink
V0.2.3: HOTFIX: Fix pdf rendering with playwright (alfa)
Browse files Browse the repository at this point in the history
  • Loading branch information
LimeBeck committed Feb 18, 2024
1 parent 52b86e8 commit a59484c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ Render presentation to pdf via playwright:
jbang revealkt@limebeck.dev pdf ./MyAwesomePresentation.reveal.kts -o myPresentation.pdf
```

[!CAUTION]
For now playwright requires to download chromium at first run via npm
> [!CAUTION]
> For now playwright requires to download chromium first (uses npm)
Playwright documentation: https://playwright.dev/java/docs/browsers

```bash
jbang revealkt@limebeck.dev pdf install-chrome
jbang revealkt@limebeck.dev chrome install
```

Uninstall chrome
```bash
jbang revealkt@limebeck.dev pdf uninstall-chrome
jbang revealkt@limebeck.dev chrome uninstall
```


Expand Down
6 changes: 5 additions & 1 deletion reveal-kt/app/src/jvmMain/kotlin/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ fun main(args: Array<String>) = RevealKtCliApplication()
RunServer(),
InitTemplate(),
BundleToStatic(),
RenderPdf().subcommands(InstallChrome(), UninstallChrome())
RenderPdf(),
Chrome().subcommands(
InstallChrome(),
UninstallChrome(),
),
)
.completionOption()
.main(args)
Expand Down
14 changes: 8 additions & 6 deletions reveal-kt/app/src/jvmMain/kotlin/commands/RenderPdf.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.github.ajalt.clikt.core.context
import com.github.ajalt.clikt.output.MordantHelpFormatter
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.defaultLazy
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.types.file
import com.github.ajalt.clikt.parameters.types.int
Expand All @@ -18,7 +17,6 @@ import dev.limebeck.application.server.runServer
import kotlinx.coroutines.runBlocking
import java.io.File
import java.nio.file.Path
import kotlin.concurrent.thread
import kotlin.io.path.pathString

class RenderPdf : CliktCommand(name = "pdf", help = "Render pdf from presentation") {
Expand All @@ -27,8 +25,8 @@ class RenderPdf : CliktCommand(name = "pdf", help = "Render pdf from presentatio
val basePath: Path? by option("-b", help = "Script dir").path()
val script: File by argument(help = "Script file").file(canBeDir = false, mustBeReadable = true)
val output: File by option("-o", "--output", help = "Output file")
.file(canBeDir = false, mustBeWritable = true)
.defaultLazy { File("./output.pdf") }
.file(canBeDir = false)
.default(File("./output.pdf"))

init {
context {
Expand Down Expand Up @@ -59,13 +57,17 @@ class RenderPdf : CliktCommand(name = "pdf", help = "Render pdf from presentatio
}
}

class InstallChrome : CliktCommand(name = "install-chrome", help = "Install chrome") {
class Chrome: CliktCommand(name = "chrome", help = "Manage chrome installation") {
override fun run() {}
}

class InstallChrome : CliktCommand(name = "install", help = "Install chrome") {
override fun run() {
CLI.main(arrayOf("install", "chromium"))
}
}

class UninstallChrome : CliktCommand(name = "uninstall-chrome", help = "Uninstall chrome") {
class UninstallChrome : CliktCommand(name = "uninstall", help = "Uninstall chrome") {
override fun run() {
CLI.main(arrayOf("uninstall"))
}
Expand Down

0 comments on commit a59484c

Please sign in to comment.