Skip to content

Commit

Permalink
Merge pull request gutschilla#41 from lukeses/patch-1
Browse files Browse the repository at this point in the history
Update documentation with syntax highlighting
  • Loading branch information
gutschilla authored May 2, 2019
2 parents 645d165 + 16cbce9 commit 6b0127a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ those generated with wkhtmltopdf.

Add this to your dependencies in your mix.exs:

```Elixir
def application do
[applications: [
:logger,
Expand All @@ -119,10 +120,11 @@ Add this to your dependencies in your mix.exs:
{ :pdf_generator, ">=0.5.3" }, # <-- and this
]
end
```

Then pass some html to PdfGenerator.generate

```
```Elixir
$ iex -S mix

html = "<html><body><p>Hi there!</p></body></html>"
Expand All @@ -149,7 +151,7 @@ html_works_too = "<html><body><h1>Minimalism!"

Or use the bang-methods:

```
```Elixir
filename = PdfGenerator.generate! "<html>..."
pdf_binary = PdfGenerator.generate_binary! "<html>..."
```
Expand All @@ -160,7 +162,7 @@ This module will automatically try to finde both `wkhtmltopdf` and `pdftk` in
your path. But you may override or explicitly set their paths in your
`config/config.exs`.

```
```Elixir
config :pdf_generator,
wkhtml_path: "/usr/bin/wkhtmltopdf", # <-- this program actually does the heavy lifting
pdftk_path: "/usr/bin/pdftk" # <-- only needed for PDF encryption
Expand All @@ -182,13 +184,13 @@ If you want to run `wkhtmltopdf` with an unpatched verison of webkit that requir
an X Window server, but your server (or Mac) does not have one installed,
you may find the `command_prefix` handy:

```
```Elixir
PdfGenerator.generate "<html..", command_prefix: "xvfb-run"
```

This can also be configured globally in your `config/config.exs`:

```
```Elixir
config :pdf_generator,
command_prefix: "/usr/bin/xvfb-run"
```
Expand All @@ -198,7 +200,7 @@ you will need to configure `xvfb-run` to search for a free X server number,
or set the server number explicitly. You can use the `command_prefix` to pass
options to the `xvfb-run` command.

```
```Elixir
config :pdf_generator,
command_prefix: ["xvfb-run", "-a"]
```
Expand Down

0 comments on commit 6b0127a

Please sign in to comment.