如何/使用哪种格式创建具有精确几何/布局的多页可打印文档?

huangapple go评论58阅读模式
英文:

How/which format to create multi-page printable documents with precise geometry/layout?

问题

我想自动生成具有非常特定信息和非常特定布局的日历页面,并且最好将所有页面放在单个文档中(可以是PDF,不一定要是)。对于方框的布局、文本的放置等,我希望能够精确控制几何形状,以便在每一页上都保持相同并且可重现。

我可以创建具有精确尺寸的SVG,但我不确定如何将其转化为打印文档的部分。使用LaTeX,我很可能可以生成我想要的内容,但不确定我是否能够对所有元素的尺寸有足够精确的控制。
从头开始创建Postscript或甚至PDF似乎有点令人望而生畏。

我知道可能有多种解决方案,但我愿意探索几种选项,看看哪种最适合我的经验。

英文:

I would like to automatically generate calendar pages with very specific information and a very specific layout and ideally have all pages in a single document (can be PDF, doesn't have to be). For they layout of the boxes, text placement etc. I would like to be able to control the geometry very precisely so it's the same on every page and reproducible.

I could create SVG with exact dimensions, but I'm not sure about the part where I actually turn it into a document for printing.
With LaTeX I can most likely generate what I would like to have, but am unsure whether I have precise enough control over the dimensions of all my elements.
Creating Postscript or even a PDF "from scratch" seems a little too intimidating.

I know there may be more than one solution to this, but I'm happy to explore several options and see what works best with my experience.

答案1

得分: 1

以下是翻译好的部分:

如果您有多个具有相同尺寸的图像,比如

image1.eps image2.eps ... imageN.eps

您可以编写一个简单的PostScript 脚本将它们组合在一起。类似于

0 0 moveto
(image1.eps) run
0 100 moveto
(image2.eps) run
0 200 moveto
(image3.eps) run
...
500 700 moveto
(imageN.eps) run
showpage

要在Ghostscript中运行此脚本,您需要在命令行中添加-dNOSAFER以启用run操作符。此脚本还假定完全符合EPS文件的规范,不会执行任何像调用showpage之类的奇怪操作。

还有一些命令行工具,如psnup(通常打包在其他工具中,如您获取GhostScript的地方的psutils中),可以从单独的页面生成简单的平铺布局。

对于生成日历页面的特定示例,我碰巧有一些可以执行此操作的PostScript程序gridcal.ps创建一个整洁的格式,其中所有月份并排在列中,周六和周日的日期以不同的阴影显示。cal3.ps可以生成更常见的格式,列出了星期几的日期。

英文:

I can give some kind of answer for the PostScript ecosystem, much less for latex or svg.

If you have multiple images with identical dimensions, say

image1.eps image2.eps ... imageN.eps

you can write a simple PostScript script to tie them together. Something like

0 0 moveto
(image1.eps) run
0 100 moveto
(image2.eps) run
0 200 moveto
(image3.eps) run
...
500 700 moveto
(imageN.eps) run
showpage

To run this script with Ghostscript you'll need to add -dNOSAFER to the command line in order to enable the run operator. This script also assume fully compliant EPS files that don't do any funny stuff like calling showpage themselves.

There are also command line tools like psnup (usually packaged with other tools as psutils from whereever you got GhostScript) which can produce simple tiled layouts from separate pages.

For the specific example of generating calendar pages, I happen to have a few postscript programs which do this. gridcal.ps creates a neat format where all the months are side by side in columns and the weeks are shown by shading Saturday and Sunday. cal3.ps can generate more normal formats with the days of the week for the columns.

答案2

得分: 0

我选择自动创建SVG,使用毫米作为尺寸单位并将视口设置为相同大小,这样我可以以我想要的方式非常简单地创建几何图形。然后,我使用命令行上的Inkscape将它们转换为PDF。我还没有尝试将所有页面合并成一个文档。

英文:

I went with automatically creating SVGs, using dimensions in millimeters and the viewport in the same size, so I could create my geometry very simple in exactly the way I want. I converted them to PDF using Inkscape on the command line. I haven't tried actually merging all pages into one document yet.

huangapple
  • 本文由 发表于 2023年2月6日 03:06:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75354796.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定