3513
if (pdf->stats.author)
3514
cli_jsonstr(pdfobj, "Author", pdf->stats.author);
3515
if (pdf->stats.creator)
3516
cli_jsonstr(pdfobj, "Creator", pdf->stats.creator);
3517
if (pdf->stats.producer)
3518
cli_jsonstr(pdfobj, "Producer", pdf->stats.producer);
3519
if (pdf->stats.modificationdate)
3520
cli_jsonstr(pdfobj, "ModificationDate", pdf->stats.modificationdate);
3521
if (pdf->stats.creationdate)
3522
cli_jsonstr(pdfobj, "CreationDate", pdf->stats.creationdate);
3523
if (pdf->stats.title)
3524
cli_jsonstr(pdfobj, "Title", pdf->stats.title);
3525
if (pdf->stats.subject)
3526
cli_jsonstr(pdfobj, "Subject", pdf->stats.subject);
3527
if (pdf->stats.keywords)
3528
cli_jsonstr(pdfobj, "Keywords", pdf->stats.keywords);
3547
if (pdf->stats.author) {
3548
if (!pdf->stats.author->meta.success) {
3549
char *out = pdf_finalize_string(pdf, pdf->stats.author->meta.obj, pdf->stats.author->data, pdf->stats.author->meta.length);
3551
free(pdf->stats.author->data);
3552
pdf->stats.author->data = out;
3553
pdf->stats.author->meta.length = strlen(out);
3554
pdf->stats.author->meta.success = 1;
3558
if (pdf->stats.author->meta.success && cli_isutf8(pdf->stats.author->data, pdf->stats.author->meta.length)) {
3559
cli_jsonstr(pdfobj, "Author", pdf->stats.author->data);
3560
} else if (pdf->stats.author->data && pdf->stats.author->meta.length) {
3561
char *b64 = cl_base64_encode(pdf->stats.author->data, pdf->stats.author->meta.length);
3562
cli_jsonstr(pdfobj, "Author", b64);
3563
cli_jsonbool(pdfobj, "Author_base64", 1);
3566
cli_jsonstr(pdfobj, "Author", "");
3569
if (pdf->stats.creator) {
3570
if (!pdf->stats.creator->meta.success) {
3571
char *out = pdf_finalize_string(pdf, pdf->stats.creator->meta.obj, pdf->stats.creator->data, pdf->stats.creator->meta.length);
3573
free(pdf->stats.creator->data);
3574
pdf->stats.creator->data = out;
3575
pdf->stats.creator->meta.length = strlen(out);
3576
pdf->stats.creator->meta.success = 1;
3580
if (pdf->stats.creator->meta.success && cli_isutf8(pdf->stats.creator->data, pdf->stats.creator->meta.length)) {
3581
cli_jsonstr(pdfobj, "Creator", pdf->stats.creator->data);
3582
} else if (pdf->stats.creator->data && pdf->stats.creator->meta.length) {
3583
char *b64 = cl_base64_encode(pdf->stats.creator->data, pdf->stats.creator->meta.length);
3584
cli_jsonstr(pdfobj, "Creator", b64);
3585
cli_jsonbool(pdfobj, "Creator_base64", 1);
3588
cli_jsonstr(pdfobj, "Creator", "");
3591
if (pdf->stats.producer) {
3592
if (!pdf->stats.producer->meta.success) {
3593
char *out = pdf_finalize_string(pdf, pdf->stats.producer->meta.obj, pdf->stats.producer->data, pdf->stats.producer->meta.length);
3595
free(pdf->stats.producer->data);
3596
pdf->stats.producer->data = out;
3597
pdf->stats.producer->meta.length = strlen(out);
3598
pdf->stats.producer->meta.success = 1;
3602
if (pdf->stats.producer->meta.success && cli_isutf8(pdf->stats.producer->data, pdf->stats.producer->meta.length)) {
3603
cli_jsonstr(pdfobj, "Producer", pdf->stats.producer->data);
3604
} else if (pdf->stats.producer->data && pdf->stats.producer->meta.length) {
3605
char *b64 = cl_base64_encode(pdf->stats.producer->data, pdf->stats.producer->meta.length);
3606
cli_jsonstr(pdfobj, "Producer", b64);
3607
cli_jsonbool(pdfobj, "Producer_base64", 1);
3610
cli_jsonstr(pdfobj, "Producer", "");
3613
if (pdf->stats.modificationdate) {
3614
if (!pdf->stats.modificationdate->meta.success) {
3615
char *out = pdf_finalize_string(pdf, pdf->stats.modificationdate->meta.obj, pdf->stats.modificationdate->data, pdf->stats.modificationdate->meta.length);
3617
free(pdf->stats.modificationdate->data);
3618
pdf->stats.modificationdate->data = out;
3619
pdf->stats.modificationdate->meta.length = strlen(out);
3620
pdf->stats.modificationdate->meta.success = 1;
3624
if (pdf->stats.modificationdate->meta.success && cli_isutf8(pdf->stats.modificationdate->data, pdf->stats.modificationdate->meta.length)) {
3625
cli_jsonstr(pdfobj, "ModificationDate", pdf->stats.modificationdate->data);
3626
} else if (pdf->stats.modificationdate->data && pdf->stats.modificationdate->meta.length) {
3627
char *b64 = cl_base64_encode(pdf->stats.modificationdate->data, pdf->stats.modificationdate->meta.length);
3628
cli_jsonstr(pdfobj, "ModificationDate", b64);
3629
cli_jsonbool(pdfobj, "ModificationDate_base64", 1);
3632
cli_jsonstr(pdfobj, "ModificationDate", "");
3635
if (pdf->stats.creationdate) {
3636
if (!pdf->stats.creationdate->meta.success) {
3637
char *out = pdf_finalize_string(pdf, pdf->stats.creationdate->meta.obj, pdf->stats.creationdate->data, pdf->stats.creationdate->meta.length);
3639
free(pdf->stats.creationdate->data);
3640
pdf->stats.creationdate->data = out;
3641
pdf->stats.creationdate->meta.length = strlen(out);
3642
pdf->stats.creationdate->meta.success = 1;
3646
if (pdf->stats.creationdate->meta.success && cli_isutf8(pdf->stats.creationdate->data, pdf->stats.creationdate->meta.length)) {
3647
cli_jsonstr(pdfobj, "CreationDate", pdf->stats.creationdate->data);
3648
} else if (pdf->stats.creationdate->data && pdf->stats.creationdate->meta.length) {
3649
char *b64 = cl_base64_encode(pdf->stats.creationdate->data, pdf->stats.creationdate->meta.length);
3650
cli_jsonstr(pdfobj, "CreationDate", b64);
3651
cli_jsonbool(pdfobj, "CreationDate_base64", 1);
3654
cli_jsonstr(pdfobj, "CreationDate", "");
3657
if (pdf->stats.title) {
3658
if (!pdf->stats.title->meta.success) {
3659
char *out = pdf_finalize_string(pdf, pdf->stats.title->meta.obj, pdf->stats.title->data, pdf->stats.title->meta.length);
3661
free(pdf->stats.title->data);
3662
pdf->stats.title->data = out;
3663
pdf->stats.title->meta.length = strlen(out);
3664
pdf->stats.title->meta.success = 1;
3668
if (pdf->stats.title->meta.success && cli_isutf8(pdf->stats.title->data, pdf->stats.title->meta.length)) {
3669
cli_jsonstr(pdfobj, "Title", pdf->stats.title->data);
3670
} else if (pdf->stats.title->data && pdf->stats.title->meta.length) {
3671
char *b64 = cl_base64_encode(pdf->stats.title->data, pdf->stats.title->meta.length);
3672
cli_jsonstr(pdfobj, "Title", b64);
3673
cli_jsonbool(pdfobj, "Title_base64", 1);
3676
cli_jsonstr(pdfobj, "Title", "");
3679
if (pdf->stats.subject) {
3680
if (!pdf->stats.subject->meta.success) {
3681
char *out = pdf_finalize_string(pdf, pdf->stats.subject->meta.obj, pdf->stats.subject->data, pdf->stats.subject->meta.length);
3683
free(pdf->stats.subject->data);
3684
pdf->stats.subject->data = out;
3685
pdf->stats.subject->meta.length = strlen(out);
3686
pdf->stats.subject->meta.success = 1;
3690
if (pdf->stats.subject->meta.success && cli_isutf8(pdf->stats.subject->data, pdf->stats.subject->meta.length)) {
3691
cli_jsonstr(pdfobj, "Subject", pdf->stats.subject->data);
3692
} else if (pdf->stats.subject->data && pdf->stats.subject->meta.length) {
3693
char *b64 = cl_base64_encode(pdf->stats.subject->data, pdf->stats.subject->meta.length);
3694
cli_jsonstr(pdfobj, "Subject", b64);
3695
cli_jsonbool(pdfobj, "Subject_base64", 1);
3698
cli_jsonstr(pdfobj, "Subject", "");
3701
if (pdf->stats.keywords) {
3702
if (!pdf->stats.keywords->meta.success) {
3703
char *out = pdf_finalize_string(pdf, pdf->stats.keywords->meta.obj, pdf->stats.keywords->data, pdf->stats.keywords->meta.length);
3705
free(pdf->stats.keywords->data);
3706
pdf->stats.keywords->data = out;
3707
pdf->stats.keywords->meta.length = strlen(out);
3708
pdf->stats.keywords->meta.success = 1;
3712
if (pdf->stats.keywords->meta.success && cli_isutf8(pdf->stats.keywords->data, pdf->stats.keywords->meta.length)) {
3713
cli_jsonstr(pdfobj, "Keywords", pdf->stats.keywords->data);
3714
} else if (pdf->stats.keywords->data && pdf->stats.keywords->meta.length) {
3715
char *b64 = cl_base64_encode(pdf->stats.keywords->data, pdf->stats.keywords->meta.length);
3716
cli_jsonstr(pdfobj, "Keywords", b64);
3717
cli_jsonbool(pdfobj, "Keywords_base64", 1);
3720
cli_jsonstr(pdfobj, "Keywords", "");
3529
3723
if (pdf->stats.ninvalidobjs)
3530
3724
cli_jsonint(pdfobj, "InvalidObjectCount", pdf->stats.ninvalidobjs);
3531
3725
if (pdf->stats.njs)
3606
3802
if ((pdf->stats.author)) {
3803
if (pdf->stats.author->data)
3804
free(pdf->stats.author->data);
3607
3805
free(pdf->stats.author);
3608
3806
pdf->stats.author = NULL;
3611
3809
if (pdf->stats.creator) {
3810
if (pdf->stats.creator->data)
3811
free(pdf->stats.creator->data);
3612
3812
free(pdf->stats.creator);
3613
3813
pdf->stats.creator = NULL;
3616
3816
if (pdf->stats.producer) {
3817
if (pdf->stats.producer->data)
3818
free(pdf->stats.producer->data);
3617
3819
free(pdf->stats.producer);
3618
3820
pdf->stats.producer = NULL;
3621
3823
if (pdf->stats.modificationdate) {
3824
if (pdf->stats.modificationdate->data)
3825
free(pdf->stats.modificationdate->data);
3622
3826
free(pdf->stats.modificationdate);
3623
3827
pdf->stats.modificationdate = NULL;
3626
3830
if (pdf->stats.creationdate) {
3831
if (pdf->stats.creationdate->data)
3832
free(pdf->stats.creationdate->data);
3627
3833
free(pdf->stats.creationdate);
3628
3834
pdf->stats.creationdate = NULL;
3631
3837
if (pdf->stats.title) {
3838
if (pdf->stats.title->data)
3839
free(pdf->stats.title->data);
3632
3840
free(pdf->stats.title);
3633
3841
pdf->stats.title = NULL;
3636
3844
if (pdf->stats.subject) {
3845
if (pdf->stats.subject->data)
3846
free(pdf->stats.subject->data);
3637
3847
free(pdf->stats.subject);
3638
3848
pdf->stats.subject = NULL;
3641
3851
if (pdf->stats.keywords) {
3852
if (pdf->stats.keywords->data)
3853
free(pdf->stats.keywords->data);
3642
3854
free(pdf->stats.keywords);
3643
3855
pdf->stats.keywords = NULL;