Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ We recommed using [python-pdfkit](https://github.com/JazzCore/python-pdfkit) to

You can find an example [here](examples/create_pdf.py)

## HTML Support

The Lob.com API also supports HTML strings in leiu of a file of the above type. See below for examples of submitting with HTML strings.

For templates and more information regarding HTML, please see the [Lob documentation](https://lob.com/docs/python#html-fonts).

## Initialization and Configuration

To initialize the wrapper, import `lob` and set the `api_key`
Expand Down Expand Up @@ -321,6 +327,15 @@ lob.Object.create(
double_sided=0
)

#Create an Object using HTML
lob.Object.create(
name='Local File Object',
file='<html style="margin: 130px; font-size: 50;">HTML here</html>',
setting='100',
quantity=1,
double_sided=0
)

#Create an Object using a file-like object.
from StringIO import StringIO
lob.Object.create(
Expand Down Expand Up @@ -456,6 +471,14 @@ lob.Postcard.create(
back = open('/path/to/local/file', 'rb')
)

#Create a Postcard Using HTML
lob.Postcard.create(
to_address=<address_id>,
from_address=<address_id>,
front = '<html style="margin: 130px; font-size: 50;">Front HTML</html>',
back = '<html style="margin: 130px; font-size: 50;">Back HTML</html>'
)

#Create Postcard with Message Instead of Back
lob.Postcard.create(
to_address = {
Expand Down Expand Up @@ -644,6 +667,16 @@ lob.Area.create(
full_bleed = '1'
)

#Basic Area Create with HTML
lob.Area.create(
name='Lob',
front = '<html style="margin: 130px; font-size: 50;">Front HTML</html>',
back = '<html style="margin: 130px; font-size: 50;">Back HTML</html>',
routes = ['94158','60031'],
target_type = 'all',
full_bleed = '1'
)

#Create Area with Optional Parameters
lob.Area.create(
front = 'https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf',
Expand Down