---
output: github_document
---
[![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)
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# shinyBarcode
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).
## Installation
You can install CannaBarcode from github with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("CannaData/shinyBarcode")
```
## Example
### Shiny
```{R, eval = FALSE}
library(shiny)
library(CannaBarcode)
ui <- fluidPage(
# must include javascript dependencies
CannaBarcode::includeJsBarcode(cdn = TRUE),
numericInput("value", "Input a positive integer", 8675309, 0, 1000000),
CannaBarcode::barcodeOutput("barcode")
)
server <- function(input, output, session) {
output$barcode <- CannaBarcode::renderBarcode(
input$value
)
}
shinyApp(ui = ui, server = server)
```