| 1 |
|
| MODULE = PDF::Make PACKAGE = PDF::Make::Document |
| 2 |
|
| PROTOTYPES: ENABLE |
| 3 |
|
| |
| 4 |
|
| pdfmake_doc_t * |
| 5 |
|
| new(class) |
| 6 |
|
| char *class |
| 7 |
|
| CODE: |
| 8 |
798 |
| RETVAL = pdfmake_doc_new(); |
| 9 |
798 |
▶ | if (!RETVAL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!RETVAL) { |
0 |
798 |
798 |
|
| 10 |
0 |
| croak("PDF::Make::Document::new: failed to create document"); |
| 11 |
|
| } |
| 12 |
|
| OUTPUT: |
| 13 |
|
| RETVAL |
| 14 |
|
| |
| 15 |
|
| UV |
| 16 |
|
| add(self, obj_sv) |
| 17 |
|
| pdfmake_doc_t *self |
| 18 |
|
| SV *obj_sv |
| 19 |
|
| CODE: |
| 20 |
|
| /* For now, accept simple scalars. Full object support later. */ |
| 21 |
|
| pdfmake_obj_t obj; |
| 22 |
22 |
| pdfmake_arena_t *arena = pdfmake_doc_arena(self); |
| 23 |
|
| |
| 24 |
22 |
▶ | if (!SvOK(obj_sv)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvOK(obj_sv)) { |
0 |
22 |
22 |
|
| 25 |
0 |
| obj = pdfmake_null(); |
| 26 |
|
| } |
| 27 |
22 |
▶ | else if (SvIOK(obj_sv)) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvIOK(obj_sv)) { |
8 |
14 |
22 |
|
| 28 |
8 |
| obj = pdfmake_int(SvIV(obj_sv)); |
| 29 |
|
| } |
| 30 |
14 |
▶ | else if (SvNOK(obj_sv)) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvNOK(obj_sv)) { |
1 |
13 |
14 |
|
| 31 |
1 |
| obj = pdfmake_real(SvNV(obj_sv)); |
| 32 |
|
| } |
| 33 |
13 |
▶ | else if (SvPOK(obj_sv)) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvPOK(obj_sv)) { |
13 |
0 |
13 |
|
| 34 |
|
| STRLEN len; |
| 35 |
13 |
| const char *str = SvPV(obj_sv, len); |
| 36 |
13 |
| obj = pdfmake_str(arena, str, len); |
| 37 |
|
| } |
| 38 |
|
| else { |
| 39 |
0 |
| croak("PDF::Make::Document::add: unsupported object type"); |
| 40 |
|
| } |
| 41 |
|
| |
| 42 |
22 |
| RETVAL = pdfmake_doc_add(self, obj); |
| 43 |
22 |
▶ | if (RETVAL == 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL == 0) { |
0 |
22 |
22 |
|
| 44 |
0 |
| croak("PDF::Make::Document::add: failed to add object"); |
| 45 |
|
| } |
| 46 |
|
| OUTPUT: |
| 47 |
|
| RETVAL |
| 48 |
|
| |
| 49 |
|
| void |
| 50 |
|
| set_root(self, num, gen = 0) |
| 51 |
|
| pdfmake_doc_t *self |
| 52 |
|
| UV num |
| 53 |
|
| UV gen |
| 54 |
|
| CODE: |
| 55 |
12 |
| pdfmake_doc_set_root(self, (uint32_t)num, (uint16_t)gen); |
| 56 |
|
| |
| 57 |
|
| void |
| 58 |
|
| set_info(self, num, gen = 0) |
| 59 |
|
| pdfmake_doc_t *self |
| 60 |
|
| UV num |
| 61 |
|
| UV gen |
| 62 |
|
| CODE: |
| 63 |
1 |
| pdfmake_doc_set_info(self, (uint32_t)num, (uint16_t)gen); |
| 64 |
|
| |
| 65 |
|
| void |
| 66 |
|
| set_encryption(self, algorithm, user_passwd, owner_passwd, permissions) |
| 67 |
|
| pdfmake_doc_t *self |
| 68 |
|
| const char *algorithm |
| 69 |
|
| const char *user_passwd |
| 70 |
|
| SV *owner_passwd |
| 71 |
|
| IV permissions |
| 72 |
|
| PREINIT: |
| 73 |
|
| pdfmake_crypt_algo_t algo; |
| 74 |
5 |
| const char *owner = NULL; |
| 75 |
|
| CODE: |
| 76 |
5 |
▶ | if (strEQ(algorithm, "RC4-40") || strEQ(algorithm, "rc4-40")) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (strEQ(algorithm, "RC4-40") || strEQ(algorithm, "rc4-40")) { |
5 |
0 |
5 |
| if (strEQ(algorithm, "RC4-40") || strEQ(algorithm, "rc4-40")) { |
0 |
5 |
5 |
|
| 77 |
0 |
| algo = PDFMAKE_CRYPT_RC4_40; |
| 78 |
5 |
▶ | } else if (strEQ(algorithm, "RC4-128") || strEQ(algorithm, "rc4-128")) { |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (strEQ(algorithm, "RC4-128") || strEQ(algorithm, "rc4-128")) { |
4 |
1 |
5 |
| } else if (strEQ(algorithm, "RC4-128") || strEQ(algorithm, "rc4-128")) { |
0 |
4 |
4 |
|
| 79 |
1 |
| algo = PDFMAKE_CRYPT_RC4_128; |
| 80 |
4 |
▶ | } else if (strEQ(algorithm, "AES-128") || strEQ(algorithm, "aes-128")) { |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (strEQ(algorithm, "AES-128") || strEQ(algorithm, "aes-128")) { |
3 |
1 |
4 |
| } else if (strEQ(algorithm, "AES-128") || strEQ(algorithm, "aes-128")) { |
0 |
3 |
3 |
|
| 81 |
1 |
| algo = PDFMAKE_CRYPT_AES_128; |
| 82 |
3 |
▶ | } else if (strEQ(algorithm, "AES-256") || strEQ(algorithm, "aes-256")) { |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (strEQ(algorithm, "AES-256") || strEQ(algorithm, "aes-256")) { |
0 |
3 |
3 |
| } else if (strEQ(algorithm, "AES-256") || strEQ(algorithm, "aes-256")) { |
0 |
0 |
0 |
|
| 83 |
3 |
| algo = PDFMAKE_CRYPT_AES_256; |
| 84 |
|
| } else { |
| 85 |
0 |
| croak("PDF::Make::Document::set_encryption: unknown algorithm '%s'", algorithm); |
| 86 |
|
| } |
| 87 |
10 |
▶ | if (SvOK(owner_passwd)) owner = SvPV_nolen(owner_passwd); |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvOK(owner_passwd)) owner = SvPV_nolen(owner_passwd); |
5 |
0 |
5 |
|
| 88 |
5 |
▶ | if (pdfmake_doc_set_encryption(self, algo, user_passwd, owner, |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_doc_set_encryption(self, algo, user_passwd, owner, |
0 |
5 |
5 |
|
| 89 |
|
| (int32_t)permissions) != PDFMAKE_OK) { |
| 90 |
0 |
| croak("PDF::Make::Document::set_encryption: failed"); |
| 91 |
|
| } |
| 92 |
|
| |
| 93 |
|
| SV * |
| 94 |
|
| to_bytes(self) |
| 95 |
|
| pdfmake_doc_t *self |
| 96 |
|
| CODE: |
| 97 |
|
| pdfmake_buf_t buf; |
| 98 |
421 |
▶ | if (pdfmake_buf_init(&buf) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_init(&buf) != PDFMAKE_OK) { |
0 |
421 |
421 |
|
| 99 |
0 |
| croak("PDF::Make::Document::to_bytes: buffer init failed"); |
| 100 |
|
| } |
| 101 |
421 |
▶ | if (pdfmake_doc_write(self, &buf) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_doc_write(self, &buf) != PDFMAKE_OK) { |
0 |
421 |
421 |
|
| 102 |
0 |
| pdfmake_buf_free(&buf); |
| 103 |
0 |
| croak("PDF::Make::Document::to_bytes: write failed"); |
| 104 |
|
| } |
| 105 |
421 |
| RETVAL = newSVpvn((char *)buf.data, buf.len); |
| 106 |
421 |
| pdfmake_buf_free(&buf); |
| 107 |
|
| OUTPUT: |
| 108 |
|
| RETVAL |
| 109 |
|
| |
| 110 |
|
| void |
| 111 |
|
| to_file(self, path) |
| 112 |
|
| pdfmake_doc_t *self |
| 113 |
|
| const char *path |
| 114 |
|
| CODE: |
| 115 |
|
| pdfmake_buf_t buf; |
| 116 |
177 |
▶ | if (pdfmake_buf_init(&buf) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_buf_init(&buf) != PDFMAKE_OK) { |
0 |
177 |
177 |
|
| 117 |
0 |
| croak("PDF::Make::Document::to_file: buffer init failed"); |
| 118 |
|
| } |
| 119 |
177 |
▶ | if (pdfmake_doc_write(self, &buf) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_doc_write(self, &buf) != PDFMAKE_OK) { |
0 |
177 |
177 |
|
| 120 |
0 |
| pdfmake_buf_free(&buf); |
| 121 |
0 |
| croak("PDF::Make::Document::to_file: write failed"); |
| 122 |
|
| } |
| 123 |
|
| |
| 124 |
177 |
| FILE *fp = fopen(path, "wb"); |
| 125 |
177 |
▶ | if (!fp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!fp) { |
1 |
176 |
177 |
|
| 126 |
1 |
| pdfmake_buf_free(&buf); |
| 127 |
1 |
| croak("PDF::Make::Document::to_file: cannot open %s", path); |
| 128 |
|
| } |
| 129 |
176 |
| size_t expected = buf.len; |
| 130 |
176 |
| size_t written = fwrite(buf.data, 1, buf.len, fp); |
| 131 |
176 |
| fclose(fp); |
| 132 |
176 |
| pdfmake_buf_free(&buf); |
| 133 |
|
| |
| 134 |
176 |
▶ | if (written != expected) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (written != expected) { |
0 |
176 |
176 |
|
| 135 |
0 |
| croak("PDF::Make::Document::to_file: write incomplete"); |
| 136 |
|
| } |
| 137 |
|
| |
| 138 |
|
| SV * |
| 139 |
|
| title(self, ...) |
| 140 |
|
| pdfmake_doc_t *self |
| 141 |
|
| CODE: |
| 142 |
116 |
▶ | if (items > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) { |
67 |
49 |
116 |
|
| 143 |
67 |
| const char *val = SvPV_nolen(ST(1)); |
| 144 |
67 |
▶ | if (pdfmake_meta_set_title(self, val) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_meta_set_title(self, val) != PDFMAKE_OK) { |
0 |
67 |
67 |
|
| 145 |
0 |
| croak("PDF::Make::Document::title: failed to set title"); |
| 146 |
|
| } |
| 147 |
67 |
| RETVAL = ST(1); |
| 148 |
67 |
| SvREFCNT_inc(RETVAL); |
| 149 |
|
| } else { |
| 150 |
49 |
| const char *val = pdfmake_meta_get_title(self); |
| 151 |
49 |
▶ | RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
47 |
2 |
49 |
|
| 152 |
|
| } |
| 153 |
|
| OUTPUT: |
| 154 |
|
| RETVAL |
| 155 |
|
| |
| 156 |
|
| SV * |
| 157 |
|
| author(self, ...) |
| 158 |
|
| pdfmake_doc_t *self |
| 159 |
|
| CODE: |
| 160 |
61 |
▶ | if (items > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) { |
57 |
4 |
61 |
|
| 161 |
57 |
| const char *val = SvPV_nolen(ST(1)); |
| 162 |
57 |
▶ | if (pdfmake_meta_set_author(self, val) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_meta_set_author(self, val) != PDFMAKE_OK) { |
0 |
57 |
57 |
|
| 163 |
0 |
| croak("PDF::Make::Document::author: failed to set author"); |
| 164 |
|
| } |
| 165 |
57 |
| RETVAL = ST(1); |
| 166 |
57 |
| SvREFCNT_inc(RETVAL); |
| 167 |
|
| } else { |
| 168 |
4 |
| const char *val = pdfmake_meta_get_author(self); |
| 169 |
4 |
▶ | RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
3 |
1 |
4 |
|
| 170 |
|
| } |
| 171 |
|
| OUTPUT: |
| 172 |
|
| RETVAL |
| 173 |
|
| |
| 174 |
|
| SV * |
| 175 |
|
| subject(self, ...) |
| 176 |
|
| pdfmake_doc_t *self |
| 177 |
|
| CODE: |
| 178 |
50 |
▶ | if (items > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) { |
47 |
3 |
50 |
|
| 179 |
47 |
| const char *val = SvPV_nolen(ST(1)); |
| 180 |
47 |
▶ | if (pdfmake_meta_set_subject(self, val) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_meta_set_subject(self, val) != PDFMAKE_OK) { |
0 |
47 |
47 |
|
| 181 |
0 |
| croak("PDF::Make::Document::subject: failed to set subject"); |
| 182 |
|
| } |
| 183 |
47 |
| RETVAL = ST(1); |
| 184 |
47 |
| SvREFCNT_inc(RETVAL); |
| 185 |
|
| } else { |
| 186 |
3 |
| const char *val = pdfmake_meta_get_subject(self); |
| 187 |
3 |
▶ | RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
2 |
1 |
3 |
|
| 188 |
|
| } |
| 189 |
|
| OUTPUT: |
| 190 |
|
| RETVAL |
| 191 |
|
| |
| 192 |
|
| SV * |
| 193 |
|
| keywords(self, ...) |
| 194 |
|
| pdfmake_doc_t *self |
| 195 |
|
| CODE: |
| 196 |
7 |
▶ | if (items > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) { |
4 |
3 |
7 |
|
| 197 |
4 |
| const char *val = SvPV_nolen(ST(1)); |
| 198 |
4 |
▶ | if (pdfmake_meta_set_keywords(self, val) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_meta_set_keywords(self, val) != PDFMAKE_OK) { |
0 |
4 |
4 |
|
| 199 |
0 |
| croak("PDF::Make::Document::keywords: failed to set keywords"); |
| 200 |
|
| } |
| 201 |
4 |
| RETVAL = ST(1); |
| 202 |
4 |
| SvREFCNT_inc(RETVAL); |
| 203 |
|
| } else { |
| 204 |
3 |
| const char *val = pdfmake_meta_get_keywords(self); |
| 205 |
3 |
▶ | RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
2 |
1 |
3 |
|
| 206 |
|
| } |
| 207 |
|
| OUTPUT: |
| 208 |
|
| RETVAL |
| 209 |
|
| |
| 210 |
|
| SV * |
| 211 |
|
| creator(self, ...) |
| 212 |
|
| pdfmake_doc_t *self |
| 213 |
|
| CODE: |
| 214 |
6 |
▶ | if (items > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) { |
3 |
3 |
6 |
|
| 215 |
3 |
| const char *val = SvPV_nolen(ST(1)); |
| 216 |
3 |
▶ | if (pdfmake_meta_set_creator(self, val) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_meta_set_creator(self, val) != PDFMAKE_OK) { |
0 |
3 |
3 |
|
| 217 |
0 |
| croak("PDF::Make::Document::creator: failed to set creator"); |
| 218 |
|
| } |
| 219 |
3 |
| RETVAL = ST(1); |
| 220 |
3 |
| SvREFCNT_inc(RETVAL); |
| 221 |
|
| } else { |
| 222 |
3 |
| const char *val = pdfmake_meta_get_creator(self); |
| 223 |
3 |
▶ | RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
2 |
1 |
3 |
|
| 224 |
|
| } |
| 225 |
|
| OUTPUT: |
| 226 |
|
| RETVAL |
| 227 |
|
| |
| 228 |
|
| SV * |
| 229 |
|
| producer(self, ...) |
| 230 |
|
| pdfmake_doc_t *self |
| 231 |
|
| CODE: |
| 232 |
6 |
▶ | if (items > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) { |
4 |
2 |
6 |
|
| 233 |
4 |
| const char *val = SvPV_nolen(ST(1)); |
| 234 |
4 |
▶ | if (pdfmake_meta_set_producer(self, val) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_meta_set_producer(self, val) != PDFMAKE_OK) { |
0 |
4 |
4 |
|
| 235 |
0 |
| croak("PDF::Make::Document::producer: failed to set producer"); |
| 236 |
|
| } |
| 237 |
4 |
| RETVAL = ST(1); |
| 238 |
4 |
| SvREFCNT_inc(RETVAL); |
| 239 |
|
| } else { |
| 240 |
2 |
| const char *val = pdfmake_meta_get_producer(self); |
| 241 |
2 |
▶ | RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
2 |
0 |
2 |
|
| 242 |
|
| } |
| 243 |
|
| OUTPUT: |
| 244 |
|
| RETVAL |
| 245 |
|
| |
| 246 |
|
| SV * |
| 247 |
|
| get_meta(self, key) |
| 248 |
|
| pdfmake_doc_t *self |
| 249 |
|
| const char *key |
| 250 |
|
| CODE: |
| 251 |
3 |
| const char *val = pdfmake_meta_get(self, key); |
| 252 |
3 |
▶ | RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = val ? newSVpv(val, 0) : &PL_sv_undef; |
3 |
0 |
3 |
|
| 253 |
|
| OUTPUT: |
| 254 |
|
| RETVAL |
| 255 |
|
| |
| 256 |
|
| void |
| 257 |
|
| set_meta(self, key, value) |
| 258 |
|
| pdfmake_doc_t *self |
| 259 |
|
| const char *key |
| 260 |
|
| const char *value |
| 261 |
|
| CODE: |
| 262 |
3 |
▶ | if (pdfmake_meta_set(self, key, value) != PDFMAKE_OK) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_meta_set(self, key, value) != PDFMAKE_OK) { |
0 |
3 |
3 |
|
| 263 |
0 |
| croak("PDF::Make::Document::set_meta: failed to set %s", key); |
| 264 |
|
| } |
| 265 |
|
| |
| 266 |
|
| pdfmake_page_t * |
| 267 |
|
| add_page(self, ...) |
| 268 |
|
| pdfmake_doc_t *self |
| 269 |
|
| PREINIT: |
| 270 |
768 |
| double width = PDFMAKE_PAGE_LETTER_WIDTH; |
| 271 |
768 |
| double height = PDFMAKE_PAGE_LETTER_HEIGHT; |
| 272 |
|
| CODE: |
| 273 |
768 |
▶ | if (items > 1) width = SvNV(ST(1)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) width = SvNV(ST(1)); |
742 |
26 |
768 |
|
| 274 |
768 |
▶ | if (items > 2) height = SvNV(ST(2)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 2) height = SvNV(ST(2)); |
742 |
26 |
768 |
|
| 275 |
768 |
| RETVAL = pdfmake_doc_add_page(self, width, height); |
| 276 |
768 |
▶ | if (!RETVAL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!RETVAL) |
0 |
768 |
768 |
|
| 277 |
0 |
| croak("PDF::Make::Document::add_page: failed to add page"); |
| 278 |
|
| OUTPUT: |
| 279 |
|
| RETVAL |
| 280 |
|
| |
| 281 |
|
| UV |
| 282 |
|
| page_count(self) |
| 283 |
|
| pdfmake_doc_t *self |
| 284 |
|
| CODE: |
| 285 |
97 |
| RETVAL = pdfmake_doc_page_count(self); |
| 286 |
|
| OUTPUT: |
| 287 |
|
| RETVAL |
| 288 |
|
| |
| 289 |
|
| pdfmake_page_t * |
| 290 |
|
| get_page(self, idx) |
| 291 |
|
| pdfmake_doc_t *self |
| 292 |
|
| UV idx |
| 293 |
|
| CODE: |
| 294 |
57 |
| RETVAL = pdfmake_doc_get_page(self, (size_t)idx); |
| 295 |
57 |
▶ | if (!RETVAL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!RETVAL) |
1 |
56 |
57 |
|
| 296 |
1 |
| croak("PDF::Make::Document::get_page: invalid page index %u", (unsigned)idx); |
| 297 |
|
| OUTPUT: |
| 298 |
|
| RETVAL |
| 299 |
|
| |
| 300 |
|
| void |
| 301 |
|
| insert_page(self, idx, page) |
| 302 |
|
| pdfmake_doc_t *self |
| 303 |
|
| UV idx |
| 304 |
|
| pdfmake_page_t *page |
| 305 |
|
| CODE: |
| 306 |
0 |
| pdfmake_err_t err = pdfmake_doc_insert_page(self, (size_t)idx, page); |
| 307 |
0 |
▶ | if (err != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (err != PDFMAKE_OK) |
0 |
0 |
0 |
|
| 308 |
0 |
| croak("PDF::Make::Document::insert_page: failed to insert page"); |
| 309 |
|
| |
| 310 |
|
| void |
| 311 |
|
| remove_page(self, idx) |
| 312 |
|
| pdfmake_doc_t *self |
| 313 |
|
| UV idx |
| 314 |
|
| CODE: |
| 315 |
3 |
| pdfmake_err_t err = pdfmake_doc_remove_page(self, (size_t)idx); |
| 316 |
3 |
▶ | if (err != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (err != PDFMAKE_OK) |
1 |
2 |
3 |
|
| 317 |
1 |
| croak("PDF::Make::Document::remove_page: failed to remove page %u", (unsigned)idx); |
| 318 |
|
| |
| 319 |
|
| void |
| 320 |
|
| move_page(self, from_idx, to_idx) |
| 321 |
|
| pdfmake_doc_t *self |
| 322 |
|
| UV from_idx |
| 323 |
|
| UV to_idx |
| 324 |
|
| CODE: |
| 325 |
2 |
| pdfmake_err_t err = pdfmake_doc_move_page(self, (size_t)from_idx, (size_t)to_idx); |
| 326 |
2 |
▶ | if (err != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (err != PDFMAKE_OK) |
1 |
1 |
2 |
|
| 327 |
1 |
| croak("PDF::Make::Document::move_page: failed to move page %u to %u", (unsigned)from_idx, (unsigned)to_idx); |
| 328 |
|
| |
| 329 |
|
| void |
| 330 |
|
| rotate_page(self, idx, degrees) |
| 331 |
|
| pdfmake_doc_t *self |
| 332 |
|
| UV idx |
| 333 |
|
| IV degrees |
| 334 |
|
| CODE: |
| 335 |
|
| pdfmake_rotation_t rot; |
| 336 |
5 |
| switch (degrees) { |
| 337 |
0 |
| case 0: rot = PDFMAKE_ROTATE_0; break; |
| 338 |
2 |
| case 90: rot = PDFMAKE_ROTATE_90; break; |
| 339 |
1 |
| case 180: rot = PDFMAKE_ROTATE_180; break; |
| 340 |
1 |
| case 270: rot = PDFMAKE_ROTATE_270; break; |
| 341 |
0 |
| case -90: rot = PDFMAKE_ROTATE_270; break; |
| 342 |
1 |
| default: |
| 343 |
1 |
| croak("PDF::Make::Document::rotate_page: invalid rotation %d (use 0, 90, 180, 270)", (int)degrees); |
| 344 |
|
| } |
| 345 |
4 |
| pdfmake_err_t err = pdfmake_doc_rotate_page(self, (size_t)idx, rot); |
| 346 |
4 |
▶ | if (err != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (err != PDFMAKE_OK) |
0 |
4 |
4 |
|
| 347 |
0 |
| croak("PDF::Make::Document::rotate_page: failed to rotate page %u", (unsigned)idx); |
| 348 |
|
| |
| 349 |
|
| void |
| 350 |
|
| duplicate_page(self, idx) |
| 351 |
|
| pdfmake_doc_t *self |
| 352 |
|
| UV idx |
| 353 |
|
| CODE: |
| 354 |
3 |
| pdfmake_err_t err = pdfmake_doc_duplicate_page(self, (size_t)idx); |
| 355 |
3 |
▶ | if (err != PDFMAKE_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if (err != PDFMAKE_OK) |
1 |
2 |
3 |
|
| 356 |
1 |
| croak("PDF::Make::Document::duplicate_page: failed to duplicate page %u", (unsigned)idx); |
| 357 |
|
| |
| 358 |
|
| UV |
| 359 |
|
| add_text_annot(self, x1, y1, x2, y2, contents, ...) |
| 360 |
|
| pdfmake_doc_t *self |
| 361 |
|
| double x1 |
| 362 |
|
| double y1 |
| 363 |
|
| double x2 |
| 364 |
|
| double y2 |
| 365 |
|
| const char *contents |
| 366 |
|
| PREINIT: |
| 367 |
8 |
| pdfmake_annot_icon_t icon = PDFMAKE_ANNOT_ICON_NOTE; |
| 368 |
8 |
▶ | int open = 0; |
Branch: 1 branch
| Branch | True | False | Total |
| int open = 0; |
8 |
0 |
8 |
|
| 369 |
|
| CODE: |
| 370 |
8 |
▶ | if (items > 6) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 6) { |
7 |
1 |
8 |
|
| 371 |
7 |
| const char *icon_str = SvPV_nolen(ST(6)); |
| 372 |
7 |
▶ | if (strEQ(icon_str, "Comment")) icon = PDFMAKE_ANNOT_ICON_COMMENT; |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(icon_str, "Comment")) icon = PDFMAKE_ANNOT_ICON_COMMENT; |
3 |
4 |
7 |
|
| 373 |
4 |
▶ | else if (strEQ(icon_str, "Key")) icon = PDFMAKE_ANNOT_ICON_KEY; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(icon_str, "Key")) icon = PDFMAKE_ANNOT_ICON_KEY; |
1 |
3 |
4 |
|
| 374 |
3 |
▶ | else if (strEQ(icon_str, "Help")) icon = PDFMAKE_ANNOT_ICON_HELP; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(icon_str, "Help")) icon = PDFMAKE_ANNOT_ICON_HELP; |
0 |
3 |
3 |
|
| 375 |
3 |
▶ | else if (strEQ(icon_str, "Paragraph")) icon = PDFMAKE_ANNOT_ICON_PARAGRAPH; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(icon_str, "Paragraph")) icon = PDFMAKE_ANNOT_ICON_PARAGRAPH; |
0 |
3 |
3 |
|
| 376 |
3 |
▶ | else if (strEQ(icon_str, "NewParagraph")) icon = PDFMAKE_ANNOT_ICON_NEWPARAGRAPH; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(icon_str, "NewParagraph")) icon = PDFMAKE_ANNOT_ICON_NEWPARAGRAPH; |
0 |
3 |
3 |
|
| 377 |
3 |
▶ | else if (strEQ(icon_str, "Insert")) icon = PDFMAKE_ANNOT_ICON_INSERT; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(icon_str, "Insert")) icon = PDFMAKE_ANNOT_ICON_INSERT; |
0 |
3 |
3 |
|
| 378 |
|
| } |
| 379 |
8 |
▶ | if (items > 7) open = SvIV(ST(7)); |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 7) open = SvIV(ST(7)); |
7 |
1 |
8 |
|
| 380 |
|
| |
| 381 |
8 |
| pdfmake_rect_t rect = {x1, y1, x2, y2}; |
| 382 |
8 |
| RETVAL = pdfmake_annot_text(self, rect, contents, icon, open); |
| 383 |
8 |
▶ | if (RETVAL == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL == 0) |
0 |
8 |
8 |
|
| 384 |
0 |
| croak("PDF::Make::Document::add_text_annot: failed to create annotation"); |
| 385 |
|
| OUTPUT: |
| 386 |
|
| RETVAL |
| 387 |
|
| |
| 388 |
|
| UV |
| 389 |
|
| add_link_uri(self, x1, y1, x2, y2, uri) |
| 390 |
|
| pdfmake_doc_t *self |
| 391 |
|
| double x1 |
| 392 |
|
| double y1 |
| 393 |
|
| double x2 |
| 394 |
|
| double y2 |
| 395 |
|
| const char *uri |
| 396 |
|
| CODE: |
| 397 |
5 |
| pdfmake_rect_t rect = {x1, y1, x2, y2}; |
| 398 |
5 |
| RETVAL = pdfmake_annot_link_uri(self, rect, uri); |
| 399 |
5 |
▶ | if (RETVAL == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL == 0) |
0 |
5 |
5 |
|
| 400 |
0 |
| croak("PDF::Make::Document::add_link_uri: failed to create annotation"); |
| 401 |
|
| OUTPUT: |
| 402 |
|
| RETVAL |
| 403 |
|
| |
| 404 |
|
| UV |
| 405 |
|
| add_link_goto(self, x1, y1, x2, y2, dest_page) |
| 406 |
|
| pdfmake_doc_t *self |
| 407 |
|
| double x1 |
| 408 |
|
| double y1 |
| 409 |
|
| double x2 |
| 410 |
|
| double y2 |
| 411 |
|
| UV dest_page |
| 412 |
|
| CODE: |
| 413 |
15 |
| pdfmake_rect_t rect = {x1, y1, x2, y2}; |
| 414 |
15 |
| RETVAL = pdfmake_annot_link_goto(self, rect, (size_t)dest_page); |
| 415 |
15 |
▶ | if (RETVAL == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL == 0) |
0 |
15 |
15 |
|
| 416 |
0 |
| croak("PDF::Make::Document::add_link_goto: failed to create annotation"); |
| 417 |
|
| OUTPUT: |
| 418 |
|
| RETVAL |
| 419 |
|
| |
| 420 |
|
| UV |
| 421 |
|
| add_stamp(self, x1, y1, x2, y2, stamp_type) |
| 422 |
|
| pdfmake_doc_t *self |
| 423 |
|
| double x1 |
| 424 |
|
| double y1 |
| 425 |
|
| double x2 |
| 426 |
|
| double y2 |
| 427 |
|
| const char *stamp_type |
| 428 |
|
| PREINIT: |
| 429 |
5 |
▶ | pdfmake_stamp_type_t type = PDFMAKE_STAMP_DRAFT; |
Branch: 1 branch
| Branch | True | False | Total |
| pdfmake_stamp_type_t type = PDFMAKE_STAMP_DRAFT; |
5 |
0 |
5 |
|
| 430 |
|
| CODE: |
| 431 |
5 |
▶ | if (strEQ(stamp_type, "Approved")) type = PDFMAKE_STAMP_APPROVED; |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(stamp_type, "Approved")) type = PDFMAKE_STAMP_APPROVED; |
1 |
4 |
5 |
|
| 432 |
4 |
▶ | else if (strEQ(stamp_type, "Experimental")) type = PDFMAKE_STAMP_EXPERIMENTAL; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "Experimental")) type = PDFMAKE_STAMP_EXPERIMENTAL; |
0 |
4 |
4 |
|
| 433 |
4 |
▶ | else if (strEQ(stamp_type, "NotApproved")) type = PDFMAKE_STAMP_NOTAPPROVED; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "NotApproved")) type = PDFMAKE_STAMP_NOTAPPROVED; |
0 |
4 |
4 |
|
| 434 |
4 |
▶ | else if (strEQ(stamp_type, "AsIs")) type = PDFMAKE_STAMP_ASIS; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "AsIs")) type = PDFMAKE_STAMP_ASIS; |
0 |
4 |
4 |
|
| 435 |
4 |
▶ | else if (strEQ(stamp_type, "Expired")) type = PDFMAKE_STAMP_EXPIRED; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "Expired")) type = PDFMAKE_STAMP_EXPIRED; |
0 |
4 |
4 |
|
| 436 |
4 |
▶ | else if (strEQ(stamp_type, "NotForPublicRelease")) type = PDFMAKE_STAMP_NOTFORPUBLICRELEASE; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "NotForPublicRelease")) type = PDFMAKE_STAMP_NOTFORPUBLICRELEASE; |
0 |
4 |
4 |
|
| 437 |
4 |
▶ | else if (strEQ(stamp_type, "Confidential")) type = PDFMAKE_STAMP_CONFIDENTIAL; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "Confidential")) type = PDFMAKE_STAMP_CONFIDENTIAL; |
2 |
2 |
4 |
|
| 438 |
2 |
▶ | else if (strEQ(stamp_type, "Final")) type = PDFMAKE_STAMP_FINAL; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "Final")) type = PDFMAKE_STAMP_FINAL; |
0 |
2 |
2 |
|
| 439 |
2 |
▶ | else if (strEQ(stamp_type, "Sold")) type = PDFMAKE_STAMP_SOLD; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "Sold")) type = PDFMAKE_STAMP_SOLD; |
0 |
2 |
2 |
|
| 440 |
2 |
▶ | else if (strEQ(stamp_type, "Departmental")) type = PDFMAKE_STAMP_DEPARTMENTAL; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "Departmental")) type = PDFMAKE_STAMP_DEPARTMENTAL; |
0 |
2 |
2 |
|
| 441 |
2 |
▶ | else if (strEQ(stamp_type, "ForLegalReview")) type = PDFMAKE_STAMP_FORLEGALREVIEW; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "ForLegalReview")) type = PDFMAKE_STAMP_FORLEGALREVIEW; |
0 |
2 |
2 |
|
| 442 |
2 |
▶ | else if (strEQ(stamp_type, "TopSecret")) type = PDFMAKE_STAMP_TOPSECRET; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "TopSecret")) type = PDFMAKE_STAMP_TOPSECRET; |
0 |
2 |
2 |
|
| 443 |
2 |
▶ | else if (strEQ(stamp_type, "ForComment")) type = PDFMAKE_STAMP_FORCOMMENT; |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(stamp_type, "ForComment")) type = PDFMAKE_STAMP_FORCOMMENT; |
0 |
2 |
2 |
|
| 444 |
|
| /* Default is Draft */ |
| 445 |
|
| |
| 446 |
5 |
| pdfmake_rect_t rect = {x1, y1, x2, y2}; |
| 447 |
5 |
| RETVAL = pdfmake_annot_stamp(self, rect, type); |
| 448 |
5 |
▶ | if (RETVAL == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL == 0) |
0 |
5 |
5 |
|
| 449 |
0 |
| croak("PDF::Make::Document::add_stamp: failed to create annotation"); |
| 450 |
|
| OUTPUT: |
| 451 |
|
| RETVAL |
| 452 |
|
| |
| 453 |
|
| ############################################################################## |
| 454 |
|
| # Outline (Bookmarks) API |
| 455 |
|
| ############################################################################## |
| 456 |
|
| |
| 457 |
|
| SV * |
| 458 |
|
| add_outline(self, title, page_index, dest_type = "Fit", left = 0, top = 0, zoom = 0) |
| 459 |
|
| pdfmake_doc_t *self |
| 460 |
|
| const char *title |
| 461 |
|
| UV page_index |
| 462 |
|
| const char *dest_type |
| 463 |
|
| double left |
| 464 |
|
| double top |
| 465 |
|
| double zoom |
| 466 |
|
| PREINIT: |
| 467 |
|
| pdfmake_dest_t dest; |
| 468 |
|
| pdfmake_outline_item_t *item; |
| 469 |
|
| SV *sv; |
| 470 |
|
| CODE: |
| 471 |
|
| /* Build destination based on type */ |
| 472 |
18 |
▶ | if (strEQ(dest_type, "XYZ")) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(dest_type, "XYZ")) { |
1 |
17 |
18 |
|
| 473 |
1 |
| dest = pdfmake_dest_xyz((size_t)page_index, left, top, zoom); |
| 474 |
|
| } |
| 475 |
17 |
▶ | else if (strEQ(dest_type, "Fit")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "Fit")) { |
16 |
1 |
17 |
|
| 476 |
16 |
| dest = pdfmake_dest_fit((size_t)page_index); |
| 477 |
|
| } |
| 478 |
1 |
▶ | else if (strEQ(dest_type, "FitH")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitH")) { |
1 |
0 |
1 |
|
| 479 |
1 |
| dest = pdfmake_dest_fith((size_t)page_index, top); |
| 480 |
|
| } |
| 481 |
0 |
▶ | else if (strEQ(dest_type, "FitV")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitV")) { |
0 |
0 |
0 |
|
| 482 |
0 |
| dest = pdfmake_dest_fitv((size_t)page_index, left); |
| 483 |
|
| } |
| 484 |
0 |
▶ | else if (strEQ(dest_type, "FitB")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitB")) { |
0 |
0 |
0 |
|
| 485 |
0 |
| dest = pdfmake_dest_fitb((size_t)page_index); |
| 486 |
|
| } |
| 487 |
0 |
▶ | else if (strEQ(dest_type, "FitBH")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitBH")) { |
0 |
0 |
0 |
|
| 488 |
0 |
| dest = pdfmake_dest_fitbh((size_t)page_index, top); |
| 489 |
|
| } |
| 490 |
0 |
▶ | else if (strEQ(dest_type, "FitBV")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitBV")) { |
0 |
0 |
0 |
|
| 491 |
0 |
| dest = pdfmake_dest_fitbv((size_t)page_index, left); |
| 492 |
|
| } |
| 493 |
|
| else { |
| 494 |
0 |
| dest = pdfmake_dest_fit((size_t)page_index); |
| 495 |
|
| } |
| 496 |
|
| |
| 497 |
|
| /* Top-level bookmarks are CHILDREN of an untitled root container |
| 498 |
|
| * (the serializer already knows a title-less root is the /Outlines |
| 499 |
|
| * dict, not a visible entry). Routing every doc-level add through |
| 500 |
|
| * add_outline_root made the first bookmark the root and silently |
| 501 |
|
| * swallowed every one after it - two bookmarks in, one out. */ |
| 502 |
|
| { |
| 503 |
18 |
| pdfmake_outline_item_t *root = pdfmake_doc_get_outline(self); |
| 504 |
18 |
▶ | if (!root) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!root) |
15 |
3 |
18 |
|
| 505 |
15 |
| root = pdfmake_doc_add_outline_root(self, NULL, dest); |
| 506 |
18 |
▶ | if (!root) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!root) |
0 |
18 |
18 |
|
| 507 |
0 |
| croak("PDF::Make::Document::add_outline: failed to create outline root"); |
| 508 |
18 |
| item = pdfmake_outline_add_child(root, title, dest); |
| 509 |
18 |
▶ | if (!item) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!item) |
0 |
18 |
18 |
|
| 510 |
0 |
| croak("PDF::Make::Document::add_outline: failed to add outline item"); |
| 511 |
|
| } |
| 512 |
|
| |
| 513 |
18 |
| sv = newSV(0); |
| 514 |
18 |
| sv_setref_pv(sv, "PDF::Make::Outline", (void *)item); |
| 515 |
18 |
| RETVAL = sv; |
| 516 |
|
| OUTPUT: |
| 517 |
|
| RETVAL |
| 518 |
|
| |
| 519 |
|
| ############################################################################## |
| 520 |
|
| # Action API |
| 521 |
|
| ############################################################################## |
| 522 |
|
| |
| 523 |
|
| pdfmake_action_t * |
| 524 |
|
| action_goto(self, page_index, dest_type = "Fit", left = 0, top = 0, zoom = 0) |
| 525 |
|
| pdfmake_doc_t *self |
| 526 |
|
| UV page_index |
| 527 |
|
| const char *dest_type |
| 528 |
|
| double left |
| 529 |
|
| double top |
| 530 |
|
| double zoom |
| 531 |
|
| PREINIT: |
| 532 |
|
| pdfmake_dest_t dest; |
| 533 |
|
| CODE: |
| 534 |
|
| /* Build destination based on type */ |
| 535 |
6 |
▶ | if (strEQ(dest_type, "XYZ")) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(dest_type, "XYZ")) { |
1 |
5 |
6 |
|
| 536 |
1 |
| dest = pdfmake_dest_xyz((size_t)page_index, left, top, zoom); |
| 537 |
|
| } |
| 538 |
5 |
▶ | else if (strEQ(dest_type, "Fit")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "Fit")) { |
3 |
2 |
5 |
|
| 539 |
3 |
| dest = pdfmake_dest_fit((size_t)page_index); |
| 540 |
|
| } |
| 541 |
2 |
▶ | else if (strEQ(dest_type, "FitH")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitH")) { |
1 |
1 |
2 |
|
| 542 |
1 |
| dest = pdfmake_dest_fith((size_t)page_index, top); |
| 543 |
|
| } |
| 544 |
1 |
▶ | else if (strEQ(dest_type, "FitV")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitV")) { |
1 |
0 |
1 |
|
| 545 |
1 |
| dest = pdfmake_dest_fitv((size_t)page_index, left); |
| 546 |
|
| } |
| 547 |
0 |
▶ | else if (strEQ(dest_type, "FitB")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitB")) { |
0 |
0 |
0 |
|
| 548 |
0 |
| dest = pdfmake_dest_fitb((size_t)page_index); |
| 549 |
|
| } |
| 550 |
0 |
▶ | else if (strEQ(dest_type, "FitBH")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitBH")) { |
0 |
0 |
0 |
|
| 551 |
0 |
| dest = pdfmake_dest_fitbh((size_t)page_index, top); |
| 552 |
|
| } |
| 553 |
0 |
▶ | else if (strEQ(dest_type, "FitBV")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitBV")) { |
0 |
0 |
0 |
|
| 554 |
0 |
| dest = pdfmake_dest_fitbv((size_t)page_index, left); |
| 555 |
|
| } |
| 556 |
|
| else { |
| 557 |
0 |
| dest = pdfmake_dest_fit((size_t)page_index); |
| 558 |
|
| } |
| 559 |
|
| |
| 560 |
6 |
| RETVAL = pdfmake_action_goto(self, dest); |
| 561 |
6 |
▶ | if (!RETVAL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!RETVAL) |
0 |
6 |
6 |
|
| 562 |
0 |
| croak("PDF::Make::Document::action_goto: failed to create action"); |
| 563 |
|
| OUTPUT: |
| 564 |
|
| RETVAL |
| 565 |
|
| |
| 566 |
|
| pdfmake_action_t * |
| 567 |
|
| action_uri(self, uri) |
| 568 |
|
| pdfmake_doc_t *self |
| 569 |
|
| const char *uri |
| 570 |
|
| CODE: |
| 571 |
5 |
| RETVAL = pdfmake_action_uri(self, uri); |
| 572 |
5 |
▶ | if (!RETVAL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!RETVAL) |
0 |
5 |
5 |
|
| 573 |
0 |
| croak("PDF::Make::Document::action_uri: failed to create action"); |
| 574 |
|
| OUTPUT: |
| 575 |
|
| RETVAL |
| 576 |
|
| |
| 577 |
|
| pdfmake_action_t * |
| 578 |
|
| action_named(self, name) |
| 579 |
|
| pdfmake_doc_t *self |
| 580 |
|
| const char *name |
| 581 |
|
| CODE: |
| 582 |
5 |
| RETVAL = pdfmake_action_named_str(self, name); |
| 583 |
5 |
▶ | if (!RETVAL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!RETVAL) |
0 |
5 |
5 |
|
| 584 |
0 |
| croak("PDF::Make::Document::action_named: unknown named action '%s'", name); |
| 585 |
|
| OUTPUT: |
| 586 |
|
| RETVAL |
| 587 |
|
| |
| 588 |
|
| pdfmake_action_t * |
| 589 |
|
| action_javascript(self, script) |
| 590 |
|
| pdfmake_doc_t *self |
| 591 |
|
| const char *script |
| 592 |
|
| CODE: |
| 593 |
2 |
| RETVAL = pdfmake_action_javascript(self, script); |
| 594 |
2 |
▶ | if (!RETVAL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!RETVAL) |
0 |
2 |
2 |
|
| 595 |
0 |
| croak("PDF::Make::Document::action_javascript: failed to create action"); |
| 596 |
|
| OUTPUT: |
| 597 |
|
| RETVAL |
| 598 |
|
| |
| 599 |
|
| pdfmake_action_t * |
| 600 |
|
| action_gotor(self, file, page_index, new_window = 0) |
| 601 |
|
| pdfmake_doc_t *self |
| 602 |
|
| const char *file |
| 603 |
|
| UV page_index |
| 604 |
|
| int new_window |
| 605 |
|
| PREINIT: |
| 606 |
|
| pdfmake_dest_t dest; |
| 607 |
|
| CODE: |
| 608 |
5 |
| dest = pdfmake_dest_fit((size_t)page_index); |
| 609 |
5 |
| RETVAL = pdfmake_action_gotor(self, file, dest, new_window); |
| 610 |
5 |
▶ | if (!RETVAL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!RETVAL) |
0 |
5 |
5 |
|
| 611 |
0 |
| croak("PDF::Make::Document::action_gotor: failed to create action"); |
| 612 |
|
| OUTPUT: |
| 613 |
|
| RETVAL |
| 614 |
|
| |
| 615 |
|
| UV |
| 616 |
|
| add_link_with_action(self, x1, y1, x2, y2, action, highlight = "Invert") |
| 617 |
|
| pdfmake_doc_t *self |
| 618 |
|
| double x1 |
| 619 |
|
| double y1 |
| 620 |
|
| double x2 |
| 621 |
|
| double y2 |
| 622 |
|
| pdfmake_action_t *action |
| 623 |
|
| const char *highlight |
| 624 |
|
| PREINIT: |
| 625 |
|
| pdfmake_rect_t rect; |
| 626 |
|
| pdfmake_highlight_mode_t hl; |
| 627 |
|
| CODE: |
| 628 |
9 |
| rect.x1 = x1; |
| 629 |
9 |
| rect.y1 = y1; |
| 630 |
9 |
| rect.x2 = x2; |
| 631 |
9 |
| rect.y2 = y2; |
| 632 |
|
| |
| 633 |
9 |
▶ | if (strEQ(highlight, "None")) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(highlight, "None")) { |
1 |
8 |
9 |
|
| 634 |
1 |
| hl = PDFMAKE_HIGHLIGHT_NONE; |
| 635 |
|
| } |
| 636 |
8 |
▶ | else if (strEQ(highlight, "Outline")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(highlight, "Outline")) { |
1 |
7 |
8 |
|
| 637 |
1 |
| hl = PDFMAKE_HIGHLIGHT_OUTLINE; |
| 638 |
|
| } |
| 639 |
7 |
▶ | else if (strEQ(highlight, "Push")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(highlight, "Push")) { |
1 |
6 |
7 |
|
| 640 |
1 |
| hl = PDFMAKE_HIGHLIGHT_PUSH; |
| 641 |
|
| } |
| 642 |
|
| else { |
| 643 |
6 |
| hl = PDFMAKE_HIGHLIGHT_INVERT; /* Default */ |
| 644 |
|
| } |
| 645 |
|
| |
| 646 |
9 |
| RETVAL = pdfmake_annot_link_action(self, rect, action, hl); |
| 647 |
9 |
▶ | if (RETVAL == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL == 0) |
0 |
9 |
9 |
|
| 648 |
0 |
| croak("PDF::Make::Document::add_link_with_action: failed to create link"); |
| 649 |
|
| OUTPUT: |
| 650 |
|
| RETVAL |
| 651 |
|
| |
| 652 |
|
| UV |
| 653 |
|
| add_link_named_action(self, x1, y1, x2, y2, name, highlight = "Invert") |
| 654 |
|
| pdfmake_doc_t *self |
| 655 |
|
| double x1 |
| 656 |
|
| double y1 |
| 657 |
|
| double x2 |
| 658 |
|
| double y2 |
| 659 |
|
| const char *name |
| 660 |
|
| const char *highlight |
| 661 |
|
| PREINIT: |
| 662 |
|
| pdfmake_rect_t rect; |
| 663 |
|
| pdfmake_highlight_mode_t hl; |
| 664 |
|
| CODE: |
| 665 |
6 |
| rect.x1 = x1; |
| 666 |
6 |
| rect.y1 = y1; |
| 667 |
6 |
| rect.x2 = x2; |
| 668 |
6 |
| rect.y2 = y2; |
| 669 |
|
| |
| 670 |
6 |
▶ | if (strEQ(highlight, "None")) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(highlight, "None")) { |
0 |
6 |
6 |
|
| 671 |
0 |
| hl = PDFMAKE_HIGHLIGHT_NONE; |
| 672 |
|
| } |
| 673 |
6 |
▶ | else if (strEQ(highlight, "Outline")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(highlight, "Outline")) { |
0 |
6 |
6 |
|
| 674 |
0 |
| hl = PDFMAKE_HIGHLIGHT_OUTLINE; |
| 675 |
|
| } |
| 676 |
6 |
▶ | else if (strEQ(highlight, "Push")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(highlight, "Push")) { |
0 |
6 |
6 |
|
| 677 |
0 |
| hl = PDFMAKE_HIGHLIGHT_PUSH; |
| 678 |
|
| } |
| 679 |
|
| else { |
| 680 |
6 |
| hl = PDFMAKE_HIGHLIGHT_INVERT; |
| 681 |
|
| } |
| 682 |
|
| |
| 683 |
6 |
| RETVAL = pdfmake_annot_link_named(self, rect, name, hl); |
| 684 |
6 |
▶ | if (RETVAL == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL == 0) |
0 |
6 |
6 |
|
| 685 |
0 |
| croak("PDF::Make::Document::add_link_named_action: unknown named action '%s'", name); |
| 686 |
|
| OUTPUT: |
| 687 |
|
| RETVAL |
| 688 |
|
| |
| 689 |
|
| void |
| 690 |
|
| DESTROY(self) |
| 691 |
|
| pdfmake_doc_t *self |
| 692 |
|
| CODE: |
| 693 |
802 |
| pdfmake_doc_free(self); |
| 694 |
|
| |
| 695 |
|
| BOOT: |
| 696 |
|
| { |
| 697 |
104 |
| HV *stash = gv_stashpv("PDF::Make::Document", GV_ADD); |
| 698 |
104 |
▶ | PDFMAKE_REGISTER_META(stash, "title", pdfmake_meta_get_title, pdfmake_meta_set_title); |
Branch: 2 branches
| Branch | True | False | Total |
| PDFMAKE_REGISTER_META(stash, "title", pdfmake_meta_get_title, pdfmake_meta_set_title); |
104 |
0 |
104 |
| PDFMAKE_REGISTER_META(stash, "title", pdfmake_meta_get_title, pdfmake_meta_set_title); |
104 |
0 |
104 |
|
| 699 |
104 |
▶ | PDFMAKE_REGISTER_META(stash, "author", pdfmake_meta_get_author, pdfmake_meta_set_author); |
Branch: 2 branches
| Branch | True | False | Total |
| PDFMAKE_REGISTER_META(stash, "author", pdfmake_meta_get_author, pdfmake_meta_set_author); |
104 |
0 |
104 |
| PDFMAKE_REGISTER_META(stash, "author", pdfmake_meta_get_author, pdfmake_meta_set_author); |
104 |
0 |
104 |
|
| 700 |
104 |
▶ | PDFMAKE_REGISTER_META(stash, "subject", pdfmake_meta_get_subject, pdfmake_meta_set_subject); |
Branch: 2 branches
| Branch | True | False | Total |
| PDFMAKE_REGISTER_META(stash, "subject", pdfmake_meta_get_subject, pdfmake_meta_set_subject); |
104 |
0 |
104 |
| PDFMAKE_REGISTER_META(stash, "subject", pdfmake_meta_get_subject, pdfmake_meta_set_subject); |
104 |
0 |
104 |
|
| 701 |
104 |
▶ | PDFMAKE_REGISTER_META(stash, "keywords", pdfmake_meta_get_keywords, pdfmake_meta_set_keywords); |
Branch: 2 branches
| Branch | True | False | Total |
| PDFMAKE_REGISTER_META(stash, "keywords", pdfmake_meta_get_keywords, pdfmake_meta_set_keywords); |
104 |
0 |
104 |
| PDFMAKE_REGISTER_META(stash, "keywords", pdfmake_meta_get_keywords, pdfmake_meta_set_keywords); |
104 |
0 |
104 |
|
| 702 |
104 |
▶ | PDFMAKE_REGISTER_META(stash, "creator", pdfmake_meta_get_creator, pdfmake_meta_set_creator); |
Branch: 2 branches
| Branch | True | False | Total |
| PDFMAKE_REGISTER_META(stash, "creator", pdfmake_meta_get_creator, pdfmake_meta_set_creator); |
104 |
0 |
104 |
| PDFMAKE_REGISTER_META(stash, "creator", pdfmake_meta_get_creator, pdfmake_meta_set_creator); |
104 |
0 |
104 |
|
| 703 |
104 |
▶ | PDFMAKE_REGISTER_META(stash, "producer", pdfmake_meta_get_producer, pdfmake_meta_set_producer); |
Branch: 2 branches
| Branch | True | False | Total |
| PDFMAKE_REGISTER_META(stash, "producer", pdfmake_meta_get_producer, pdfmake_meta_set_producer); |
104 |
0 |
104 |
| PDFMAKE_REGISTER_META(stash, "producer", pdfmake_meta_get_producer, pdfmake_meta_set_producer); |
104 |
0 |
104 |
|
| 704 |
|
| } |