README.Rmd 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ---
  2. output: github_document
  3. ---
  4. <!-- README.md is generated from README.Rmd. Please edit that file -->
  5. [![Travis-CI Build Status](https://travis-ci.org/CannaData/shinyBarcode.svg?branch=master)](https://travis-ci.org/CannaData/shinyBarcode)[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/CannaData/shinyBarcode?branch=master&svg=true)](https://ci.appveyor.com/project/CannaData/shinyBarcode)
  6. ```{r, echo = FALSE}
  7. knitr::opts_chunk$set(
  8. collapse = TRUE,
  9. comment = "#>",
  10. fig.path = "README-"
  11. )
  12. ```
  13. # shinyBarcode
  14. The goal of `shinyBarcode` is to wrap the [JsBarcode](https://github.com/lindell/JsBarcode) library, written by Johan Lindell, for R. This enables rendering of barcodes in R Markdown and Shiny. This enables generating receipts in markdown, which can compiled to HTML with `rmarkdown`, and then printed using Google Cloud Print using [`googlePrintr`](https://github.com/CannaData/googlePrintr).
  15. ## Installation
  16. You can install CannaBarcode from github with:
  17. ```{r gh-installation, eval = FALSE}
  18. # install.packages("devtools")
  19. devtools::install_github("CannaData/shinyBarcode")
  20. ```
  21. ## Example
  22. ### Shiny
  23. ```{R, eval = FALSE}
  24. library(shiny)
  25. library(CannaBarcode)
  26. ui <- fluidPage(
  27. # must include javascript dependencies
  28. CannaBarcode::includeJsBarcode(cdn = TRUE),
  29. numericInput("value", "Input a positive integer", 8675309, 0, 1000000),
  30. CannaBarcode::barcodeOutput("barcode")
  31. )
  32. server <- function(input, output, session) {
  33. output$barcode <- CannaBarcode::renderBarcode(
  34. input$value
  35. )
  36. }
  37. shinyApp(ui = ui, server = server)
  38. ```