作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为 pdf 报告生成维恩图,文本位于不同区域的顶部。
我们使用 htmldoc 生成 pdf,这排除了背景图像之上的文本。
我们将 google charts api 用于其他图像,但他们的维恩图不支持图表顶部的文本(据我所知)。
最简单的方法是使用第三方库在我们的服务器上生成维恩图像,然后将图像链接到文档中,我只是不知道有什么软件包可以支持我们的用例.
任何链接/指针将不胜感激。
最佳答案
这是一些示例代码。这似乎是一个不错的教程:
http://paulbourke.net/dataformats/postscript/
如果你在 Linux 上,你可以使用 gv
命令来查看它。也有各种实用程序可以将其转换为 PDF; Linux 上的 ps2pdf,Windows 上的 Acrobat Distiller。
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 144 144
% CenterText - paint text centered on x with baseline on y
% x y s CenterText
/CenterText
{
<< >> begin
/s exch def /y exch def /x exch def
newpath x s stringwidth pop 2 div sub y moveto s show
end
} bind def
2 setlinewidth
54 72 36 0 360 arc stroke
90 72 36 0 360 arc stroke
/Helvetica 10 selectfont
36 72 (A) CenterText
108 72 (B) CenterText
72 72 (A^B) CenterText
这是三圈的。它有效,但我不保证编码的质量,我已经很多年没有写过任何严肃的 PS 代码了。
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 216 216
% CenterText - paint text centered on x with baseline on y
% x y s CenterText
/CenterText
{
<< >> begin
/s exch def /y exch def /x exch def
newpath x s stringwidth pop 2 div sub y moveto s show
end
} bind def
% Set center of bounding box at 0,0 and rotate 90 degrees cw
108 108 translate
gsave
180 rotate
% Draw 3 circles at 120-degree intervals
/ct 3 def
/offset 36 def
/radius 60 def
0 1 ct 1 sub % for
{
gsave
360 mul ct div rotate
0 offset translate
0 0 radius 0 360 arc stroke
grestore
} for
grestore
/Helvetica 10 selectfont
-54 36 (A) CenterText
54 36 (B) CenterText
0 -72 (C) CenterText
0 36 (A^B) CenterText
-36 -24 (A^C) CenterText
36 -24 (B^C) CenterText
0 -6 (A^B^C) CenterText
关于pdf - 如何以编程方式生成在图像顶部带有标签的维恩图图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7478666/
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 6年前关闭。 Improve thi
正在 Canvas 中创建维恩图。我试图为每个交叉点和每个圆圈使用不同的颜色。虽然我可以用重叠的圆圈来做到这一点,但我需要让每个交叉点成为它自己的部分,这样我就可以为每个交叉点操纵颜色,因为我将在悬停
我是一名优秀的程序员,十分优秀!