Skip to content

Conversation

@boralyl
Copy link
Contributor

@boralyl boralyl commented Dec 18, 2012

Including images in a template that are remote (we use amazon S3 for our static content) is supported in pisa by passing a uri. As mentioned in the commit comment, this could also be done with a regex, not sure what would be most efficient.

@maestrofjp
Copy link

+1 for getting this merged in as we use S3 as well. The startsWith is just fine because its very readable whereas regex not so much. I suspect that loading up a regex might be slightly slower, but it's probably not worth investigating. FYI, since Python 2.5 you can pass a tuple into startsWith:

elif uri.startswith(("http://", "https://", )): 
@taplister
Copy link

@maestrofjp Thanks for the tip, wasn't aware of the string.startswith(tuple, ...)

@maestrofjp
Copy link

@taplister you're welcome! I only came across it myself a few weeks ago...

@chrisglass
Copy link
Collaborator

Merging, hope this helps.

chrisglass added a commit that referenced this pull request Feb 28, 2014
Added ability to support remote URIs
@chrisglass chrisglass merged commit 94c0d1e into xhtml2pdf:master Feb 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants