简体   繁体   English

如何在Linux中生成文本和图像的pdf文件?

[英]How to generate pdf file of text and image in linux?

I am generating a logfile on one of my servers. 我在其中一台服务器上生成了一个日志文件。 Storing alot of data, then sending it to my mail once a month as a pdf file. 存储大量数据,然后每月将其作为pdf文件发送到我的邮件中一次。

The prosess i am using is to 'cat' alot of commands to a text file, then convert it and send. 我正在使用的程序是将大量命令“捕捉”到文本文件,然后将其转换并发送。

Is there any linux programs or some eazy way to do something simulare and add a image i have stored on the server in the pdf file? 是否有任何Linux程序或某种轻松的方式来做一些类似的事情,并在pdf文件中添加我存储在服务器上的图像?

This answer assumes that you just want to put the image at the end of the PDF. 该答案假设您只想将图像放在PDF的末尾。

You could first convert the image using imagemagick to a PDF doing this (will also work with different file types): 首先,您可以使用imagemagick将图像转换为PDF(也适用于其他文件类型):

convert image.jpg image.pdf

Then, you can use a tool like stapler or pdftk to combine your generated text PDF and the image.pdf (you can add multiple images): 然后,您可以使用staplerpdftk类的工具来组合生成的文本PDF和image.pdf (您可以添加多个图像):

  • stapler cat text.pdf image.pdf combined.pdf
  • pdftk text.pdf image.pdf output combined.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM