mirror of
https://github.com/simon987/libscan.git
synced 2025-04-05 04:22:58 +00:00
Fix #92
This commit is contained in:
parent
0e4906bc40
commit
baf39a8b1a
@ -135,7 +135,7 @@ int render_cover(scan_ebook_ctx_t *ctx, fz_context *fzctx, document_t *doc, fz_d
|
||||
av_image_fill_arrays(scaled_frame->data, scaled_frame->linesize, dst_buf, AV_PIX_FMT_YUV420P, pixmap->w, pixmap->h, 1);
|
||||
|
||||
const uint8_t *in_data[1] = {pixmap->samples};
|
||||
int in_line_size[1] = {3 * pixmap->w};
|
||||
int in_line_size[1] = {pixmap->stride};
|
||||
|
||||
sws_scale(sws_ctx,
|
||||
in_data, in_line_size,
|
||||
@ -328,6 +328,8 @@ void parse_ebook_mem(scan_ebook_ctx_t *ctx, void *buf, size_t buf_len, const cha
|
||||
return;
|
||||
}
|
||||
|
||||
APPEND_INT_META(doc, MetaPages, page_count)
|
||||
|
||||
if (ctx->tn_size > 0) {
|
||||
if (render_cover(ctx, fzctx, doc, fzdoc) == FALSE) {
|
||||
fz_drop_stream(fzctx, stream);
|
||||
|
@ -80,6 +80,7 @@ enum metakey {
|
||||
MetaAuthor = META_STR(24),
|
||||
MetaModifiedBy = META_STR(25),
|
||||
MetaThumbnail = META_STR(26),
|
||||
MetaPages = META_INT(27),
|
||||
};
|
||||
|
||||
typedef struct meta_line {
|
||||
|
@ -185,6 +185,7 @@ TEST(Ebook, CandlePdf) {
|
||||
ASSERT_NEAR(strlen(get_meta(&doc, MetaContent)->str_val), 500, 4);
|
||||
ASSERT_NE(get_meta(&doc, MetaContent)->str_val[0], ' ');
|
||||
ASSERT_NE(size_before, store_size);
|
||||
ASSERT_EQ(get_meta(&doc, MetaPages)->int_val, 16);
|
||||
|
||||
cleanup(&doc, &f);
|
||||
}
|
||||
@ -200,6 +201,16 @@ TEST(Ebook, Utf8Pdf) {
|
||||
cleanup(&doc, &f);
|
||||
}
|
||||
|
||||
TEST(Ebook, Pdf2) {
|
||||
vfile_t f;
|
||||
document_t doc;
|
||||
load_doc_file("libscan-test-files/test_files/ebook/pdf2.pdf", &f, &doc);
|
||||
|
||||
parse_ebook(&ebook_500_ctx, &f, "application/pdf", &doc);
|
||||
|
||||
cleanup(&doc, &f);
|
||||
}
|
||||
|
||||
TEST(Ebook, Epub1) {
|
||||
vfile_t f;
|
||||
document_t doc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user