diff --git a/Source/HtmlRenderer.PdfSharp/Adapters/GraphicsAdapter.cs b/Source/HtmlRenderer.PdfSharp/Adapters/GraphicsAdapter.cs index 9af8a9790..4321af851 100644 --- a/Source/HtmlRenderer.PdfSharp/Adapters/GraphicsAdapter.cs +++ b/Source/HtmlRenderer.PdfSharp/Adapters/GraphicsAdapter.cs @@ -68,15 +68,23 @@ public GraphicsAdapter(XGraphics g, bool releaseGraphics = false) public override void PopClip() { - _clipStack.Pop(); - _g.Restore(); + RRect rect = _clipStack.Pop(); + if( !rect.IsEmpty ) + { + _g.Restore(); + } + } public override void PushClip(RRect rect) { - _clipStack.Push(rect); - _g.Save(); - _g.IntersectClip(Utils.Convert(rect)); + _clipStack.Push( rect ); + if( !rect.IsEmpty ) + { + _g.Save(); + _g.IntersectClip( Utils.Convert( rect ) ); + } + } public override void PushClipExclude(RRect rect)