Store/serve stylesheet locally. Remove unused function. More to come.
This commit is contained in:
Timotej Lazar 2022-04-19 15:43:12 +02:00
parent fc451c7cbc
commit 5d3620f687
33 changed files with 1493 additions and 2377 deletions

View file

@ -1,364 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Vodenje bibliografij v sistemu COBISS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
<script src='build/pdfmake.min.js'></script>
<script src='build/vfs_fonts.js'></script>
<script>
function naredipdf(){
//var source=document.getElementById("username").value
var pdf = new jsPDF('p', 'pt', 'letter')
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
, source = $('#fromHTMLtestdiv')[0]
// we support special element handlers. Register them with jQuery-style
// ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
// There is no support for any other type of selectors
// (class, of compound) at this time.
, specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme': function(element, renderer){
// true = "handled elsewhere, bypass text extraction"
return true
}
}
margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
// all coords and widths are in jsPDF instance's declared units
// 'inches' in this case
var source="<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><title>Title of the document</title></head><body>š</body></html>"
pdf.fromHTML(
source // HTML string or DOM elem ref.
, margins.left // x coord
, margins.top // y coord
, {
'width': margins.width // max width of content on PDF
, 'elementHandlers': specialElementHandlers
},
function (dispose) {
// dispose: object with X, Y of the last line add to the PDF
// this allow the insertion of new lines after html
pdf.save('Test.pdf');
},
margins
)
}
function cobiss()
{
var knjiznica="Knjižnica FKKT in FRI\n Večna pot 113, Ljubljana\n Tel:01/4798005, 4798006\n\n"
var avtor=document.getElementById("avtor").value
var predlagatelj="Predlagatelj dokumenta(avtor/soavtor): "
var avtor1=predlagatelj.concat(avtor)
var delo=document.getElementById("naslov").value
var avtorji=document.getElementById("avtorji").value
var slo=document.getElementById("slo").value
var eng=document.getElementById("angl").value
var vir=document.getElementById("vir").value
if (vir.localeCompare("")!=0){
var vir1=vir.match(/.{1,70}/g);
vir = vir1.join(" ") }
var tipologija=document.getElementById("tipologija").value
var prispevki=document.getElementById("prispevki").value
var priloge="Priloga: "
var datum = new Date();
var date="Datum: "+datum.getDate() + ". "+ (datum.getMonth()+1) + ". " + datum.getFullYear()
if (document.getElementById("priloga").checked){
var priloge1=document.getElementById("priloga").value
priloge=priloge+priloge1
}
if (document.getElementById("fotokopija").checked){
var fotokopija=document.getElementById("fotokopija").value
priloge=priloge+", "+fotokopija
}
if (document.getElementById("dokazila").checked){
var dokazila=document.getElementById("dokazila").value
priloge=priloge+", "+dokazila
}
var docDefinition = {
content: [// using a { text: '...' } object lets you set styling properties
{ text: knjiznica, fontSize: 12 },
// if you set pass an array instead of a string, you'll be able
// to style any fragment individually
{
text: avtor1,fontSize:12
},
{
text: '\n\n',fontSize:12
},
{ text: 'Spremni list o dokumentu/delu za vodenje bibliografij raziskovalcev v sistemu COBISS', fontSize:15, bold:true },
{
text: '\n\n',fontSize:12
},
{
text: 'Tipologija dokumenta/dela:\n',fontSize:12
},
{
text: tipologija, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Za prispevke, ki so objavljeni v zborniku:\n',fontSize:12
},
{
text: prispevki, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Naslov dela/dokumenta:\n',fontSize:12
},
{
text: delo, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Priimek in imena:avtorja in soavtorja:\n',fontSize:12
},
{
text: avtorji, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Ključne besede v slovenkem jeziku:\n',fontSize:12
},
{
text: slo, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Ključne besede v angleškem jeziku:\n',fontSize:12
},
eng,
{
text: '\n\n',fontSize:12
},
{
text: 'Vir:\n',fontSize:12
},
{
text: vir,fontSize:12
},/*,
{
text: '\n\n',fontSize:12
},
/* { text: 'Priloge', style: 'header' },
{
ol: [
'primarni vir',
'fotokopija članka/prispevka in fotokopija naslova primarnega vira',
'dokazila(recenzija, vabila)',
]
},*/
{
text: '\n\n',fontSize:12
},
{
text: priloge, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: date,fontSize:12
}
]
};
// pdfMake.createPdf(docDefinition).open();
// print the PDF (temporarily Chrome-only)
//pdfMake.createPdf(docDefinition).print();
// download the PDF (temporarily Chrome-only)
pdfMake.createPdf(docDefinition).download('cobiss-obrazec.pdf');
}
</script>
</head>
<title>Spremni list o dokumentu/delu za vodenje bibliografij raziskovalcev v sistemu COBISS</title>
</head>
<body>
<form action="vnos.php" method="get"class="pure-form pure-form-aligned">
<fieldset>
<div class="pure-form">
<legend><b>Spremni list o dokumentu/delu za vodenje bibliografij raziskovalcev v sistemu COBISS</b></legend>
</div>
<div class="pure-control-group">
<label for="ime">Predlagatelj dokumenta/dela(avtor oz. soavtor)</label>
<input name="ime" id="avtor" type="text" placeholder="Predlagatelj dokumenta">
</div>
<div class="pure-control-group">
<label for="posta">Tipologija dokumenta/dela</label>
<select id="tipologija" name="posta">
<option value="1.01 Izvirni znanstveni članek)">1.01 Izvirni znanstveni članek</option>
<option value="1.02 Pregledni znanstveni članek">1.02 Pregledni znanstveni članek</option>
<option value="1.03 Kratki znanstveni prispevek">1.03 Kratki znanstveni prispevek</option>
<option value="1.04 Strokovni članek">1.04 Strokovni članek</option>
<option value="1.05 Poljudni članek">1.05 Poljudni članek</option>
<option value="1.06 Objavljeni znanstveni prispevek na konferenci (vabljeno predavanje)">1.06 Objavljeni znanstveni prispevek na konferenci (vabljeno predavanje)</option>
<option value="1.07 Objavljeni strokovni prispevek na konferenci (vabljeno predavanje)">1.07 Objavljeni strokovni prispevek na konferenci (vabljeno predavanje)</option>
<option value="1.08 Objavljeni znanstveni prispevek na konferenci">1.08 Objavljeni znanstveni prispevek na konferenci</option>
<option value="1.09 Objavljeni strokovni prispevek na konferenci">1.09 Objavljeni strokovni prispevek na konferenci</option>
<option value="1.10 Objavljeni povzetek znanstvenega prispevka na konferenci (vabljeno predavanje)">1.10 Objavljeni povzetek znanstvenega prispevka na konferenci (vabljeno predavanje)</option>
<option value="1.11 Objavljeni povzetek strokovnega prispevka na konferenci (vabljeno predavanje)">1.11 Objavljeni povzetek strokovnega prispevka na konferenci (vabljeno predavanje)</option>
<option value="1.12 Objavljeni povzetek znanstvenega prispevka na konferenci">1.12 Objavljeni povzetek znanstvenega prispevka na konferenci</option>
<option value="1.13 Objavljeni povzetek strokovnega prispevka na konferenci">1.13 Objavljeni povzetek strokovnega prispevka na konferenci)</option>
<option value="1.16 Samostojni znanstveni sestavek ali poglavje v monografski publikaciji">1.16 Samostojni znanstveni sestavek ali poglavje v monografski publikaciji</option>
<option value="1.17 Samostojni strokovni sestavek ali poglavje v monografski publikaciji">1.17 Samostojni strokovni sestavek ali poglavje v monografski publikaciji</option>
<option value="1.18 Strokovni sestavek v slovarju, enciklopediji ali leksikonu">1.18 Strokovni sestavek v slovarju, enciklopediji ali leksikonu</option>
<option value="1.19 Recenzija, prikaz knjige, kritika">1.19 Recenzija, prikaz knjige, kritika</option>
<option value="1.20 Predgovor, spremna beseda">1.20 Predgovor, spremna beseda</option>
<option value="1.21 Polemika, diskusijski prispevek, komentar">1.21 Polemika, diskusijski prispevek, komentar</option>
<option value="1.22 Intervju">1.22 Intervju</option>
<option value="1.23 Umetniški sestavek">1.23 Umetniški sestaveki</option>
<option value="1.24 Bibliografija, kazalo ipd.">1.24 Bibliografija, kazalo ipd.</option>
<option value="1.25 Drugi sestavni deli">1.25 Drugi sestavni deli</option>
<option value="1.26 Znanstveni sestavek v slovarju, enciklopediji, leksikonu">1.26 Znanstveni sestavek v slovarju, enciklopediji, leksikonu</option>
</select>
</div>
<div class="pure-control-group">
<label for="posta">Za prispevke, ki so objavljeni v zborniku</label>
<select id="prispevki" name="posta">
<option value=""></option>
<option value="2.30(Zbornik strokovnih in nerecenziranih znanstvenih prispevkov na konferenci)">2.30(Zbornik strokovnih in nerecenziranih znanstvenih prispevkov na konferenci)</option>
<option value="2.31(Zbornik recenziranih znanstevih prispevkov na mednarodni ali tuji konferenci)">2.31(Zbornik recenziranih znanstevih prispevkov na mednarodni ali tuji konferenci)</option>
<option value="2.32(Zbornik nerecenziranih znanstevih prispevkov na domači konferenci)">2.32(Zbornik nerecenziranih znanstevih prispevkov na domači konferenci)</option>
</select>
</div>
<div class="pure-control-group">
<label for="ime">Naslov dela/dokumenta</label>
<textarea id="naslov" class="pure-input-1-2" placeholder="naslov dela"></textarea>
</div>
<div class="pure-control-group">
<label for="ime">Priimek ime:avtorjev in soavtorjev</label>
<textarea id="avtorji" class="pure-input-1-2" placeholder="avtorji in soavtorji"></textarea>
</div>
<div class="pure-control-group">
<label for="ime">Vir</label>
<textarea class="pure-input-1-2" placeholder="vir" id="vir"></textarea>
</div>
<div class="pure-control-group">
<label for="ime">Ključne besede v slovenkem jeziku</label>
<textarea id="slo" class="pure-input-1-2" placeholder="ključne besede v slovenksem jeziku"></textarea>
</div>
<div class="pure-control-group">
<label for="ime">Ključne besede v angleškem jeziku</label>
<textarea id = "angl" class="pure-input-1-2" placeholder="ključne besede v angleškem jeziku"></textarea>
</div>
<label for="ime">Priloge</label>
<div class="pure-control-group">
<input type="checkbox" name="priloga" id="priloga" value="primarni vir" checked> primarni vir<br>
<input type="checkbox" id="fotokopija" value="fotokopija članka prispevka in kopija naslovne strani vira" > fotokopija članka prispevka in kopija naslovne strani vira<br>
<input type="checkbox" id="dokazila" value="dokazila(recenzija, vabilo)" > dokazila(recenzija, vabilo)<br>
</div>
<button type="button" onclick="javascript:cobiss()" class="pure-button pure-button-primary">Izpiši pdf</button>
</div>
</fieldset>
</body>
</html>

