Skip to content

Commit

Permalink
Adding possibility to specify the html as a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Genar Trias Ortiz committed Jan 15, 2016
1 parent 80e8024 commit 82fd8d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ docker build -t cirici/wkhtmltopdf-aas .
## Starting Docker container

```bash
docker run -d --name wkhtmltopdf-aas -p <hostport>:5000 cirici/wkhtmltopdf-aas
docker run -d --name wkhtmltopdf-aas -p <hostport>:80 cirici/wkhtmltopdf-aas
```

## Testing the microservice
Expand Down
4 changes: 4 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def handle_request(config):
print("URL provided: " + request.form['url'])
pdf = pdfkit.from_url(str(request.form['url']), output_path=False, configuration=config, options=options)

if ('html' in request.form):
print("Html provided")
pdf = pdfkit.from_string(str(request.form['html']), output_path=False, configuration=config, options=options)

# If we are receiving the html contents from a uploaded file
elif ('content' in request.files):
print("File provided: " + str(request.files['content']))
Expand Down

0 comments on commit 82fd8d7

Please sign in to comment.