2014-07-04 62 views
0

我使用僅適用於Mozilla Firefox的Web應用程序。操作網頁以包含水印

一個特定的任務生成一個頁面來打印要郵寄的信件。

打印完信後,我的同事應該爲郵局的品牌加蓋郵票,並手工寫出郵件的發送日期。

有沒有什麼辦法可以在打印之前操縱頁面的顯示以在HTML中包含一個帶有圖章圖像的行?

任何想法?

非常感謝。

+1

的AutoHotkey不會是實現這一目標的一個非常有效的方式,考慮做一個自定義的Greasemonkey腳本。 –

+0

不能修改「生成頁面以打印一封信」的任務,因此它包含您需要的內容?我假設你的公司控制着這個「任務」。 – Nelson

回答

2

是否有任何理由需要通過autohotkey完成?如果您有權訪問代碼,則可以添加覆蓋圖章圖像的打印樣式表。

SmashingMagazine有a fantastic guide to print stylesheets

從本質上講,所有你需要做的就是添加到您現有的樣式表:

@media print { 
    //css to add the stamp image overlay here 
} 
0

感謝您的反饋意見。

我想通了。

這是我的代碼:

#NoEnv 
#Persistent 
#SingleInstance force 
SendMode Input 
SetWorkingDir %A_ScriptDir% 

Gui, Add, Button, gCorreios, Correios 
Gui, Show 
Return 

Correios: 
Sleep 100 
Send, {ALT DOWN}{ESC}{ALT UP} 
Send, {CTRLDOWN}f{CTRLUP} 
Sleep 10 
Send, Postado{ESC} 
Sleep 10 
Send, {SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}c{CTRLUP} 
ClipWait 
Sleep 10 
DataDaPostagem=%Clipboard% 
ClipBoard = 
Sleep 10 
StringReplace, DataDaPostagem, DataDaPostagem, postado,, All 
StringReplace, DataDaPostagem, DataDaPostagem, em,, All 
StringReplace, DataDaPostagem, DataDaPostagem, :,, All 
StringReplace, DataDaPostagem, DataDaPostagem, `,,, All 
StringReplace, DataDaPostagem, DataDaPostagem, %A_SPACE%,, All 
Sleep 10 
Send, {SHIFT DOWN}{F4}{SHIFT UP} 
WinWait, Scratchpad, 
IfWinNotActive, Scratchpad, , WinActivate, Scratchpad, 
WinWaitActive, Scratchpad, 
Send, {CTRLDOWN}a{CTRLUP}{DEL} 
Send, var correios=document.createElement("div");{ENTER} 
Send, correios.id="correios";{ENTER} 
Send, correios.style="background:url(http://i62.tinypic.com/169hxls.png) no-repeat; display:block; height:37px; padding:135px 0 0 0; position:absolute; right:0; text-align:center; top:0; width:171px; z-index:-1";{ENTER} 
Send, correios.innerHTML=" 
Send, %DataDaPostagem% 
Send, ";{ENTER} 
Send, document.getElementsByTagName("body")[0].appendChild(correios);{ENTER} 
Send, {CTRLDOWN}r{CTRLUP} 
Sleep 10 
Send, {CTRLDOWN}w{CTRLUP} 
WinWait, Alterações não salvas, 
IfWinNotActive, Alterações não salvas, , WinActivate, Alterações não salvas, 
WinWaitActive, Alterações não salvas, 
Send, d 
Sleep 10 
return 

~^s:: 
IfWinActive, %A_ScriptName% 
{ 
SplashTextOn,,,Updated script, 
Sleep, 200 
SplashTextOff 
Reload 
} 
return