View file

@ -1,337 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Vodenje bibliografij v sistemu COBISS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
<script src='build/pdfmake.min.js'></script>
<script src='build/vfs_fonts.js'></script>
<script>
function naredipdf(){
//var source=document.getElementById("username").value
var pdf = new jsPDF('p', 'pt', 'letter')
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
, source = $('#fromHTMLtestdiv')[0]
// we support special element handlers. Register them with jQuery-style
// ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
// There is no support for any other type of selectors
// (class, of compound) at this time.
, specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme': function(element, renderer){
// true = "handled elsewhere, bypass text extraction"
return true
}
}
margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
// all coords and widths are in jsPDF instance's declared units
// 'inches' in this case
var source="<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><title>Title of the document</title></head><body>š</body></html>"
pdf.fromHTML(
source // HTML string or DOM elem ref.
, margins.left // x coord
, margins.top // y coord
, {
'width': margins.width // max width of content on PDF
, 'elementHandlers': specialElementHandlers
},
function (dispose) {
// dispose: object with X, Y of the last line add to the PDF
// this allow the insertion of new lines after html
pdf.save('Test.pdf');
},
margins
)
}
function cobiss()
{
var knjiznica="Knjižnica FKKT in FRI\n Večna pot 113, Ljubljana\n Tel:01/4798005, 4798006\n\n"
var avtor=document.getElementById("avtor").value
var predlagatelj="Predlagatelj dokumenta(avtor/soavtor): "
var avtor1=predlagatelj.concat(avtor)
var delo=document.getElementById("naslov").value
var avtorji=document.getElementById("avtorji").value
var slo=document.getElementById("slo").value
var eng=document.getElementById("angl").value
var vir=document.getElementById("vir").value
if (vir.localeCompare("")!=0){
var vir1=vir.match(/.{1,70}/g);
vir = vir1.join(" ") }
var tipologija=document.getElementById("tipologija").value
var prispevki=document.getElementById("prispevki").value
var priloge="Priloga: "
var datum = new Date();
var date="Datum: "+datum.getDate() + ". "+ (datum.getMonth()+1) + ". " + datum.getFullYear()
if (document.getElementById("priloga").checked){
var priloge1=document.getElementById("priloga").value
priloge=priloge+priloge1
}
if (document.getElementById("fotokopija").checked){
var fotokopija=document.getElementById("fotokopija").value
priloge=priloge+", "+fotokopija
}
if (document.getElementById("dokazila").checked){
var dokazila=document.getElementById("dokazila").value
priloge=priloge+", "+dokazila
}
var docDefinition = {
content: [// using a { text: '...' } object lets you set styling properties
{ text: knjiznica, fontSize: 12 },
// if you set pass an array instead of a string, you'll be able
// to style any fragment individually
{
text: avtor1,fontSize:12
},
{
text: '\n\n',fontSize:12
},
{ text: 'Spremni list o dokumentu/delu za vodenje bibliografij raziskovalcev v sistemu COBISS', fontSize:15, bold:true },
{
text: '\n\n',fontSize:12
},
{
text: 'Tipologija dokumenta/dela:\n',fontSize:12
},
{
text: tipologija, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Za prispevke, ki so objavljeni v zborniku:\n',fontSize:12
},
{
text: prispevki, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Naslov dela/dokumenta:\n',fontSize:12
},
{
text: delo, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Priimek in imena:avtorja in soavtorja:\n',fontSize:12
},
{
text: avtorji, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Ključne besede v slovenkem jeziku:\n',fontSize:12
},
{
text: slo, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: 'Ključne besede v angleškem jeziku:\n',fontSize:12
},
eng,
{
text: '\n\n',fontSize:12
},
{
text: 'Vir:\n',fontSize:12
},
{
text: vir,fontSize:12
},/*,
{
text: '\n\n',fontSize:12
},
/* { text: 'Priloge', style: 'header' },
{
ol: [
'primarni vir',
'fotokopija članka/prispevka in fotokopija naslova primarnega vira',
'dokazila(recenzija, vabila)',
]
},*/
{
text: '\n\n',fontSize:12
},
{
text: priloge, fontSize:12
},
{
text: '\n\n',fontSize:12
},
{
text: date,fontSize:12
}
]
};
// pdfMake.createPdf(docDefinition).open();
// print the PDF (temporarily Chrome-only)
//pdfMake.createPdf(docDefinition).print();
// download the PDF (temporarily Chrome-only)
pdfMake.createPdf(docDefinition).download('cobiss-obrazec.pdf');
}
</script>
</head>
<title>Spremni list o dokumentu/delu za vodenje bibliografij raziskovalcev v sistemu COBISS</title>
</head>
<body>
<form action="vnos.php" method="get"class="pure-form pure-form-aligned">
<fieldset>
<div class="pure-form">
<legend><b>Spremni list o dokumentu/delu za vodenje bibliografij raziskovalcev v sistemu COBISS</b></legend>
</div>
<div class="pure-control-group">
<label for="ime">Predlagatelj dokumenta/dela(avtor oz. soavtor)</label>
<input name="ime" id="avtor" type="text" placeholder="Predlagatelj dokumenta">
</div>
<div class="pure-control-group">
<label for="priimek">Tipologija dokumenta/dela</label>
<input name="priimek" id="tipologija" type="text" placeholder="Tipologija">
</div>
<div class="pure-control-group">
<label for="posta">Za prispevke, ki so objavljeni v zborniku</label>
<select id="prispevki" name="posta">
<option value=""></option>
<option value="2.30(Zbornik strokovnih in nerecenziranih znanstvenih prispevkov na konferenci)">2.30(Zbornik strokovnih in nerecenziranih znanstvenih prispevkov na konferenci)</option>
<option value="2.31(Zbornik recenziranih znanstevih prispevkov na mednarodni ali tuji konferenci)">2.31(Zbornik recenziranih znanstevih prispevkov na mednarodni ali tuji konferenci)</option>
<option value="2.32(Zbornik nerecenziranih znanstevih prispevkov na domači konferenci)">2.32(Zbornik nerecenziranih znanstevih prispevkov na domači konferenci)</option>
</select>
</div>
<div class="pure-control-group">
<label for="ime">Naslov dela/dokumenta</label>
<textarea id="naslov" class="pure-input-1-2" placeholder="naslov dela"></textarea>
</div>
<div class="pure-control-group">
<label for="ime">Priimek ime:avtorjev in soavtorjev</label>
<textarea id="avtorji" class="pure-input-1-2" placeholder="avtorji in soavtorji"></textarea>
</div>
<div class="pure-control-group">
<label for="ime">Vir</label>
<textarea class="pure-input-1-2" placeholder="vir" id="vir"></textarea>
</div>
<div class="pure-control-group">
<label for="ime">Ključne besede v slovenkem jeziku</label>
<textarea id="slo" class="pure-input-1-2" placeholder="ključne besede v slovenksem jeziku"></textarea>
</div>
<div class="pure-control-group">
<label for="ime">Ključne besede v angleškem jeziku</label>
<textarea id = "angl" class="pure-input-1-2" placeholder="ključne besede v angleškem jeziku"></textarea>
</div>
<label for="ime">Priloge</label>
<div class="pure-control-group">
<input type="checkbox" name="priloga" id="priloga" value="primarni vir" checked> primarni vir<br>
<input type="checkbox" id="fotokopija" value="fotokopija članka prispevka in kopija naslovne strani vira" > fotokopija članka prispevka in kopija naslovne strani vira<br>
<input type="checkbox" id="dokazila" value="dokazila(recenzija, vabilo)" > dokazila(recenzija, vabilo)<br>
</div>
<button type="button" onclick="javascript:cobiss()" class="pure-button pure-button-primary">Izpiši pdf</button>
</div>
</fieldset>
</body>
</html>

