From 04c890e5e051ac2d0ccc0d862b4b8020b90c1665 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 31 Dec 2017 18:11:49 +0000 Subject: set the pdf title if available --- content/handlers/pdf/pdf.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'content') diff --git a/content/handlers/pdf/pdf.c b/content/handlers/pdf/pdf.c index 657a5e978..288aa5892 100644 --- a/content/handlers/pdf/pdf.c +++ b/content/handlers/pdf/pdf.c @@ -28,6 +28,7 @@ #include #include +#include #include "utils/utils.h" #include "content/llcache.h" @@ -117,6 +118,7 @@ static bool pdf_convert(struct content *c) nspdferror pdfres; const uint8_t *content_data; unsigned long content_length; + struct lwc_string_s *title; content_data = (const uint8_t *)content__get_source_data(c, &content_length); @@ -129,8 +131,14 @@ static bool pdf_convert(struct content *c) return false; } + pdfres = nspdf_get_title(pdfc->doc, &title); + if (pdfres == NSPDFERROR_OK) { + content__set_title(c, lwc_string_data(title)); + } + content_set_ready(c); content_set_done(c); + return true; } -- cgit v1.2.3