The goal of shinyBarcode
is to wrap the 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
.
You can install shinyBarcode from github with:
# install.packages("devtools")
devtools::install_github("CannaData/shinyBarcode")
library(shiny)
library(shinyBarcode)
ui <- fluidPage(
# must include javascript dependencies
shinyBarcode::includeJsBarcode(cdn = TRUE),
numericInput("value", "Input a positive integer", 8675309, 0, 1000000),
shinyBarcode::barcodeOutput("barcode")
)
server <- function(input, output, session) {
output$barcode <- shinyBarcode::renderBarcode(
input$value
)
}
shinyApp(ui = ui, server = server)