Skip to content

Easily specify bundle or documents location for the HTML Template #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 3, 2014

Conversation

aaronwardle
Copy link
Contributor

Hi,

I ran into an issue with my project where basically I needed to display a logo and other files in my PDF which are bundled with the app but also needed to include images which the user creates or downloads.

Setting the baseURL on the UIWebView only worked for one location or the other, so I have created this NSURLProtocol which will look for the following img prefixes in the html template

bundleimage://
documentsimage://

Once these are detected it will get the image from the right location and serve it up in the UIWebView and also the PDF.

Hope you find this useful.

Thanks Aaron

NSURL Protocol for the UIWebView which allows users to easily define where images are located with the moustache template.
The NSURLWebViewProtocol looks for two link prefixes in the moustache.template and will perform an NSURLRequest to request them from either the app bundle or documents location 

For example <img src="bundleimage://imagename.png" />
or <img src="documentsimage://imagename.png" />
Added the NSURLWebViewProtocol so that it can detect custom URLS such as bundleimage:// and documentsimage://
Updated README with the details on how to specify images from the app bundle or documents location.
Updated README so that the HTML Snippets appear correctly.
@as-cii
Copy link
Owner

as-cii commented Apr 3, 2014

Thanks!

as-cii pushed a commit that referenced this pull request Apr 3, 2014
Easily specify bundle or documents location for the HTML Template
@as-cii as-cii merged commit 3fc36f2 into as-cii:master Apr 3, 2014
@as-cii as-cii mentioned this pull request Apr 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants