index.html 2.45 KB
Newer Older
Fred Chasen's avatar
Fred Chasen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">

	<title>Paged.Press - Pagedjs PDF Generator</title>
	<meta content="width=device-width, initial-scale=1" name="viewport">

  <script src="scripts/download.js"></script>
	<script src="scripts/main.js"></script>

	<link rel="stylesheet" type="text/css" href="styles/main.css">

	<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
</head>

<body>

	<div id="main">
	<div id="controls">
		<header id="logo">
			<h1>Paged.Press</h1>
			<p>Paged.js PDF Generator</p>
		</header>
		<form id="form" class="box" method="post" action="" enctype="multipart/form-data">
			<div class="box__input">
				<i class="material-icons box__icon">file_download</i>

				<input class="box__file" type="file" name="files[]" id="input" />
				<label for="file"><a id="choose"><strong>Choose a HTML file</strong></a><span class="box__dragndrop"> or drag it here</span>.</label>

			</div>
			<div class="box__uploading">Uploading&hellip;</div>
			<div class="box__success">Done!</div>
			<div class="box__error">Error!<span></span>.</div>
		</form>
    <footer>
      <h3>Print a URL</h3>
      <pre class="prettyprint">
      curl http://paged.press \
        --header "Content-Type:application/json" \
        --data '{"url": "https://s3.amazonaws.com/pagedmedia/samples/text.html"}' \
        > out.pdf
      </pre>
      <h3>Print a local file</h3>
      <pre class="prettyprint">
      curl http://paged.press \
        --header "Content-Type:text/plain" \
        --data-binary "@text.html" > out.pdf
      </pre>
      <h3>Request a print with "fetch" in JavaScript</h3>
      <pre class="prettyprint">
        let file = await fetch('http://paged.press', {
            method: 'POST',
            body: JSON.stringify({
              url: "https://s3.amazonaws.com/pagedmedia/samples/text.html"
              // html: "..."
            }),
            headers: {
              'Content-Type': 'application/json',
            },
          })
          .then(r => r.blob());
      </pre>
    </footer>
	 </div>

	<div id="viewer">
    <div class="lds-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
    <iframe id="pdf" src="" type="application/pdf"></iframe>
  </div>
  <a id="close">- Close -</a>

  </div>

</body>

</html>