mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
LibPDF: Ignore unknown page drawing operators
Lets us successfully render page 2 of BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf This is a separate commit from the previous one as it's technically not strictly spec compliant.
This commit is contained in:
1 parent
b58497421f
commit
b3090a36c8
1 file changed
+7
-2
@@ -597,8 +597,13 @@ PDFErrorOr<Vector<Operator>> Parser::parse_operators()
|
||||
m_reader.consume_whitespace();
|
||||
|
||||
auto maybe_operator_type = Operator::operator_type_from_symbol(operator_string);
|
||||
if (!maybe_operator_type.has_value())
|
||||
return error(ByteString::formatted("unsupported operator {}", operator_string));
|
||||
if (!maybe_operator_type.has_value()) {
|
||||
// Quirk: Some PDFs contain invalid operators. Per spec, they should only be ignored in BX/EX blocks,
|
||||
// but we ignore them everywhere. All other engines seem to do that too, so some files depend on it.
|
||||
// (Usually accidentally, e.g. containing "QQ" instead of "Q Q" or similar.)
|
||||
dbgln("ignoring unknown operator \"{}\"", operator_string);
|
||||
continue;
|
||||
}
|
||||
auto operator_type = maybe_operator_type.release_value();
|
||||
|
||||
if (operator_type == OperatorType::InlineImageBegin) {
|
||||
|
||||
Reference in new issue
Block a user