11
css/pure-min.css vendored Normal file

File diff suppressed because one or more lines are too long

1475
css/pure.css Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,63 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="sl">
<head> <meta charset="utf-8" />
<meta charset="utf-8" />
<title>Vodenje bibliografij v sistemu COBISS</title> <title>Vodenje bibliografij v sistemu COBISS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css"> <link rel="stylesheet" href="css/pure-min.css" />
<script src='build/pdfmake.min.js'></script>
<script src='build/vfs_fonts.js'></script>
<script src='js/pdfmake.min.js'></script>
<script src='js/vfs_fonts.js'></script>
<script> <script>
function naredipdf(){
//var source=document.getElementById("username").value
var pdf = new jsPDF('p', 'pt', 'letter')
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
, source = $('#fromHTMLtestdiv')[0]
// we support special element handlers. Register them with jQuery-style
// ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
// There is no support for any other type of selectors
// (class, of compound) at this time.
, specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme': function(element, renderer){
// true = "handled elsewhere, bypass text extraction"
return true
}
}
margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
// all coords and widths are in jsPDF instance's declared units
// 'inches' in this case
var source="<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><title>Title of the document</title></head><body>š</body></html>"
pdf.fromHTML(
source // HTML string or DOM elem ref.
, margins.left // x coord
, margins.top // y coord
, {
'width': margins.width // max width of content on PDF
, 'elementHandlers': specialElementHandlers
},
function (dispose) {
// dispose: object with X, Y of the last line add to the PDF
// this allow the insertion of new lines after html
pdf.save('Test.pdf');
},
margins
)
}
function cobiss() function cobiss()
{ {
var knjiznica="Knjižnica FKKT in FRI\n Večna pot 113, Ljubljana\n FRI: Tel:01/4798005, FKKT: 01/4798006\n\n" var knjiznica="Knjižnica FKKT in FRI\n Večna pot 113, Ljubljana\n FRI: Tel:01/4798005, FKKT: 01/4798006\n\n"
@ -264,12 +216,7 @@ function cobiss()
pdfMake.createPdf(docDefinition).download('cobiss-obrazec.pdf'); pdfMake.createPdf(docDefinition).download('cobiss-obrazec.pdf');
} }
</script> </script>
</head>
<title>Spremni list o dokumentu/delu za vodenje bibliografij raziskovalcev v sistemu COBISS</title>
</head>
<body>
<form action="vnos.php" method="get"class="pure-form pure-form-aligned"> <form action="vnos.php" method="get"class="pure-form pure-form-aligned">
<fieldset> <fieldset>
@ -397,7 +344,3 @@ pdfMake.createPdf(docDefinition).download('cobiss-obrazec.pdf');
<button type="button" onclick="javascript:cobiss()" class="pure-button pure-button-primary">Izpiši pdf</button> <button type="button" onclick="javascript:cobiss()" class="pure-button pure-button-primary">Izpiši pdf</button>
</div> </div>
</fieldset> </fieldset>
</body>
</html>

