Skip to content

Commit

Permalink
cleanup and added base64 example
Browse files Browse the repository at this point in the history
  • Loading branch information
tbocek committed Dec 25, 2015
1 parent 82e09ac commit c498ef8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</tr>
</table>
<br/><br/>
<button onclick="console.log(encodeBase64(PDFSIGN.signpdf(pdfmini, cert, '1234', new Date(1450365030990))));">Create a PDF and output base64 in the console</button>
<button onclick="document.location = 'data:application/pdf;base64,'+encodeBase64(PDFSIGN.signpdf(pdfmini, cert, '1234', new Date(1450365030990)));">Create a PDF and output base64</button>
<script type="text/javascript">

var BASE64_MARKER = ';base64,';
Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ signed-pdf = PDFSIGN.signpdf(pdf, p12-cert, p12-cert-password);
An example site is located in `src/html`. In this example, one can set the certificate
(e.g., `support/mycert-1-alt.p12`), set the password "1234", and add a PDF file.
The PDF will be signed with the certificate and the Adobe Reader will show that
the PDF is signed but not trusted (its a self signed certificate).
the PDF is signed but not trusted (its a self signed certificate). The button
'Create a PDF and output base64' takes a base64 encode file and outputs a base64
document in the browser, which immediately displays the PDF.

PDFSign uses two external libraries:
[forge](https://github.com/digitalbazaar/forge) and [PDF.js](https://mozilla.github.io/pdf.js/).
Expand Down
2 changes: 1 addition & 1 deletion src/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</tr>
</table>
<br/><br/>
<button onclick="console.log(encodeBase64(PDFSIGN.signpdf(pdfmini, cert, '1234', new Date(1450365030990))));">Create a PDF and output base64 in the console</button>
<button onclick="document.location = 'data:application/pdf;base64,'+encodeBase64(PDFSIGN.signpdf(pdfmini, cert, '1234', new Date(1450365030990)));">Create a PDF and output base64</button>
<script type="text/javascript">

var BASE64_MARKER = ';base64,';
Expand Down

0 comments on commit c498ef8

Please sign in to comment.