2013-12-09 21 views
0

我已經嘗試了至少2天來控制PDF文件的有效性圖標的大小,當簽名時。如何控制PDF中的有效性圖標的大小

該圖標通常由pdf閱讀器設置。

我已經嘗試不同的方法的問題:

  1. Redimensioned簽名標註矩形 - 它重塑中
  2. 所有內容Redimensioned簽名註釋外觀BBOX - 這也 重塑文字和圖標內容。
  3. 我還試圖重塑n2和N0層,並創建了一個新 N5,期待能夠控制它沒有成功

最終大小,我只是想單獨調整有效性圖標。

任何建議應深表讚賞。

dsblank = Annotation::AppearanceStream.new.setFilter(:FlateDecode) 
dsblank.Type=Name.new("XObject") 
dsblank.Resources = Resources.new 
dsblank.BBox = [ 0, 0, width, height ] 
dsblank.draw_stream('% DSBlank') 


n2 = Annotation::AppearanceStream.new.setFilter(:FlateDecode) 
n2.Resources = Resources.new 
n2.BBox = [ 0, 0, width, height ] 
n2.draw_stream('% DSBlank') 

n5 = Annotation::AppearanceStream.new.setFilter(:FlateDecode) 
n5.Resources = Resources.new 
n5.BBox = [ 0, 0, width, height ] 
n5.write(caption,x: padding_x, y: padding_y, size: text_size, leading: text_size) 

sigannot = Annotation::Widget::Signature.new 
sigannot.Rect = Rectangle[ llx: x, lly: y, urx: x+width, ury: y+height ] 
sigannot.F = Annotation::Flags::PRINT #sets the print mode on 

# 
# Creates the stream for the signature appearance 
# 
streamN = Annotation::AppearanceStream.new.setFilter(:FlateDecode) 
streamN.BBox = [ 0, 0,width, height] 
streamN.Resources = Resources.new 
streamN.Resources.add_xobject(Name.new("n0"), dsblank) 
streamN.Resources.add_xobject(Name.new("n1"), dsblank) 
streamN.Resources.add_xobject(Name.new("n2"), n2) 
streamN.Resources.add_xobject(Name.new("n3"), dsblank) 
streamN.Resources.add_xobject(Name.new("n5"), n5) 
streamN.draw_stream('q 1 0 0 1 0 0 cm /n0 Do Q') 
streamN.draw_stream('q 1 0 0 1 0 0 cm /n1 Do Q') 
streamN.draw_stream('q 1 0 0 1 0 0 cm /n2 Do Q') 
streamN.draw_stream('q 1 0 0 1 0 0 cm /n3 Do Q') 
streamN.draw_stream('q 1 0 0 1 0 0 cm /n5 Do Q') 

sigannot.set_normal_appearance(streamN) 

page.add_annot(sigannot) 

回答

0

經過一番迭代後,我設法爲streamN和n2以及padding_y獲得了比例因子3。我還補充說要增加text_size。

隨着我設法減少圖標的大小,仍然有清晰的文字。

n2 = Annotation::AppearanceStream.new 
n2.Resources = Resources.new 
n2.BBox = [ 0, 0, width*3, height*3 ] 
n2.write(caption,x: padding_x, y: padding_y*3, size: text_size, leading: text_size) 

sigannot = Annotation::Widget::Signature.new 
sigannot.Rect = Rectangle[ llx: x, lly: y, urx: x+width, ury: y+height ] 
sigannot.F = Annotation::Flags::PRINT #sets the print mode on 

# 
# Creates the stream for the signature appearance 
# 
streamN = Annotation::AppearanceStream.new.setFilter(:FlateDecode) 
streamN.BBox = [ 0, 0, width*3, height*3 ] 
1

這不是展示如何解決它但更多的評論辯稱這是一個壞主意,試圖它在所有的答案。雖然這對於評論領域來說太大了。

您正試圖製作PDF以支持Adobe Reader功能,Adobe已經開始逐步停用Adobe Reader 9!

Individual signature status icons removed from signature fields

(頁面Adobe Acrobat 9 Digital Signatures, Changes and Improvements 10)

因此,即使你實現你的目標,現用現安裝Adobe Reader,它可以很容易地發生,在即將到來的新此功能的Adobe Reader版本支持將完全停止。

此外,您不會在當前PDF規範ISO 32000-1中找到任何提及此功能(更改簽名外觀)的提示,更不用說即將推出的ISO 32000-2。

而且維護的圖層支持,除了N0N2已經停止在Acrobat 6。0:

Standard AP dictionary and layers

(第8頁的Adobe® Acrobat® SDK Digital Signature Appearances, Edition 1.0, October 2006

相關問題