操纵网页以包含水印

时间:2014-07-04 19:45:02

标签: autohotkey

我使用的网络应用程序仅适用于Mozilla Firefox。

特定任务会生成一个页面以打印要邮寄的信件。

打印完信后,我的同事应该盖上邮局的品牌,并手工写上发送信件的发送日期。

在打印之前,有没有办法操纵页面的显示以包含带有图章图像的HTML行?

有什么想法吗?

非常感谢。

2 个答案:

答案 0 :(得分:2)

有什么理由需要通过autohotkey完成吗?如果您可以访问代码,则可以添加覆盖图章图像的打印样式表。

SmashingMagazine有a fantastic guide to print stylesheets

从本质上讲,您所要做的就是将其添加到现有样式表中:

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

答案 1 :(得分: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