View file

@ -1,70 +0,0 @@
var doc = new jsPDF();//{unit: 'px'}
doc.setFontSize(12);
doc.text(10, 105, 'ComboBox:');
var d = new ComboBox();
d.T = "ChoiceField1";
d.TI = 1;
d.Rect = [50, 100, 30, 10];
d.Opt = "[(a)(b)(c)]";
d.V = '(b)';
d.DV = '(b)';
doc.addField(d);
doc.text(10, 115, 'ListBox:');
var d2 = new ListBox();
d2.edit = false;
d2.T = "ChoiceField2";
d2.TI = 2;
d2.Rect = [50, 110, 30, 10];
d2.Opt = "[(c)(a)(d)(f)(b)(s)]";
d2.V = '(s)';
d2.BG = [0, 1, 1];
doc.addField(d2);
doc.text(10, 125, 'CheckBox:');
var checkBox = new CheckBox();
checkBox.T = "CheckBox1";
checkBox.Rect = [50, 120, 30, 10];
doc.addField(checkBox);
doc.text(10, 135, 'PushButton:');
var pushButton = new PushButton();
pushButton.T = "PushButton1";
pushButton.Rect = [50, 130, 30, 10];
pushButton.BG = [1, 0, 0];
doc.addField(pushButton);
doc.text(10, 145, 'TextField:');
var textField = new TextField();
textField.Rect = [50, 140, 30, 10];
textField.multiline = true;
textField.V = "The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse";//
textField.T = "TestTextBox";
//textField.Q = 2; // Text-Alignment
doc.addField(textField);
doc.text(10, 155, 'Password:');
var passwordField = new PasswordField();
passwordField.Rect = [50, 150, 30, 10];
doc.addField(passwordField);
doc.text(50, 165, 'RadioGroup:');
var radioGroup = new RadioButton();
radioGroup.V = "/Test";
radioGroup.Subtype = "Form";
doc.addField(radioGroup);
var radioButton1 = radioGroup.createOption("Test");
radioButton1.Rect = [50, 170, 30, 10];
radioButton1.AS = "/Test";
var radioButton2 = radioGroup.createOption("Test2");
radioButton2.Rect = [50, 180, 30, 10];
var radioButton3 = radioGroup.createOption("Test3");
radioButton3.Rect = [50, 190, 20, 10];
radioGroup.setAppearance(AcroForm.Appearance.RadioButton.Cross);

