gpt4 book ai didi

pdf - 如何以编程方式生成在图像顶部带有标签的维恩图图像?

转载 作者:行者123 更新时间:2023-12-01 11:04:26 25 4
gpt4 key购买 nike

我正在尝试为 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com