diff options
author | Wesley Moret <wesmoret98@gmail.com> | 2021-07-14 21:48:09 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-16 20:44:10 +0200 |
commit | 1b8f73b6b3afd8d78172fcd30b95db67f259f58a (patch) | |
tree | ea54523cdbfd16106fcdc71babf5105880a51f87 /Userland/Libraries/LibPDF/Parser.h | |
parent | 5d4d70355e15bd7d3e608d72fb36f4538bcdaac0 (diff) | |
download | serenity-1b8f73b6b3afd8d78172fcd30b95db67f259f58a.zip |
LibPDF: Fix treating not finding the linearized dict as a fatal error
We now try to parse the first indirect value and see
if it's the `Linearization Parameter Dictionary`. if it's not, we
fallback to reading the xref table from the end of the document
Diffstat (limited to 'Userland/Libraries/LibPDF/Parser.h')
-rw-r--r-- | Userland/Libraries/LibPDF/Parser.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Libraries/LibPDF/Parser.h b/Userland/Libraries/LibPDF/Parser.h index 6dbe3b2f5f..2dba1a0515 100644 --- a/Userland/Libraries/LibPDF/Parser.h +++ b/Userland/Libraries/LibPDF/Parser.h @@ -18,6 +18,12 @@ class Document; class Parser final : public RefCounted<Parser> { public: + enum class LinearizationResult { + Error, + NotLinearized, + Linearized, + }; + static Vector<Command> parse_graphics_commands(ReadonlyBytes const&); Parser(Badge<Document>, ReadonlyBytes const&); @@ -83,7 +89,7 @@ private: explicit Parser(ReadonlyBytes const&); bool parse_header(); - bool initialize_linearization_dict(); + LinearizationResult initialize_linearization_dict(); bool initialize_linearized_xref_table(); bool initialize_non_linearized_xref_table(); bool initialize_hint_tables(); |