File diff suppressed because one or more lines are too long

View file

@ -1,382 +0,0 @@
function demoTwoPageDocument() {
var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you like that?');
// Save the PDF
doc.save('Test.pdf');
}
function demoLandscape() {
var doc = new jsPDF('landscape');
doc.text(20, 20, 'Hello landscape world!');
// Save the PDF
doc.save('Test.pdf');
}
function demoFontSizes() {
var doc = new jsPDF();
doc.setFontSize(22);
doc.text(20, 20, 'This is a title');
doc.setFontSize(16);
doc.text(20, 30, 'This is some normal sized text underneath.');
doc.save('Test.pdf');
}
function demoFontTypes() {
var doc = new jsPDF();
doc.text(20, 20, 'This is the default font.');
doc.setFont("courier");
doc.setFontType("normal");
doc.text(20, 30, 'This is courier normal.');
doc.setFont("times");
doc.setFontType("italic");
doc.text(20, 40, 'This is times italic.');
doc.setFont("helvetica");
doc.setFontType("bold");
doc.text(20, 50, 'This is helvetica bold.');
doc.setFont("courier");
doc.setFontType("bolditalic");
doc.text(20, 60, 'This is courier bolditalic.');
doc.save('Test.pdf');
}
function demoTextColors() {
var doc = new jsPDF();
doc.setTextColor(100);
doc.text(20, 20, 'This is gray.');
doc.setTextColor(150);
doc.text(20, 30, 'This is light gray.');
doc.setTextColor(255,0,0);
doc.text(20, 40, 'This is red.');
doc.setTextColor(0,255,0);
doc.text(20, 50, 'This is green.');
doc.setTextColor(0,0,255);
doc.text(20, 60, 'This is blue.');
// Output as Data URI
doc.output('datauri');
}
function demoMetadata() {
var doc = new jsPDF();
doc.text(20, 20, 'This PDF has a title, subject, author, keywords and a creator.');
// Optional - set properties on the document
doc.setProperties({
title: 'Title',
subject: 'This is the subject',
author: 'James Hall',
keywords: 'generated, javascript, web 2.0, ajax',
creator: 'MEEE'
});
doc.save('Test.pdf');
}
function demoUserInput() {
var name = prompt('What is your name?');
var multiplier = prompt('Enter a number:');
multiplier = parseInt(multiplier);
var doc = new jsPDF();
doc.setFontSize(22);
doc.text(20, 20, 'Questions');
doc.setFontSize(16);
doc.text(20, 30, 'This belongs to: ' + name);
for(var i = 1; i <= 12; i ++) {
doc.text(20, 30 + (i * 10), i + ' x ' + multiplier + ' = ___');
}
doc.addPage();
doc.setFontSize(22);
doc.text(20, 20, 'Answers');
doc.setFontSize(16);
for (i = 1; i <= 12; i ++) {
doc.text(20, 30 + (i * 10), i + ' x ' + multiplier + ' = ' + (i * multiplier));
}
doc.save('Test.pdf');
}
function demoRectangles() {
var doc = new jsPDF();
doc.rect(20, 20, 10, 10); // empty square
doc.rect(40, 20, 10, 10, 'F'); // filled square
doc.setDrawColor(255, 0, 0);
doc.rect(60, 20, 10, 10); // empty red square
doc.setDrawColor(255, 0, 0);
doc.rect(80, 20, 10, 10, 'FD'); // filled square with red borders
doc.setDrawColor(0);
doc.setFillColor(255, 0, 0);
doc.rect(100, 20, 10, 10, 'F'); // filled red square
doc.setDrawColor(0);
doc.setFillColor(255, 0, 0);
doc.rect(120, 20, 10, 10, 'FD'); // filled red square with black borders
doc.setDrawColor(0);
doc.setFillColor(255, 255, 255);
doc.roundedRect(140, 20, 10, 10, 3, 3, 'FD'); // Black square with rounded corners
doc.save('Test.pdf');
}
function demoLines() {
var doc = new jsPDF();
doc.line(20, 20, 60, 20); // horizontal line
doc.setLineWidth(0.5);
doc.line(20, 25, 60, 25);
doc.setLineWidth(1);
doc.line(20, 30, 60, 30);
doc.setLineWidth(1.5);
doc.line(20, 35, 60, 35);
doc.setDrawColor(255,0,0); // draw red lines
doc.setLineWidth(0.1);
doc.line(100, 20, 100, 60); // vertical line
doc.setLineWidth(0.5);
doc.line(105, 20, 105, 60);
doc.setLineWidth(1);
doc.line(110, 20, 110, 60);
doc.setLineWidth(1.5);
doc.line(115, 20, 115, 60);
// Output as Data URI
doc.output('datauri');
}
function demoCircles() {
var doc = new jsPDF();
doc.ellipse(40, 20, 10, 5);
doc.setFillColor(0,0,255);
doc.ellipse(80, 20, 10, 5, 'F');
doc.setLineWidth(1);
doc.setDrawColor(0);
doc.setFillColor(255,0,0);
doc.circle(120, 20, 5, 'FD');
doc.save('Test.pdf');
}
function demoTriangles() {
var doc = new jsPDF();
doc.triangle(60, 100, 60, 120, 80, 110, 'FD');
doc.setLineWidth(1);
doc.setDrawColor(255,0,0);
doc.setFillColor(0,0,255);
doc.triangle(100, 100, 110, 100, 120, 130, 'FD');
doc.save('Test.pdf');
}
function demoImages() {
// Because of security restrictions, getImageFromUrl will
// not load images from other domains. Chrome has added
// security restrictions that prevent it from loading images
// when running local files. Run with: chromium --allow-file-access-from-files --allow-file-access
// to temporarily get around this issue.
var getImageFromUrl = function(url, callback) {
var img = new Image(), data, ret = {
data: null,
pending: true
};
img.onError = function() {
throw new Error('Cannot load image: "'+url+'"');
};
img.onload = function() {
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
// Grab the image as a jpeg encoded in base64, but only the data
data = canvas.toDataURL('image/jpeg').slice('data:image/jpeg;base64,'.length);
// Convert the data to binary form
data = atob(data);
document.body.removeChild(canvas);
ret['data'] = data;
ret['pending'] = false;
if (typeof callback === 'function') {
callback(data);
}
};
img.src = url;
return ret;
};
// Since images are loaded asyncronously, we must wait to create
// the pdf until we actually have the image data.
// If we already had the jpeg image binary data loaded into
// a string, we create the pdf without delay.
var createPDF = function(imgData) {
var doc = new jsPDF();
doc.addImage(imgData, 'JPEG', 10, 10, 50, 50);
doc.addImage(imgData, 'JPEG', 70, 10, 100, 120);
doc.save('output.pdf');
}
getImageFromUrl('thinking-monkey.jpg', createPDF);
}
function demoStringSplitting() {
var pdf = new jsPDF('p','in','letter')
, sizes = [12, 16, 20]
, fonts = [['Times','Roman'],['Helvetica',''], ['Times','Italic']]
, font, size, lines
, margin = 0.5 // inches on a 8.5 x 11 inch sheet.
, verticalOffset = margin
, loremipsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id eros turpis. Vivamus tempor urna vitae sapien mollis molestie. Vestibulum in lectus non enim bibendum laoreet at at libero. Etiam malesuada erat sed sem blandit in varius orci porttitor. Sed at sapien urna. Fusce augue ipsum, molestie et adipiscing at, varius quis enim. Morbi sed magna est, vel vestibulum urna. Sed tempor ipsum vel mi pretium at elementum urna tempor. Nulla faucibus consectetur felis, elementum venenatis mi mollis gravida. Aliquam mi ante, accumsan eu tempus vitae, viverra quis justo.\n\nProin feugiat augue in augue rhoncus eu cursus tellus laoreet. Pellentesque eu sapien at diam porttitor venenatis nec vitae velit. Donec ultrices volutpat lectus eget vehicula. Nam eu erat mi, in pulvinar eros. Mauris viverra porta orci, et vehicula lectus sagittis id. Nullam at magna vitae nunc fringilla posuere. Duis volutpat malesuada ornare. Nulla in eros metus. Vivamus a posuere libero.'
// Margins:
pdf.setDrawColor(0, 255, 0)
.setLineWidth(1/72)
.line(margin, margin, margin, 11 - margin)
.line(8.5 - margin, margin, 8.5-margin, 11-margin)
// the 3 blocks of text
for (var i in fonts){
if (fonts.hasOwnProperty(i)) {
font = fonts[i]
size = sizes[i]
lines = pdf.setFont(font[0], font[1])
.setFontSize(size)
.splitTextToSize(loremipsum, 7.5)
// Don't want to preset font, size to calculate the lines?
// .splitTextToSize(text, maxsize, options)
// allows you to pass an object with any of the following:
// {
// 'fontSize': 12
// , 'fontStyle': 'Italic'
// , 'fontName': 'Times'
// }
// Without these, .splitTextToSize will use current / default
// font Family, Style, Size.
console.log(lines);
pdf.text(0.5, verticalOffset + size / 72, lines)
verticalOffset += (lines.length + 0.5) * size / 72
}
}
pdf.save('Test.pdf');
}
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter')
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
, source = $('#fromHTMLtestdiv')[0]
// we support special element handlers. Register them with jQuery-style
// ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
// There is no support for any other type of selectors
// (class, of compound) at this time.
, specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme': function(element, renderer){
// true = "handled elsewhere, bypass text extraction"
return true
}
}
margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
// all coords and widths are in jsPDF instance's declared units
// 'inches' in this case
pdf.fromHTML(
source // HTML string or DOM elem ref.
, margins.left // x coord
, margins.top // y coord
, {
'width': margins.width // max width of content on PDF
, 'elementHandlers': specialElementHandlers
},
function (dispose) {
// dispose: object with X, Y of the last line add to the PDF
// this allow the insertion of new lines after html
pdf.save('Test.pdf');
},
margins
)
}
function demoTextAlign() {
var pdf = new jsPDF('p', 'pt', 'letter');
pdf.setFillColor(0);
pdf.circle( 140, 50, 2, "F" );
pdf.text( 'This text is normally\raligned.', 140, 50 );
pdf.circle( 140, 120, 2, "F" );
pdf.text( 'This text is centered\raround\rthis point.', 140, 120, 'center' );
pdf.circle( 140, 300, 2, "F" );
pdf.text( 'This text is rotated\rand centered around\rthis point.', 140, 300, 45, 'center' );
pdf.circle( 140, 400, 2, "F" );
pdf.text( 'This text is\raligned to the\rright.', 140, 400, 'right' );
pdf.circle( 140, 550, 2, "F" );
pdf.text( 'This text is\raligned to the\rright.', 140, 550, 45, 'right' );
pdf.circle( 460, 50, 2, "F" );
pdf.text( 'This single line is centered', 460, 50, 'center' );
pdf.circle( 460, 200, 2, "F" );
pdf.text( 'This right aligned text\r\rhas an empty line.', 460, 200, 'right' );
pdf.save('Test.pdf');
}

