Skip to content

SVG gives syntax error: "Operator 'gs' not allowed in this current state" #2533

@drstuggels

Description

@drstuggels

Hi, I love the project!

I noticed that I get a syntax error/warning from this PDF when generated with weasyprint even though the SVG looks totally fine. Here is what the PDF looks like (I've dumbed it down).

Image

Acrobat's preflight syntax checker gives this warning.

Image

Invalid content stream state for operator (1 match on 1 page)

The PAC 2024 accessibility checker gives these errors.

Image

First error:

Error while parsing the PDF Document (Operator 'gs' not allowed in this current state. See ISO 32000-2 Figure 9 for an overview of allowed operator states.)

Second error:

Operator 'gs' not allowed in this current state. See ISO 32000-2 Figure 9 for an overview of allowed operator states.

This issue matters, because one cannot get an approved accessibility report if the PDF has syntax warnings.

Here are the files that can be used for testing (using weasyprint pdf_syntax_error.html pdf_syntax_error.pdf --pdf-variant=pdf/ua-1):
pdf_syntax_error.html

pdf_syntax_error.pdf

Thank you so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugExisting features not working as expected

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions