- Add decode_page_content_streams() function for per-page lazy decode - Update extract_page_from_dict() to support lazy stream decoding - Modify extract_pdf() and extract_pdf_ndjson() to enable lazy decoding - Fix borrow checker issue in LazyPageIter::next() This ensures content streams are decoded lazily per page and dropped immediately after processing, keeping peak RSS flat across page count. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
33 lines
937 B
C
33 lines
937 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "../include/pdftract.h"
|
|
|
|
int main() {
|
|
const char *test_pdfs[] = {
|
|
"/home/coding/pdftract/tests/fixtures/test-minimal.pdf",
|
|
"valid_test.pdf",
|
|
NULL
|
|
};
|
|
|
|
for (int i = 0; test_pdfs[i] != NULL; i++) {
|
|
printf("Testing %s...\n", test_pdfs[i]);
|
|
char *result = pdftract_hash(test_pdfs[i]);
|
|
if (result == NULL) {
|
|
printf(" -> NULL\n");
|
|
const char *err = pdftract_last_error();
|
|
if (err) printf(" Error: %s\n", err);
|
|
} else {
|
|
printf(" -> %s\n", result);
|
|
if (strstr(result, "\"error\"") == NULL) {
|
|
printf(" SUCCESS: Got valid fingerprint\n");
|
|
pdftract_free(result);
|
|
return 0;
|
|
}
|
|
pdftract_free(result);
|
|
}
|
|
}
|
|
|
|
printf("All test PDFs failed\n");
|
|
return 1;
|
|
}
|