... | ... |
@@ -1482,6 +1482,9 @@ void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
1482 | 1482 |
unsigned i, filters=0; |
1483 | 1483 |
unsigned blockopens=0; |
1484 | 1484 |
enum objstate objstate = STATE_NONE; |
1485 |
+#if HAVE_JSON |
|
1486 |
+ json_object *pdfobj=NULL, *jsonobj=NULL; |
|
1487 |
+#endif |
|
1485 | 1488 |
|
1486 | 1489 |
if (objsize < 0) |
1487 | 1490 |
return; |
... | ... |
@@ -1496,6 +1499,20 @@ void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
1496 | 1496 |
|
1497 | 1497 |
if (!nextobj || bytesleft < 0) { |
1498 | 1498 |
cli_dbgmsg("cli_pdf: %u %u obj: no dictionary\n", obj->id>>8, obj->id&0xff); |
1499 |
+#if HAVE_JSON |
|
1500 |
+ if (!(pdfobj) && pdf->ctx->wrkproperty != NULL) { |
|
1501 |
+ pdfobj = cli_jsonobj(pdf->ctx->wrkproperty, "PDFStats"); |
|
1502 |
+ if (!(pdfobj)) |
|
1503 |
+ return; |
|
1504 |
+ } |
|
1505 |
+ |
|
1506 |
+ if (pdfobj) { |
|
1507 |
+ if (!(jsonobj)) |
|
1508 |
+ jsonobj = cli_jsonarray(pdfobj, "ObjectsWithoutDictionaries"); |
|
1509 |
+ if (jsonobj) |
|
1510 |
+ cli_jsonint_array(jsonobj, obj->id>>8); |
|
1511 |
+ } |
|
1512 |
+#endif |
|
1499 | 1513 |
return; |
1500 | 1514 |
} |
1501 | 1515 |
|
... | ... |
@@ -1513,6 +1530,20 @@ void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
1513 | 1513 |
/* find end of dictionary block */ |
1514 | 1514 |
if (bytesleft < 0) { |
1515 | 1515 |
cli_dbgmsg("cli_pdf: %u %u obj: broken dictionary\n", obj->id>>8, obj->id&0xff); |
1516 |
+#if HAVE_JSON |
|
1517 |
+ if (!(pdfobj) && pdf->ctx->wrkproperty != NULL) { |
|
1518 |
+ pdfobj = cli_jsonobj(pdf->ctx->wrkproperty, "PDFStats"); |
|
1519 |
+ if (!(pdfobj)) |
|
1520 |
+ return; |
|
1521 |
+ } |
|
1522 |
+ |
|
1523 |
+ if (pdfobj) { |
|
1524 |
+ if (!(jsonobj)) |
|
1525 |
+ jsonobj = cli_jsonarray(pdfobj, "ObjectsWithBrokenDictionaries"); |
|
1526 |
+ if (jsonobj) |
|
1527 |
+ cli_jsonint_array(jsonobj, obj->id>>8); |
|
1528 |
+ } |
|
1529 |
+#endif |
|
1516 | 1530 |
return; |
1517 | 1531 |
} |
1518 | 1532 |
|
... | ... |
@@ -1551,6 +1582,20 @@ void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
1551 | 1551 |
if (blockopens) { |
1552 | 1552 |
/* probably truncated */ |
1553 | 1553 |
cli_dbgmsg("cli_pdf: %u %u obj broken dictionary\n", obj->id>>8, obj->id&0xff); |
1554 |
+#if HAVE_JSON |
|
1555 |
+ if (!(pdfobj) && pdf->ctx->wrkproperty != NULL) { |
|
1556 |
+ pdfobj = cli_jsonobj(pdf->ctx->wrkproperty, "PDFStats"); |
|
1557 |
+ if (!(pdfobj)) |
|
1558 |
+ return; |
|
1559 |
+ } |
|
1560 |
+ |
|
1561 |
+ if (pdfobj) { |
|
1562 |
+ if (!(jsonobj)) |
|
1563 |
+ jsonobj = cli_jsonarray(pdfobj, "ObjectsWithBrokenDictionaries"); |
|
1564 |
+ if (jsonobj) |
|
1565 |
+ cli_jsonint_array(jsonobj, obj->id>>8); |
|
1566 |
+ } |
|
1567 |
+#endif |
|
1554 | 1568 |
return; |
1555 | 1569 |
} |
1556 | 1570 |
|