- 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
882 B
C
33 lines
882 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "../include/pdftract.h"
|
|
|
|
int main() {
|
|
/* Test basic API usage */
|
|
const char *version = pdftract_version();
|
|
printf("Version: %s\n", version);
|
|
|
|
/* Test hash with invalid file (should return error JSON) */
|
|
char *result = pdftract_hash("/nonexistent.pdf");
|
|
if (result) {
|
|
printf("Result: %s\n", result);
|
|
pdftract_free(result);
|
|
}
|
|
|
|
/* Test extract with invalid file */
|
|
result = pdftract_extract_text("/nonexistent.pdf", "{}");
|
|
if (result) {
|
|
printf("Result: %s\n", result);
|
|
pdftract_free(result);
|
|
}
|
|
|
|
/* Test classify with invalid file */
|
|
result = pdftract_classify("/nonexistent.pdf");
|
|
if (result) {
|
|
printf("Result: %s\n", result);
|
|
pdftract_free(result);
|
|
}
|
|
|
|
printf("All memory freed correctly\n");
|
|
return 0;
|
|
}
|