View file

@ -1,11 +0,0 @@
var doc = new jsPDF();
doc.ellipse(40, 20, 10, 5);
doc.setFillColor(0,0,255);
doc.ellipse(80, 20, 10, 5, 'F');
doc.setLineWidth(1);
doc.setDrawColor(0);
doc.setFillColor(255,0,0);
doc.circle(120, 20, 5, 'FD');

File diff suppressed because one or more lines are too long

View file

@ -1,30 +0,0 @@
var doc = new jsPDF();
doc.text(20, 20, 'This is the default font.');
doc.setFont("courier");
doc.setFontType("normal");
doc.text(20, 30, 'This is courier normal.');
doc.setFont("times");
doc.setFontType("italic");
doc.text(20, 40, 'This is times italic.');
doc.setFont("helvetica");
doc.setFontType("bold");
doc.text(20, 50, 'This is helvetica bold.');
doc.setFont("courier");
doc.setFontType("bolditalic");
doc.text(20, 60, 'This is courier bolditalic.');
doc.setFont("times");
doc.setFontType("normal");
doc.text(105, 80, 'This is centred text.', null, null, 'center');
doc.text(105, 90, 'And a little bit more underneath it.', null, null, 'center');
doc.text(200, 100, 'This is right aligned text', null, null, 'right');
doc.text(200, 110, 'And some more', null, null, 'right');
doc.text(20, 120, 'Back to left');
doc.text(20, 140, '10 degrees rotated', null, 10);
doc.text(20, 160, '-10 degrees rotated', null, -10);

