Skip to content

Commit

Permalink
Fix up issues when accessing from file://
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRio committed Jan 7, 2013
1 parent 816a33a commit 4c8cb72
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 134 deletions.
24 changes: 23 additions & 1 deletion examples/js/editor.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion examples/js/user-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ for(var i = 1; i <= 12; i ++) {

// You wouldn't normally call this - this is just to make the
// demo not look broken as we've disabled auto update.
jsPDFEditor.update(true);
if (jsPDFEditor !== undefined) {
jsPDFEditor.update(true);
}
266 changes: 134 additions & 132 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,174 +8,176 @@
<meta name="description" content="">
<meta name="author" content="">

<!-- Bootstrap -->
<!-- Bootstrap -->
<link href="./examples/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="./examples/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">

<!-- Editor CSS -->
<link href="./examples/css/editor.css" rel="stylesheet">
<!-- Editor CSS -->
<link href="./examples/css/editor.css" rel="stylesheet">

<!-- See closing body for JS -->
<!-- See closing body for JS -->

<script src="http://use.edgefonts.net/source-code-pro.js"></script>
<script src="http://use.edgefonts.net/source-code-pro.js"></script>
</head>

<body>
<div class="container">

<div class="masthead">
<div class="pull-right">
<div class="tweet-buttons">
<a href="https://twitter.com/share" class="twitter-share-button" data-via="MrRio" data-size="large">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<a href="https://twitter.com/MrRio" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @MrRio</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<a class="btn btn-primary btn-large" href="https://github.com/MrRio/jsPDF/zipball/master">Download Now</a>
<p class="muted" style="text-align: right;">Version 0.9.0rc1</p>
<div class="masthead">
<div class="pull-right">
<div class="tweet-buttons">
<a href="https://twitter.com/share" class="twitter-share-button" data-via="MrRio" data-size="large">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<a href="https://twitter.com/MrRio" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @MrRio</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<a class="btn btn-primary btn-large" href="https://github.com/MrRio/jsPDF/zipball/master">Download Now</a>
<p class="muted" style="text-align: right;">Version 0.9.0rc1</p>

</div>
<h1 class="muted">jsPDF</h1>
<h4>HTML5 JavaScript PDF generation library from <a href="http://twitter.com/MrRio">@MrRio</a></h4>
</div>
<div class="row-fluid">
<div class="span6" style="float: right">
<iframe class="preview-pane" width="100%" height="650" frameborder="0"></iframe>
</div>
<div class="span5 no-gutter">
</div>
<h1 class="muted">jsPDF</h1>
<h4>HTML5 JavaScript PDF generation library from <a href="http://twitter.com/MrRio">@MrRio</a></h4>
</div>
<div class="row-fluid">
<div class="span6" style="float: right">
<iframe class="preview-pane" width="100%" height="650" frameborder="0"></iframe>
</div>
<div class="span5 no-gutter">

<h2>Have a play.</h2>
<h2>Have a play.</h2>

<p>A HTML5 client-side solution for generating PDFs. Perfect for event tickets, reports, certificates, you name it! </p>
<p>A HTML5 client-side solution for generating PDFs. Perfect for event tickets, reports, certificates, you name it! </p>

<p>No servers were used or harmed in this demo.</p>
<p><b>No servers were used in the making of this demo.</b></p>

<div class="template-picker">
<label for="template">Choose example</label>
<select id="template" name="template">
<option>Hold your horses...</option>
</select>
</div>
</div>

<label for="template">Choose example</label>
<select id="template" name="template">
<option>Hold your horses...</option>
</select>
</div>
<div id="editor" class="bypass"></div>

<div class="controls">
<div class="pull-right">
<a href="#" class="btn btn-primary">Download Your Code</a>
<a href="#" class="btn btn-primary download-pdf">Download PDF</a>
</div>

<div id="editor" class="bypass"></div>

<div class="controls">
<div class="pull-right">
<a href="#" class="btn btn-primary">Download Your Code</a>
<a href="#" class="btn btn-primary download-pdf">Download PDF</a>
</div>
<label class="checkbox">
<input type="checkbox" id="auto-refresh" checked="checked"> Auto refresh on changes?
</label>
<a href="#" class="run-code hide btn btn-success">Run Code</a>

<label class="checkbox">
<input type="checkbox" id="auto-refresh" checked="checked"> Auto refresh on changes?
</label>
<a href="#" class="run-code hide btn btn-success">Run Code</a>
<div class="alert hide">
Auto refresh disabled for this
</div>

<div class="alert hide">
Auto refresh is turned off for this example
</div>
</div>

</div>
</div>
<div class="clerfix"></div>
<div class="span12 credits">

</div>
<div class="clerfix"></div>
<div class="span12 credits">
<h2>The Basics</h2>

<h2>The Basics</h2>
<p>Simply include the jsPDF library in your <span class="source">&lt;head&gt;</span>, generate your PDF using the <i>many</i> built-in functions, then hook up a button to trigger the download. All the examples here use jQuery.</p>

<p>Simply include the jsPDF library in your <span class="source">&lt;head&gt;</span>, generate your PDF using the <i>many</i> built-in functions, then hook up a button to trigger the download. All the examples here use jQuery.</p>
<h2>Credits</h2>

<h2>Credits</h2>
<p>Big thanks to Daniel Dotsenko from <a href="http://willow-systems.com">Willow Systems Corporation</a> for making huge contributions to the codebase. </p>

<p>Big thanks to Daniel Dotsenko from <a href="http://willow-systems.com">Willow Systems Corporation</a> for making huge contributions to the codebase. </p>
<p>Thanks to Ajaxian.com for <a href="http://ajaxian.com/archives/dynamically-generic-pdfs-with-javascript">featuring us back in 2009</a>.</p>

<p>Thanks to Ajaxian.com for <a href="http://ajaxian.com/archives/dynamically-generic-pdfs-with-javascript">featuring us back in 2009</a>.</p>
<p>Everyone else that's contributed patches or bug reports. You rock.</p>

<p>Everyone else that's contributed patches or bug reports. You rock.</p>
<h2>License</h2>

<h2>License</h2>
<p>(MIT License)</p>

<p>(MIT License)</p>
<p>Copyright (c) 2010-2012 James Hall, <a href="https://github.com/MrRio/jsPDF">https://github.com/MrRio/jsPDF</a></p>

<p>Copyright (c) 2010-2012 James Hall, <a href="https://github.com/MrRio/jsPDF">https://github.com/MrRio/jsPDF</a></p>
<p>Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:</p>

<p>Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:</p>
<p>The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.</p>

<p>The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>

<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>


</div>
</div>

</div> <!-- /container -->

<footer>&copy; 2013 James Hall</footer>


<!-- Scripts down here -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<!-- Code editor -->

<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>

<!-- Scripts in development mode -->
<script type="text/javascript" src="jspdf.js"></script>
<script type="text/javascript" src="./libs/FileSaver.js/FileSaver.js"></script>
<script type="text/javascript" src="./libs/BlobBuilder.js/BlobBuilder.js"></script>
<script type="text/javascript" src="./jspdf.plugin.addimage.js"></script>
<script type="text/javascript" src="./jspdf.plugin.from_html.js"></script>
<script type="text/javascript" src="./jspdf.plugin.sillysvgrenderer.js"></script>
<script type="text/javascript" src="./jspdf.plugin.split_text_to_size.js"></script>
<script type="text/javascript" src="./jspdf.plugin.standard_fonts_metrics.js"></script>

<!-- Editor -->
<script type="text/javascript" src="./examples/js/editor.js"></script>

<!-- Analytics -->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-32767308-2']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<script type="text/javascript">
adroll_adv_id = "P3OVQHTGMBA37E2Z6M77AQ";
adroll_pix_id = "GHWLXTPCARHSXCCSWFFDR7";
(function () {
var oldonload = window.onload;
window.onload = function(){
__adroll_loaded=true;
var scr = document.createElement("script");
var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
scr.setAttribute('async', 'true');
scr.type = "text/javascript";
scr.src = host + "/j/roundtrip.js";
((document.getElementsByTagName('head') || [null])[0] ||
document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
if(oldonload){oldonload()}};
}());
</script>
<footer>&copy; 2013 James Hall</footer>


<!-- Scripts down here -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<!-- Code editor -->

<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>

<!-- Scripts in development mode -->
<script type="text/javascript" src="jspdf.js"></script>
<script type="text/javascript" src="./libs/FileSaver.js/FileSaver.js"></script>
<script type="text/javascript" src="./libs/BlobBuilder.js/BlobBuilder.js"></script>
<script type="text/javascript" src="./jspdf.plugin.addimage.js"></script>
<script type="text/javascript" src="./jspdf.plugin.from_html.js"></script>
<script type="text/javascript" src="./jspdf.plugin.sillysvgrenderer.js"></script>
<script type="text/javascript" src="./jspdf.plugin.split_text_to_size.js"></script>
<script type="text/javascript" src="./jspdf.plugin.standard_fonts_metrics.js"></script>

<!-- Editor -->
<script type="text/javascript" src="./examples/js/editor.js"></script>

<!-- Analytics -->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-32767308-2']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<script type="text/javascript">
adroll_adv_id = "P3OVQHTGMBA37E2Z6M77AQ";
adroll_pix_id = "GHWLXTPCARHSXCCSWFFDR7";
(function () {
var oldonload = window.onload;
window.onload = function(){
__adroll_loaded=true;
var scr = document.createElement("script");
var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
scr.setAttribute('async', 'true');
scr.type = "text/javascript";
scr.src = host + "/j/roundtrip.js";
((document.getElementsByTagName('head') || [null])[0] ||
document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
if(oldonload){oldonload()}};
}());
</script>

</body>
</html>

0 comments on commit 4c8cb72

Please sign in to comment.