slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
32.82k stars 1.33k forks source link

Pdf rendering don't render linear gradient but png export works #1602

Open yodatak opened 4 months ago

yodatak commented 4 months ago

Describe the bug When i export my pdf i don't have the same ouput as the web output, gradient are broken

To Reproduce

1.Create a new slide with

---
# try also 'default' to start simple
theme: academic
# random image from a curated Unsplash collection by Anthony
# like them? see https://unsplash.com/collections/94734566/slidev
background: https://cover.sli.dev
# some information about your slides, markdown enabled
title: Linux
info: |
  ## XXXXX

# author field for exported PDF
author: XXXXXXX

# https://sli.dev/custom/highlighters.html
highlighter: shiki

monaco: true
# Where to load monaco types from, can be 'cdn', 'local' or 'none'
monacoTypesSource: local

# https://sli.dev/guide/drawing
drawings:
  persist: false
# slide transition: https://sli.dev/guide/animations#slide-transitions
transition: slide-left
# enable MDC Syntax: https://sli.dev/guide/syntax#mdc-syntax
mdc: true

fonts:
  sans: Roboto
  serif: Roboto Slab
  mono: Fira Code

addons:
  - slidev-addon-asciinema
  - prettier-plugin-slidev
---

# XXXXX

---
transition: fade-out
---

# Prérequis

- XXXXXXXXXXX [TXX](XXXXXXXXXXX)
- X `XXX`
- XXX ! 🎉

---
layout: image-left
image: ./homepage-overview-diagram-new.svg
backgroundSize: contain
---

# Openstack

XXX **XXXXX** sXXXX

XXX **XXX** <ic-baseline-wind-power /> XXXXXXXXXXXXXXXT <mdi-counter />

---

<style>
 h1 {
  background-color: #2B90B6;
  background-image: linear-gradient(45deg, #4EC5D4 10%, #146b8c 20%);
  background-size: 100%;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-text-fill-color: transparent;
}

</style>

# My title

XXXX

<http://XXX/>

<twemoji-warning /> XXX :/

- XX: `XX`

- XXX
  1. pnpm run export --dark

Desktop (please complete the following information):

The bad pdf rendering here slides_copy-export.pdf image

The good web rendering image

The png export is good

003

KermanX commented 4 months ago

Noticed this. I think the reason may be the PDF viewer doesn't support background-clip.

mocdaniel commented 3 months ago

I can confirm this behavior, in my case, linear gradient backgrounds are broken for both PNG and PDF exports.