View file

@ -1,6 +0,0 @@
var doc = new jsPDF();
doc.setFontSize(22);
doc.text(20, 20, 'This is a title');
doc.setFontSize(16);
doc.text(20, 30, 'This is some normal sized text underneath.');

View file

@ -1,15 +0,0 @@
var doc = new jsPDF();
// We'll make our own renderer to skip this editor
var specialElementHandlers = {
'#editor': function(element, renderer){
return true;
}
};
// All units are in the set measurement for the document
// This can be changed to "pt" (points), "mm" (Default), "cm", "in"
doc.fromHTML($('body').get(0), 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});

View file

@ -1,7 +0,0 @@
var pdf = new jsPDF('p','pt','a4');
pdf.addHTML(document.body,function() {
var string = pdf.output('datauristring');
$('.preview-pane').attr('src', string);
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
// Kitchen Sink Example

View file

@ -1,2 +0,0 @@
var doc = new jsPDF('landscape');
doc.text(20, 20, 'Hello landscape world!');

View file

@ -1,26 +0,0 @@
var doc = new jsPDF();
doc.line(20, 20, 60, 20); // horizontal line
doc.setLineWidth(0.5);
doc.line(20, 25, 60, 25);
doc.setLineWidth(1);
doc.line(20, 30, 60, 30);
doc.setLineWidth(1.5);
doc.line(20, 35, 60, 35);
doc.setDrawColor(255,0,0); // draw red lines
doc.setLineWidth(0.1);
doc.line(100, 20, 100, 60); // vertical line
doc.setLineWidth(0.5);
doc.line(105, 20, 105, 60);
doc.setLineWidth(1);
doc.line(110, 20, 110, 60);
doc.setLineWidth(1.5);
doc.line(115, 20, 115, 60);

View file

@ -1,30 +0,0 @@
var doc = new jsPDF();
// Empty square
doc.rect(20, 20, 10, 10);
// Filled square
doc.rect(40, 20, 10, 10, 'F');
// Empty red square
doc.setDrawColor(255,0,0);
doc.rect(60, 20, 10, 10);
// Filled square with red borders
doc.setDrawColor(255,0,0);
doc.rect(80, 20, 10, 10, 'FD');
// Filled red square
doc.setDrawColor(0);
doc.setFillColor(255,0,0);
doc.rect(100, 20, 10, 10, 'F');
// Filled red square with black borders
doc.setDrawColor(0);
doc.setFillColor(255,0,0);
doc.rect(120, 20, 10, 10, 'FD');
// Black square with rounded corners
doc.setDrawColor(0);
doc.setFillColor(255, 255, 255);
doc.roundedRect(140, 20, 10, 10, 3, 3, 'FD');

View file

@ -1,40 +0,0 @@
// @TODO: Need to simplify this demo
var doc = new jsPDF('p','in','letter')
, sizes = [12, 16, 20]
, fonts = [['Times','Roman'],['Helvetica',''], ['Times','Italic']]
, font, size, lines
, margin = 0.5 // inches on a 8.5 x 11 inch sheet.
, verticalOffset = margin
, loremipsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id eros turpis. Vivamus tempor urna vitae sapien mollis molestie. Vestibulum in lectus non enim bibendum laoreet at at libero. Etiam malesuada erat sed sem blandit in varius orci porttitor. Sed at sapien urna. Fusce augue ipsum, molestie et adipiscing at, varius quis enim. Morbi sed magna est, vel vestibulum urna. Sed tempor ipsum vel mi pretium at elementum urna tempor. Nulla faucibus consectetur felis, elementum venenatis mi mollis gravida. Aliquam mi ante, accumsan eu tempus vitae, viverra quis justo.\n\nProin feugiat augue in augue rhoncus eu cursus tellus laoreet. Pellentesque eu sapien at diam porttitor venenatis nec vitae velit. Donec ultrices volutpat lectus eget vehicula. Nam eu erat mi, in pulvinar eros. Mauris viverra porta orci, et vehicula lectus sagittis id. Nullam at magna vitae nunc fringilla posuere. Duis volutpat malesuada ornare. Nulla in eros metus. Vivamus a posuere libero.'
// Margins:
doc.setDrawColor(0, 255, 0)
.setLineWidth(1/72)
.line(margin, margin, margin, 11 - margin)
.line(8.5 - margin, margin, 8.5-margin, 11-margin)
// the 3 blocks of text
for (var i in fonts){
if (fonts.hasOwnProperty(i)) {
font = fonts[i]
size = sizes[i]
lines = doc.setFont(font[0], font[1])
.setFontSize(size)
.splitTextToSize(loremipsum, 7.5)
// Don't want to preset font, size to calculate the lines?
// .splitTextToSize(text, maxsize, options)
// allows you to pass an object with any of the following:
// {
// 'fontSize': 12
// , 'fontStyle': 'Italic'
// , 'fontName': 'Times'
// }
// Without these, .splitTextToSize will use current / default
// font Family, Style, Size.
doc.text(0.5, verticalOffset + size / 72, lines)
verticalOffset += (lines.length + 0.5) * size / 72
}
}

View file

@ -1,161 +0,0 @@
/**
* jsPDF PDF Test Harness
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
/**
* An easy way to view PDF and PDF source code side by side.
*/
pdf_test_harness_init = function(pdf, message) {
var harness = new pdf_test_harness();
var body = document.getElementsByTagName('body')[0];
body.style.display = 'flex';
var div = document.createElement('div');
div.setAttribute('style', 'position:fixed;height:20px;left:0;right:0;background:lightblue');
body.appendChild(div);
harness.header = div;
var div2 = document.createElement('div');
div2.setAttribute('style', 'position:fixed;display:flex;top:20px; bottom:0;left:0;right:0');
body.appendChild(div2);
harness.body = div2;
var btn1 = document.createElement('input');
btn1.setAttribute('type', 'radio');
btn1.setAttribute('name', 'view');
div.appendChild(btn1);
btn1.checked = true;
var lbl1 = document.createElement('label');
lbl1.setAttribute('for', 'btn1');
lbl1.innerHTML = 'PDF'
div.appendChild(lbl1);
var btn2 = document.createElement('input');
btn2.setAttribute('type', 'radio');
btn2.setAttribute('name', 'view');
div.appendChild(btn2);
var lbl2 = document.createElement('label');
lbl2.setAttribute('for', 'btn2');
lbl2.innerHTML = 'Source'
div.appendChild(lbl2);
var btn3 = document.createElement('input');
btn3.setAttribute('type', 'radio');
btn3.setAttribute('name', 'view');
div.appendChild(btn3);
var lbl3 = document.createElement('label');
lbl3.setAttribute('for', 'btn3');
lbl3.innerHTML = 'Both'
div.appendChild(lbl3);
harness.source = document.createElement('pre');
harness.source.setAttribute('style', 'margin-top:0;width:100%;height:100%;position:absolute;top:0px;bottom:0px;overflow:auto');
div2.appendChild(harness.source);
harness.iframe = document.createElement('iframe');
harness.iframe.setAttribute('style', 'width:100%;height:100%;position:absolute;overflow:auto;top:0px;bottom:0px');
div2.appendChild(harness.iframe);
//if (pdf_test_harness.onload) {
//harness.pdf = pdf_test_harness.onload(harness);
if (message) {
message += "<p style='text-align:center;font-style:italic;font-size:.8em'>click to close</p>";
var popup = document.createElement('div');
popup.setAttribute('style', 'z-index:100;margin:100px auto;cursor:pointer;font-size:1.3em;top:50px;background-color:rgb(243, 224, 141);padding:1em;border:1px solid black');
popup.innerHTML = message;
body.appendChild(popup);
popup.onclick = function() {
popup.parentNode.removeChild(popup);
}
}
//}
harness.pdf = pdf;
harness.render('pdf');
btn1.onclick = function() {
harness.render('pdf');
}
btn2.onclick = function() {
harness.render('source');
}
btn3.onclick = function() {
harness.render('both');
}
return harness;
}
pdf_test_harness = function(pdf) {
this.pdf = pdf;
this.onload = undefined;
this.iframe = undefined;
this.entityMap = {
"&" : "&amp;",
"<" : "&lt;",
">" : "&gt;",
'"' : '&quot;',
"'" : '&#39;',
"/" : '&#x2F;'
};
this.escapeHtml = function(string) {
return String(string).replace(/[&<>"'\/]/g, function(s) {
return this.entityMap[s];
}.bind(this));
};
this.getParameterByName = function(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
};
this.setPdf = function(pdf) {
this.pdf = pdf;
this.rendered = undefined;
this.render(this.view);
};
// generate the pdf, the source code, or both
this.render = function(view) {
this.view = view;
//Current code only lets us render one time.
if (!this.rendered) {
this.rendered = this.pdf.output('datauristring');
this.iframe.src = this.rendered;
var raw = this.pdf.output();
raw = this.escapeHtml(raw);
this.source.innerHTML = raw;
}
if ('pdf' === view) {
this.source.style.display = 'none';
this.iframe.style.display = 'block';
this.iframe.style.width = '100%';
} else if ('source' === view) {
this.iframe.style.display = 'none';
this.source.style.display = 'block';
this.source.style.width = '100%';
}
if ('both' === view) {
raw = this.escapeHtml(raw);
this.iframe.style.width = '50%';
this.iframe.style.position = 'relative';
this.iframe.style.display = 'inline-block';
this.source.style.width = '50%';
this.source.style.position = 'relative';
this.source.style.display = 'inline-block';
}
}
}

View file

@ -1,17 +0,0 @@
var doc = new jsPDF();
// I know the proper spelling is colour ;)
doc.setTextColor(100);
doc.text(20, 20, 'This is gray.');
doc.setTextColor(150);
doc.text(20, 30, 'This is light gray.');
doc.setTextColor(255, 0, 0);
doc.text(20, 40, 'This is red.');
doc.setTextColor(0, 255, 0);
doc.text(20, 50, 'This is green.');
doc.setTextColor(0, 0, 255);
doc.text(20, 60, 'This is blue.');

File diff suppressed because one or more lines are too long

View file

@ -1,8 +0,0 @@
var doc = new jsPDF();
doc.triangle(60, 100, 60, 120, 80, 110, 'FD');
doc.setLineWidth(1);
doc.setDrawColor(255,0,0);
doc.setFillColor(0,0,255);
doc.triangle(100, 100, 110, 100, 120, 130, 'FD');

View file

@ -1,5 +0,0 @@
var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage('a6','l');
doc.text(20, 20, 'Do you like that?');

View file

@ -1,27 +0,0 @@
var name = prompt('What is your name?');
var multiplier = parseInt(prompt('Enter a number:'));
var doc = new jsPDF();
doc.setFontSize(22);
doc.text(20, 20, 'Questions');
doc.setFontSize(16);
doc.text(20, 30, 'This belongs to: ' + name);
for(var i = 1; i <= 12; i ++) {
doc.text(20, 30 + (i * 10), i + ' x ' + multiplier + ' = ___');
}
doc.addPage();
doc.setFontSize(22);
doc.text(20, 20, 'Answers');
doc.setFontSize(16);
for(var i = 1; i <= 12; i ++) {
doc.text(20, 30 + (i * 10), i + ' x ' + multiplier + ' = ' + (i * multiplier));
}
// You wouldn't normally call this - this is just to make the
// demo not look broken as we've disabled auto update.
if (jsPDFEditor !== undefined) {
jsPDFEditor.update(true);
}