summaryrefslogtreecommitdiff
path: root/content/handlers/pdf/pdf.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-12-31 18:11:49 +0000
committerVincent Sanders <vince@kyllikki.org>2020-12-11 16:17:27 +0000
commit04c890e5e051ac2d0ccc0d862b4b8020b90c1665 (patch)
tree18e3f3cb1cab89cbeb06594fc78af6e369c05bb2 /content/handlers/pdf/pdf.c
parentb441a51b78b7ef852a4aac586ab233788204760e (diff)
downloadnetsurf-04c890e5e051ac2d0ccc0d862b4b8020b90c1665.tar.gz
netsurf-04c890e5e051ac2d0ccc0d862b4b8020b90c1665.tar.bz2
set the pdf title if available
Diffstat (limited to 'content/handlers/pdf/pdf.c')
-rw-r--r--content/handlers/pdf/pdf.c8
1 files changed, 8 insertions, 0 deletions
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 <stdlib.h>
#include <nspdf/document.h>
+#include <nspdf/meta.h>
#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;
}