pdf - 渲染具有多个图形的DOT脚本以PDF每页一张图形

标签 pdf graphviz dot

我有一个大型的DOT脚本,其中定义了多个图形:

digraph Tree0 {
  ...
}

digraph Tree1 {
  ...
{
...

我可以通过调用dot -Tps forest.dot -o forest.ps将其渲染到一个postscript文件中,其中每个图形都在单独的页面上。但是,出于性能原因,我宁愿使用PDF而不使用postscript(滚动和缩放更加平滑)。但是,如果我在PDF而不是PS上使用相同的命令,则生成的文件仅包含其中一个图形,并且看起来其余文件已写入stdout。

使用ps2pdf将PS转换为PDF无效,因为图形以及PS文件的页面大小各不相同,但是生成的PDF文件的页面大小却固定,从而切掉了部分图形。

是否有一种简单的方法可以从点获取多图PDF,就像它与PS文件一起使用一样?如果没有,如何将PS转换为PDF并保持不同的页面大小?

最佳答案

那呢:dot -Tps2 forest.gv -o forest.ps | ps2pdf forest.ps
主要区别在于它使用了-Tps2。根据文档:

ps2 Produces PostScript output with PDF notations. It is assumed the output will be directly converted into PDF format. The notations include PDF bounding box information, so that the resulting PDF file can be correctly used with pdf tools, such as pdflatex. In addition, if a node has a URL attribute, this gets translated into PDF code such that the node, when viewed in a PDF-viewer, e.g., acroread, is a link to the given URL. If a URL is attached to the graph, this serves as a base, such that relative URLs on nodes are derived from it.

关于pdf - 渲染具有多个图形的DOT脚本以PDF每页一张图形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27018963/

相关文章:

graphviz - 具有大(子)簇的图的隐秘点错误消息

iphone - 将 PDF 加载到 UIImage 或 UIImageView 中?

c# - 从数据库中的二进制文件写入 PDF

pdf - PostScript与PDF作为输出格式

graphviz - graphviz circo中节点之间的空间很大

python - 在Python中读取点文件

objective-c - 如何计算 PDF 文档中嵌入图像的分辨率 (DPI)?

Graphviz 节点排名=after(x)

graphviz 点流程图表标签放置且有时被截断