Skip to content

SVG plot missing lines when rendered in Apple Preview, and Apple Safari but renders correctly in Typst Preview and Adobe Acrobat. #5509

Closed

Description

@maxall41

Description

I have an SVG line plot created with matplotlib that renders fine in the typst preview. The lone SVG file (Not in a PDF) also renders correctly in Safari, Chrome, and Firefox. But when I export a PDF containing this SVG file and try to view it with Apple Safari or Apple Preview the lines in the plot do not show up. This does not occur with Adobe Acrobat. This issue also persists when enabling PDF/A.

Reproduction:

#figure(
  image("test.svg", width: 100%),
  caption: [
    caption
  ],
) <test>

May be related to #1634. SVG and PDF attached.

Reproduce.pdf
test.svg

Edit: I almost certain this has something todo with clip paths because I was able to use Claude to convert the clip paths in the SVG into normal paths and that fixed it.

Reproduction URL

No response

Operating system

macOS

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Dec 3, 2024
  2. LaurenzV commented on Dec 3, 2024

    @LaurenzV
    Collaborator

    Probably similar to #4901 (comment).

  3. added
    pdf
    svg
    on Dec 3, 2024
  4. LaurenzV commented on Dec 3, 2024

    @LaurenzV
    Collaborator

    Would be fixed by #5420.

  5. reverendpaco commented on Mar 8, 2025

    @reverendpaco

    x.pdf
    Image

    Image

    Relevant reproduction of this issue. PDF shows properly outside of Preview but missing path from within Preview. SVG generated from D2.

    Only reason I'm piling on here is that this SVG does not use clip-paths. I understand this may be a bug with Apple.

    Using Typst 0.13.1

  6. reverendpaco commented on Mar 8, 2025

    @reverendpaco

    Update:

    I detected the exact source of the problem: the mask attribute.

    When I remove this attribute (which is on all the path elements of my SVG), the pdf now displays properly in PDFs. So, yes inasmuch as clipping and masking are related, this problem seems to share the same DNA

    Image
  7. LaurenzV commented on Mar 8, 2025

    @LaurenzV
    Collaborator

    Yep, the root cause are masks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpdfsvg

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions