-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakePdf.sh
executable file
·103 lines (81 loc) · 1.19 KB
/
makePdf.sh
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
#generate a zip containing many different pdfs (name and content)
PDF1=$(cat <<'END'
%PDF-1.7
1 0 obj % entry point
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/MediaBox [ 0 0 400 550 ]
/Count 1
/Kids [ 3 0 R ]
>>
endobj
3 0 obj
<<
/Type /Page
/Parent 2 0 R
/Resources <<
/Font <<
/F1 4 0 R
>>
>>
/Contents 5 0 R
>>
endobj
4 0 obj
<<
/Type /Font
/Subtype /Type1
/BaseFont /Times-Roman
>>
endobj
5 0 obj % page content
<<
/Length 44
>>
stream
BT
70 50 TD
/F1 12 Tf
END
)
PDF2=$(cat <<'END1'
ET
endstream
endobj
xref
0 6
0000000000 65535 f
0000000010 00000 n
0000000079 00000 n
0000000173 00000 n
0000000301 00000 n
0000000380 00000 n
trailer
<<
/Size 6
/Root 1 0 R
>>
startxref
492
%%EOF
END1
)
NUM="012345"
#ramdom (nanoseconds actually): to make pdfs in bytes different
STR="(number: $NUM random: $(date +%N)) Tj"
NUMPDF=500
DATA=$(date +%Y-%m-%d_%H_%M_%S)
rm -f makePdf*.pdf
for F in $(seq -f "%03g" 1 $NUMPDF) ;do
echo "$PDF1 (number: $NUM random: $(date +%N) id: $F ) Tj $PDF2" > makePdf-$NUM-$F.pdf
done
rm -f makePdf*.zip
zip makePdf-$DATA-$NUMPDF-pdfs.zip makePdf*.pdf
rm -f makePdf*.pdf