Skip to content

Commit 441f8cf

Browse files
Certifiate Generator Website which has developed in javascript html and css
0 parents  commit 441f8cf

File tree

10 files changed

+624
-0
lines changed

10 files changed

+624
-0
lines changed

FileSaver.js

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
(function (global, factory) {
2+
if (typeof define === "function" && define.amd) {
3+
define([], factory);
4+
} else if (typeof exports !== "undefined") {
5+
factory();
6+
} else {
7+
var mod = {
8+
exports: {}
9+
};
10+
factory();
11+
global.FileSaver = mod.exports;
12+
}
13+
})(this, function () {
14+
"use strict";
15+
16+
/*
17+
* FileSaver.js
18+
* A saveAs() FileSaver implementation.
19+
*
20+
* By Eli Grey, http://eligrey.com
21+
*
22+
* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)
23+
* source : http://purl.eligrey.com/github/FileSaver.js
24+
*/
25+
// The one and only way of getting global scope in all environments
26+
// https://stackoverflow.com/q/3277182/1008999
27+
var _global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof global === 'object' && global.global === global ? global : void 0;
28+
29+
function bom(blob, opts) {
30+
if (typeof opts === 'undefined') opts = {
31+
autoBom: false
32+
};else if (typeof opts !== 'object') {
33+
console.warn('Deprecated: Expected third argument to be a object');
34+
opts = {
35+
autoBom: !opts
36+
};
37+
} // prepend BOM for UTF-8 XML and text/* types (including HTML)
38+
// note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF
39+
40+
if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
41+
return new Blob([String.fromCharCode(0xFEFF), blob], {
42+
type: blob.type
43+
});
44+
}
45+
46+
return blob;
47+
}
48+
49+
function download(url, name, opts) {
50+
var xhr = new XMLHttpRequest();
51+
xhr.open('GET', url);
52+
xhr.responseType = 'blob';
53+
54+
xhr.onload = function () {
55+
saveAs(xhr.response, name, opts);
56+
};
57+
58+
xhr.onerror = function () {
59+
console.error('could not download file');
60+
};
61+
62+
xhr.send();
63+
}
64+
65+
function corsEnabled(url) {
66+
var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker
67+
68+
xhr.open('HEAD', url, false);
69+
70+
try {
71+
xhr.send();
72+
} catch (e) {}
73+
74+
return xhr.status >= 200 && xhr.status <= 299;
75+
} // `a.click()` doesn't work for all browsers (#465)
76+
77+
78+
function click(node) {
79+
try {
80+
node.dispatchEvent(new MouseEvent('click'));
81+
} catch (e) {
82+
var evt = document.createEvent('MouseEvents');
83+
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
84+
node.dispatchEvent(evt);
85+
}
86+
} // Detect WebView inside a native macOS app by ruling out all browsers
87+
// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too
88+
// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos
89+
90+
91+
var isMacOSWebView = /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent);
92+
var saveAs = _global.saveAs || ( // probably in some web worker
93+
typeof window !== 'object' || window !== _global ? function saveAs() {}
94+
/* noop */
95+
// Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView
96+
: 'download' in HTMLAnchorElement.prototype && !isMacOSWebView ? function saveAs(blob, name, opts) {
97+
var URL = _global.URL || _global.webkitURL;
98+
var a = document.createElement('a');
99+
name = name || blob.name || 'download';
100+
a.download = name;
101+
a.rel = 'noopener'; // tabnabbing
102+
// TODO: detect chrome extensions & packaged apps
103+
// a.target = '_blank'
104+
105+
if (typeof blob === 'string') {
106+
// Support regular links
107+
a.href = blob;
108+
109+
if (a.origin !== location.origin) {
110+
corsEnabled(a.href) ? download(blob, name, opts) : click(a, a.target = '_blank');
111+
} else {
112+
click(a);
113+
}
114+
} else {
115+
// Support blobs
116+
a.href = URL.createObjectURL(blob);
117+
setTimeout(function () {
118+
URL.revokeObjectURL(a.href);
119+
}, 4E4); // 40s
120+
121+
setTimeout(function () {
122+
click(a);
123+
}, 0);
124+
}
125+
} // Use msSaveOrOpenBlob as a second approach
126+
: 'msSaveOrOpenBlob' in navigator ? function saveAs(blob, name, opts) {
127+
name = name || blob.name || 'download';
128+
129+
if (typeof blob === 'string') {
130+
if (corsEnabled(blob)) {
131+
download(blob, name, opts);
132+
} else {
133+
var a = document.createElement('a');
134+
a.href = blob;
135+
a.target = '_blank';
136+
setTimeout(function () {
137+
click(a);
138+
});
139+
}
140+
} else {
141+
navigator.msSaveOrOpenBlob(bom(blob, opts), name);
142+
}
143+
} // Fallback to using FileReader and a popup
144+
: function saveAs(blob, name, opts, popup) {
145+
// Open a popup immediately do go around popup blocker
146+
// Mostly only available on user interaction and the fileReader is async so...
147+
popup = popup || open('', '_blank');
148+
149+
if (popup) {
150+
popup.document.title = popup.document.body.innerText = 'downloading...';
151+
}
152+
153+
if (typeof blob === 'string') return download(blob, name, opts);
154+
var force = blob.type === 'application/octet-stream';
155+
156+
var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari;
157+
158+
var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
159+
160+
if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== 'undefined') {
161+
// Safari doesn't allow downloading of blob URLs
162+
var reader = new FileReader();
163+
164+
reader.onloadend = function () {
165+
var url = reader.result;
166+
url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;');
167+
if (popup) popup.location.href = url;else location = url;
168+
popup = null; // reverse-tabnabbing #460
169+
};
170+
171+
reader.readAsDataURL(blob);
172+
} else {
173+
var URL = _global.URL || _global.webkitURL;
174+
var url = URL.createObjectURL(blob);
175+
if (popup) popup.location = url;else location.href = url;
176+
popup = null; // reverse-tabnabbing #460
177+
178+
setTimeout(function () {
179+
URL.revokeObjectURL(url);
180+
}, 4E4); // 40s
181+
}
182+
});
183+
_global.saveAs = saveAs.saveAs = saveAs;
184+
185+
if (typeof module !== 'undefined') {
186+
module.exports = saveAs;
187+
}
188+
});

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Certificate-Generator
2+
Generate PDF certificate using JavaScript
3+
4+
This app uses two library PDF-lib.js and FileSaver.js
5+
6+
![Screenshot](https://i.imgur.com/H7mcyZ3.png)
7+
8+
# Certificate Sample
9+
![Sample pdf](https://i.imgur.com/GFGU3K9.jpg)

Tinos-BoldItalic.ttf

426 KB
Binary file not shown.

cert.pdf

244 KB
Binary file not shown.

cutm.jpg

13.9 KB
Loading

favicon.ico

11.7 KB
Binary file not shown.

footer.css

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
.site-footer
2+
{
3+
position:relative;
4+
margin-top: 2.5rem;
5+
background-color:#1A2238;
6+
padding:45px 0 20px;
7+
font-size:15px;
8+
line-height:24px;
9+
color:#fff;
10+
}
11+
#social{
12+
position: relative;
13+
justify-content: center;
14+
align-items: center;
15+
margin-right: 40rem;
16+
}
17+
#text-justify{
18+
width: 50rem;
19+
margin-left: 23rem;
20+
}
21+
.hr{
22+
color:#F4DB7D ;
23+
}
24+
.site-footer hr
25+
{
26+
border-top-color:#bbb;
27+
opacity:0.5
28+
}
29+
.site-footer hr.small
30+
{
31+
margin:20px 0
32+
}
33+
.site-footer h6
34+
{
35+
color:#F4DB7D;
36+
font-size:16px;
37+
text-transform:uppercase;
38+
margin-top:5px;
39+
letter-spacing:2px
40+
}
41+
.site-footer a
42+
{
43+
color:#737373;
44+
}
45+
.site-footer a:hover
46+
{
47+
color:#3366cc;
48+
text-decoration:none;
49+
}
50+
.footer-links
51+
{
52+
padding-left:0;
53+
list-style:none
54+
}
55+
.footer-links li
56+
{
57+
display:block
58+
}
59+
.footer-links a
60+
{
61+
color:#737373
62+
}
63+
.footer-links a:active,.footer-links a:focus,.footer-links a:hover
64+
{
65+
color:#3366cc;
66+
text-decoration:none;
67+
}
68+
.footer-links.inline li
69+
{
70+
display:inline-block
71+
}
72+
.site-footer .social-icons
73+
{
74+
text-align:right
75+
}
76+
.site-footer .social-icons a
77+
{
78+
width:40px;
79+
height:40px;
80+
line-height:40px;
81+
margin-left:6px;
82+
margin-right:0;
83+
border-radius:100%;
84+
background-color:#33353d
85+
}
86+
a{
87+
color: #9DAAF2;
88+
}
89+
.copyright-text
90+
{
91+
margin:0
92+
}
93+
@media (max-width:991px)
94+
{
95+
.site-footer [class^=col-]
96+
{
97+
margin-bottom:30px
98+
}
99+
}
100+
@media (max-width:767px)
101+
{
102+
.site-footer
103+
{
104+
padding-bottom:0
105+
}
106+
.site-footer .copyright-text,.site-footer .social-icons
107+
{
108+
text-align:center
109+
}
110+
}
111+
.social-icons
112+
{
113+
padding-left:0;
114+
margin-bottom:0;
115+
list-style:none
116+
}
117+
.social-icons li
118+
{
119+
display:inline-block;
120+
margin-bottom:4px
121+
}
122+
.social-icons li.title
123+
{
124+
margin-right:15px;
125+
text-transform:uppercase;
126+
color:#96a2b2;
127+
font-weight:700;
128+
font-size:13px
129+
}
130+
.social-icons a{
131+
background-color:#eceeef;
132+
color:#818a91;
133+
font-size:16px;
134+
display:inline-block;
135+
line-height:44px;
136+
width:44px;
137+
height:44px;
138+
text-align:center;
139+
margin-right:8px;
140+
border-radius:100%;
141+
-webkit-transition:all .2s linear;
142+
-o-transition:all .2s linear;
143+
transition:all .2s linear
144+
}
145+
.social-icons a:active,.social-icons a:focus,.social-icons a:hover
146+
{
147+
color:#fff;
148+
background-color:#29aafe
149+
}
150+
.social-icons.size-sm a
151+
{
152+
line-height:34px;
153+
height:34px;
154+
width:34px;
155+
font-size:14px
156+
}
157+
.social-icons a.facebook:hover
158+
{
159+
background-color:#3b5998
160+
}
161+
.social-icons a.twitter:hover
162+
{
163+
background-color:#00aced
164+
}
165+
.social-icons a.linkedin:hover
166+
{
167+
background-color:#007bb6
168+
}
169+
.social-icons a.dribbble:hover
170+
{
171+
background-color:#ea4c89
172+
}
173+
@media (max-width:767px)
174+
{
175+
.social-icons li.title
176+
{
177+
display:block;
178+
margin-right:0;
179+
font-weight:600
180+
}
181+
}

0 commit comments

Comments
 (0)