添加.pdf文件(png格式基本上)在每个页面的结尾在另一个.pdf文件 [英] add a .pdf file(.png basically) to the end of every page in another .pdf file

查看:225
本文介绍了添加.pdf文件(png格式基本上)在每个页面的结尾在另一个.pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须转换为code.PDF,我要添加到每个页面的结尾在我的test.pdf,即收缩中的test.pdf的每一页,并添加一个code.ps文件图像它的结束。

我写了下面的shell脚本,但它检验.pdf每一页后,追加code.PDF作为一个新的一页! ......请帮助。这里是我的code: -

 #!/ bin / sh的
文件名=的test.pdf
页=`$ PDFTK名dump_data | grep的NumberOfPages |切-d:-f2`
NUMPAGES =`为((A = 1;< = $页;一个++));做回声-nA $一个B1; done`
PDFTK A = $文件名B = code.PDF猫$ NUMPAGES输出$文件名,alternated.pdf
退出0


解决方案

冲压的图像(图像的一个简单的例子。[PDF,PNG]到多页PDF(text.pdf)允许缩放和偏移的手动调整使用 pdfjam PDFTK 可以是:

#标和偏移的文本部分
pdfjam --scale 0.8 --frame真--offset0厘米2.5厘米text.pdf
#比例和偏移图像
pdfjam --paperA4纸上打印--scale 0.3 --offset7厘米-1​​2cmimage.pdf
#两者结合起来
PDFTK文本pdfjam.pdf邮票图像pdfjam.pdf输出combined.pdf

这可能看起来像

如果你开始一个图像文件(PNG,JPG),你可以将它使用ImageMagick像

要PDF

 转换image.png image.pdf

当然,比例因子和偏移量必须调整自己的需要。我包括 - 帧选项突出text.pdf部分的比例。在邮票选项覆盖图像,而背景选项将延伸到的图像。

I have a code.ps file converted to code.pdf , which I want to add to the end of every page in my test.pdf , i.e shrink the test.pdf's every page and add an image to the end of it .

I have written the following shell script to it , but it appends the code.pdf as a new page after every page of test.pdf ! ...Kindly help . Here is my code :-

#!/bin/sh
filename=test.pdf
pages="`pdftk $filename dump_data | grep NumberOfPages | cut -d : -f2`"
numpages=`for ((a=1; a <= $pages; a++)); do echo -n "A$a B1 "; done`
pdftk A=$filename B=code.pdf cat $numpages output $filename-alternated.pdf
exit 0

解决方案

A simple example of stamping an image (image.[pdf,png] onto a multipage pdf (text.pdf) allowing for manual tweaking of the scaling and offsets using pdfjam and pdftk could be:

# scale and offset the text part
pdfjam --scale 0.8 --frame True --offset '0cm 2.5cm' text.pdf
# scale and offset the image
pdfjam --paper 'a4paper' --scale 0.3 --offset '7cm -12cm' image.pdf
# combine both
pdftk text-pdfjam.pdf stamp image-pdfjam.pdf output combined.pdf

This might look like

If you start with an image file (png, jpg) you can convert it to pdf using imagemagick like

convert image.png image.pdf

Of course, the scale factors and offsets have to be adjusted to your needs. I included the --frame option to highlight the scaling of the text.pdf part. The stamp option overlays the image, whereas the background option would underlay the image.

这篇关于添加.pdf文件(png格式基本上)在每个页面的结尾在另一个.pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