Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
875 lars 1
$(document).ready(function(){
2
 
3
var getDocument = function(){
4
    var doc = new jsPDF()
5
    doc.text(20, 20, 'Hello world!')
6
    doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.')
7
    doc.addPage()
8
    doc.text(20, 20, 'Do you like that?')
9
    doc.setFontSize(22)
10
    doc.text(20, 20, 'This is a title')
11
 
12
    doc.setFontSize(16)
13
    doc.text(20, 30, 'This is some normal sized text underneath.');
14
    doc.text(20, 20, 'This is the default font.')
15
 
16
    doc.setFont("courier")
17
    doc.setFontType("normal")
18
    doc.text(20, 30, 'This is courier normal.')
19
 
20
    doc.setFont("times")
21
    doc.setFontType("italic")
22
    doc.text(20, 40, 'This is times italic.')
23
 
24
    doc.setFont("helvetica")
25
    doc.setFontType("bold")
26
    doc.text(20, 50, 'This is helvetica bold.')
27
 
28
    doc.setFont("courier")
29
    doc.setFontType("bolditalic")
30
    doc.text(20, 60, 'This is courier bolditalic.')
31
 
32
    doc.setTextColor(100)
33
    doc.text(20, 20, 'This is gray.')
34
 
35
    doc.setTextColor(150)
36
    doc.text(20, 30, 'This is light gray.')
37
 
38
    doc.setTextColor(255,0,0)
39
    doc.text(20, 40, 'This is red.')
40
 
41
    doc.setTextColor(0,255,0)
42
    doc.text(20, 50, 'This is green.')
43
 
44
    doc.setTextColor(0,0,255)
45
    doc.text(20, 60, 'This is blue.')
46
 
47
    // Optional - set properties on the document
48
    doc.setProperties({
49
        title: 'Title',
50
        subject: 'This is the subject',
51
        author: 'James Hall',
52
        keywords: 'generated, javascript, web 2.0, ajax',
53
        creator: 'MEEE'
54
    })
55
 
56
    doc.rect(20, 20, 10, 10); // empty square
57
 
58
    doc.rect(40, 20, 10, 10, 'F') // filled square
59
 
60
    doc.setDrawColor(255,0,0)
61
    doc.rect(60, 20, 10, 10); // empty red square
62
 
63
    doc.setDrawColor(255,0,0)
64
    doc.rect(80, 20, 10, 10, 'FD') // filled square with red borders
65
 
66
    doc.setDrawColor(0)
67
    doc.setFillColor(255,0,0)
68
    doc.rect(100, 20, 10, 10, 'F') // filled red square
69
 
70
    doc.setDrawColor(0)
71
    doc.setFillColor(255,0,0)
72
    doc.rect(120, 20, 10, 10, 'FD') // filled red square with black borders
73
 
74
    doc.line(20, 20, 60, 20) // horizontal line
75
 
76
    doc.setLineWidth(0.5)
77
    doc.line(20, 25, 60, 25)
78
 
79
    doc.setLineWidth(1)
80
    doc.line(20, 30, 60, 30)
81
 
82
    doc.setLineWidth(1.5)
83
    doc.line(20, 35, 60, 35)
84
 
85
    doc.setDrawColor(255,0,0) // draw red lines
86
 
87
    doc.setLineWidth(0.1)
88
    doc.line(100, 20, 100, 60) // vertical line
89
 
90
    doc.setLineWidth(0.5)
91
    doc.line(105, 20, 105, 60)
92
 
93
    doc.setLineWidth(1)
94
    doc.line(110, 20, 110, 60)
95
 
96
    doc.setLineWidth(1.5)
97
    doc.line(115, 20, 115, 60)
98
 
99
    doc.ellipse(40, 20, 10, 5)
100
 
101
    doc.setFillColor(0,0,255)
102
    doc.ellipse(80, 20, 10, 5, 'F')
103
 
104
    doc.setLineWidth(1)
105
    doc.setDrawColor(0)
106
    doc.setFillColor(255,0,0)
107
    doc.circle(120, 20, 5, 'FD')
108
 
109
    , text = [
110
        'This is line one'
111
        , 'This is line two'
112
        , 'This is line three'
113
        , 'This is line four'
114
        , 'This is line five'
115
    ]
116
    doc.text(20, 20, text)
117
    return doc.output()
118
}
119
test('compare_native_software_base64', function() {
120
 
121
    var  text = getDocument()
122
 
123
    QUnit.expect(1)
124
    QUnit.equal(
125
        base64_encode_with_native_fallback(text)
126
        , base64_encode(text)
127
    )
128
})
129
 
130
}) // end of document.ready(