mgieseki / dvisvgm

A fast DVI, EPS, and PDF to SVG converter
https://dvisvgm.de
GNU General Public License v3.0
295 stars 28 forks source link

Pattern Rendering Tikz with different viewers #228

Closed F-Phi closed 1 year ago

F-Phi commented 1 year ago

TeXworksVSFireboxPDFViewer

Left PDF Viewer in Firefox (incorrect) and Right Side TeXworks Viewer (correct) as well as Adobe Acrobat 7.0 Professional (correct)

\begin{tikzpicture}[overlay] \fill [ pattern={Lines[ distance=20mm, angle=45, line width=5mm ]}, pattern color=red ] (-0.99,1.26) rectangle (13.78,-19.71); % A5 paper (-0.99,1.26) rectangle (13.78,-19.71)

\draw[pattern={Lines[angle=45,distance={3pt/sqrt(2)}]},pattern color=orange] (-0.99,1.26) rectangle (13.78,-19.71);

\draw[pattern={Lines[angle=45,distance={10pt},line width=3pt]},pattern color=blue] (0,0) rectangle +(1,1);

\end{tikzpicture}

mgieseki commented 1 year ago

What exactly is your question? This is obviously an issue with the SVG renderer of Firefox that doesn't support all SVG features used in the generated file. There isn't much I can do here.

F-Phi commented 1 year ago

Thanks for your quick response. I think so too, you can close this item.

muzimuzhi commented 1 year ago

Left PDF Viewer in Firefox (incorrect) and Right Side TeXworks Viewer (correct) as well as Adobe Acrobat 7.0 Professional (correct)

@phisp dvisvgm generates SVG but it seems you're talking about PDF?

F-Phi commented 1 year ago

aren't this SVG embedded within PDFs? Yes im talking about PDF and i think the problem lies within the viewer

muzimuzhi commented 1 year ago

No PDF cannot embed SVG (as page content). An SVG has to be converted to another format before being inserted to PDF. And dvisvgm is (only) able to

converts DVI, EPS, and PDF files to the XML-based vector graphics format SVG. source: https://dvisvgm.de/

thus any PDF-based rendering differences, rather than SVG-based ones, are out of the scope of dvisvgm.

muzimuzhi commented 1 year ago

(already off-topic but to make things linked/connected...)

Turns out it's a pdf.js bug, see https://github.com/mozilla/pdf.js/issues/16038. pdf.js is a pdf reader in javascript and is built into version 19+ of Firefox. You can find a pgf-tikz workaround in the attachment dvisvgm-gh228.tex.zip in that issue, or in https://github.com/pgf-tikz/pgf/issues/1180.