将2个postscript文件合并为pdf

时间:2012-12-20 01:19:18

标签: ghostscript postscript

我要做的是将两个postscript文件合并到一个pdf中。我已经尝试过使用ghostscript来组合它们但是问题就是ghostscript会在一页上生成一个带有一个ps文件的pdf而另一个在第二页上生成一个不是我想要完成的文件

    %!PS-Adobe-3.0
%%Pages: 1
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%EndComments
%%Page: 1 1
save
6 dict begin currentpagedevice/PageSize get dup 0 get
 0 sub 0 sub/w exch
 def 1 get 0 sub 0 sub/h exch
 def/x 87 def/y 87 def 0 0/b y h mul x
 w mul gt def b{w y}{h x}ifelse div/c x h mul y w mul gt def c{w x}{h y}ifelse
 div gt{h add translate -90 rotate b{w y h x w mul y div sub 2 div 0}{h
 x 0 w y h mul x div sub 2 div}}{translate c{w x 0 h y w mul x div sub 2 div}{h
 y w x h mul y div sub 2 div 0}}ifelse ifelse translate div dup scale
end 9 dict begin
{/T currentfile/ASCII85Decode filter def/DeviceGray setcolorspace
/F T/LZWDecode filter def
<</ImageType 1/Width 87/Height 87/BitsPerComponent
1/ImageMatrix[1 0 0 -1 0 87]/Decode
[0 1]/DataSource F>> image
 F closefile T closefile}
%%BeginData:;
exec
J3Vsg3$\8+#CjR`&3*WA'+TR\@<!\`;@aOp`$+XV`%h8\!!!K[!9Aet#*;BOP%d==7jS.,hsVBYnDH
N[+5cZ=UtTfLSkWhgRG8\?,WGcN^j5#cP]3KsWRSLmE;_bp<GM2!Q!1FiRE6!+E91]DA$X`8iQFZYB
0mS8-o5Xu!f_0094V'pA:@g3R,3i_$'Yp\)8e-_&1fqhs%"+h!UL4I6R@tNA[6Bt^^UAX[:aRMSIU!
416=^MmJq2-+0!fVFnDer\kkA9UY#Q*n/l#Ih/>7,IEq;.)e7/q%Q&SL"j'""q7'ad9:Z00;\?qF/.
8a*mIt,hY3"qji0!BA*e-tRs6.F-k:_SnL*&QCrBB*lce!!;K8Fj4Hp6d?"Tg3Y4:8BLi#B-/VXSPS
#XP\B&qLYW4;Koo&C`>f_omCk&%aL+C?WTr*(:Q0YB"7Y0@*i?(aUW\?B(Z"l6;3X;8O\%8-n:/*6;
f^!W~>
%%EndData
end restore showpage
%%Trailer
%%EOF

这是第二个文件

文件很大,这里是指向它的链接http://pastebin.com/R0Kgarem

不确定如何解决这个问题。我需要彼此之间的2 ps文件,没有任何空格。

1 个答案:

答案 0 :(得分:1)

假设你指的是一个朝向页面顶部而另一个指向页面底部(一个2-up),你只需要阻止第一个文件执行showpage(通过重新定义或编辑删除单词showpage),然后在执行第二个文件之前翻译(0 -y translate,其中y是第一个图像的高度)。这假设第一张图像已经位于页面顶部,否则您需要先将其翻译到正确的位置。