Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
-none-

-none-

2007-09-10       - By Brian McKeever

 Back
Yes, not really an iText question.  Why don't you pass the request object
into the PdfPageSignature constructor?

Brian

On 9/10/07, rpaquett@(protected) <rpaquett@(protected)> wrote:
>
>
> Hi Bruno and Paul,
>
> I have this code that produces an onEndPage event (i.e. putting the page
> number) on each page.  But now I need a signature block and everything,
> anyway the question is:  With this void method, how can I get a reference to
> my request?  I need to instantial words in the correct language, etc...
> maybe this a bit more of a JAva question than iText, but I just don't
> understand how the onEndPage works with only two parameters
>
> With this void method, how can I get a reference to my request?
>
> *public* *class* PdfPageSignature *extends* PdfPageEventHelper {
>
>         /**
>          * *@(protected)* com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(
> com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document)
>          */
>         *public* *void* onEndPage(PdfWriter writer, Document document) {
>
>                 MessageResources messageResources = (MessageResources)
> request.getAttribute(Globals.MESSAGES_KEY);
>                 HROnlineLocale hrOnlineLocale = *new*HROnlineLocale(request);
>                 *try* {
>                         Rectangle page = document.getPageSize();
>                         String text = "page "+ writer.getPageNumber();
>                         String employeeInitials =
> messageResources.getMessage(hrOnlineLocale.getLocaleLocale(), "
> label.employee.initials");
>                         PdfPTable footer = *new* PdfPTable(2);
>
>                         PdfPCell footerCellRight = *new* PdfPCell(*new*Phrase
(text,
> PdfUtils.getBlack(9)));
>                         footerCellRight.setBorder(0);
>                         footerCellRight.setHorizontalAlignment(2);
>
>                         PdfPCell footerCellLeft = *new* PdfPCell(*new*Phrase
(employeeInitials,
> PdfUtils.getBlack(9)));
>                         footerCellLeft.setBorder(0);
>                         footerCellLeft.setHorizontalAlignment(0);
>
>
>                         footer.addCell(footerCellLeft);
>                         footer.addCell(footerCellRight);
>                         footer.setTotalWidth(page.width() -
> document.leftMargin() - document.rightMargin());
>                         footer.writeSelectedRows(0, -1,
> document.leftMargin(), document.bottomMargin(),writer.getDirectContent());
>
>                 }
>                 *catch* (Exception e) {
>                         *throw* *new* ExceptionConverter(e);
>                 }
>         }
> }
>  -- ---- ---- ---- ---- ---- --
>  *R?mi R. Paquette*
> Developer
> Tel: (613) 748-4041
> Email: *rpaquett@(protected)* <rpaquett@(protected)>
> 700 Montreal Road, Ottawa, Ontario, K1A 0P7
> Canada Mortgage and Housing Corporation (CMHC)*
> **http://www.cmhc.ca* <http://www.cmhc.ca/> *R?mi R. Paquette*
> D?veloppeur
> T?l?phone : (613) 748-4041
> Courriel : *rpaquett@(protected)* <rpaquett@(protected)>
> 700 chemin Montr?al, Ottawa (Ontario) K1A 0P7
> Soci?t? canadienne d'hypoth?ques et de logement (SCHL)*
> **http://www.schl.ca* <http://www.schl.ca/>
>
>
>
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> __ ____ ____ ____ ____ ____ ____ ____ ____ ____
> iText-questions mailing list
> iText-questions@(protected)
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>

Yes, not really an iText question.&nbsp; Why don&#39;t you pass the request
object into the PdfPageSignature constructor?<br><br>Brian<br><br><div><span
class="gmail_quote">On 9/10/07, <b class="gmail_sendername"><a href="mailto
:rpaquett@(protected)">
rpaquett@(protected)</a></b> &lt;<a href="mailto:rpaquett@(protected)"
>rpaquett@(protected)</a>&gt; wrote:</span><blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex;
padding-left: 1ex;">

<br><font face="sans-serif" size="2">Hi Bruno and Paul,</font>
<br>
<br><font face="sans-serif" size="2">I have this code that produces an onEndPage
event (i.e. putting the page number) on each page. &nbsp;But now I need
a signature block and everything, anyway the question is: &nbsp;With this
void method, how can I get a reference to my request? &nbsp;I need to instantial
words in the correct language, etc... </font>
<br><font face="sans-serif" size="2">maybe this a bit more of a JAva question
than iText, but I just don&#39;t understand how the onEndPage works with only
two parameters</font>
<br>
<br><font face="sans-serif" size="2">With this void method, how can I get
a reference to my request? </font>
<br>
<br><font color="#820040" face="Courier New" size="2"><b>public</b></font><font
face="Courier New" size="2">
</font><font color="#820040" face="Courier New" size="2"><b>class</b></font>
<font face="Courier New" size="2">
PdfPageSignature </font><font color="#820040" face="Courier New" size="2"><b
>extends</b></font><font face="Courier New" size="2">
PdfPageEventHelper {</font>
<br>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; </font><font
color="#4040c2" face="Courier New" size="2">/**</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</font>
<font color="#4040c2" face="Courier New" size="2">*</font><font face="Courier
New" size="2">
</font><font color="#71b2cf" face="Courier New" size="2"><b>@(protected)</b></font>
<font face="Courier New" size="2">
</font><font color="#4040c2" face="Courier New" size="2">com.lowagie.text.pdf
.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter,</font><font face=
"Courier New" size="2">
</font><font color="#4040c2" face="Courier New" size="2">com.lowagie.text
.Document)</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</font>
<font color="#4040c2" face="Courier New" size="2">*/</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; </font><font
color="#820040" face="Courier New" size="2"><b>public</b></font><font face=
"Courier New" size="2">
</font><font color="#820040" face="Courier New" size="2"><b>void</b></font>
<font face="Courier New" size="2">
onEndPage(PdfWriter writer, Document document) {</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; MessageResources messageResources = (MessageResources)
request.getAttribute(Globals.MESSAGES_KEY);</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; HROnlineLocale hrOnlineLocale = </font><font color="
#820040" face="Courier New" size="2"><b>new</b></font><font face="Courier New"
size="2">
HROnlineLocale(request);</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font color="#820040" face="Courier New" size="2">
<b>try</b></font><font face="Courier New" size="2">
{</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rectangle
page = document.getPageSize();</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String
text = </font><font color="#4200ff" face="Courier New" size="2">&quot;page
&quot;</font><font face="Courier New" size="2">+ writer.getPageNumber();</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String
employeeInitials = messageResources.getMessage(hrOnlineLocale.getLocaleLocale(),
</font><font color="#4200ff" face="Courier New" size="2">&quot;label.employee
.initials&quot;</font><font face="Courier New" size="2">);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PdfPTable
footer = </font><font color="#820040" face="Courier New" size="2"><b>new</b><
/font><font face="Courier New" size="2">
PdfPTable(2);</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PdfPCell
footerCellRight = </font><font color="#820040" face="Courier New" size="2"><b
>new</b></font><font face="Courier New" size="2">
PdfPCell(</font><font color="#820040" face="Courier New" size="2"><b>new</b><
/font><font face="Courier New" size="2">
Phrase(text,PdfUtils.getBlack(9)));</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; footerCellRight.setBorder(0);<
/font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; footerCellRight
.setHorizontalAlignment(2);</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PdfPCell
footerCellLeft = </font><font color="#820040" face="Courier New" size="2"><b
>new</b></font><font face="Courier New" size="2">
PdfPCell(</font><font color="#820040" face="Courier New" size="2"><b>new</b><
/font><font face="Courier New" size="2">
Phrase(employeeInitials,PdfUtils.getBlack(9)));</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; footerCellLeft.setBorder(0);<
/font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font color="blue" face
="Courier New" size="2">footerCellLeft</font><font face="Courier New" size="2">
.setHorizontalAlignment(0);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; footer.addCell(footerCellLeft)
;</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; footer.addCell(footerCellRight
);
&nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; footer.setTotalWidth(page
.width()
- document.leftMargin() - document.rightMargin());</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; footer.writeSelectedRows(0,
-1, document.leftMargin(), document.bottomMargin(),writer.getDirectContent());
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; }</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font color="#820040" face="Courier New" size="2">
<b>catch</b></font><font face="Courier New" size="2">
(Exception e) {</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font color="#820040"
face="Courier New" size="2"><b>throw</b></font><font face="Courier New" size="2
">
</font><font color="#820040" face="Courier New" size="2"><b>new</b></font><font
face="Courier New" size="2">
ExceptionConverter(e);</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; }</font>
<br><font face="Courier New" size="2">&nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font face="Courier New" size="2">}</font><font face="sans-serif" size="2">
<br>
</font>
<hr>
<table width="100%">
<tbody><tr valign="top">
<td width="46%"><font face="Arial" size="1"><b>R?mi R. Paquette</b><br>
Developer<br>
Tel: (613) 748-4041<br>
Email: </font><a href="mailto:rpaquett@(protected)" target="_blank" onclick
="return top.js.OpenExtLink(window,event,this)"><font color="blue" face="Arial"
size="1"><u>rpaquett@(protected)</u></font></a><font face="Arial" size="1">

<br>
700 Montreal Road, Ottawa, Ontario, K1A 0P7 <br>
Canada Mortgage and Housing Corporation (CMHC)</font><font color="blue" face=
"Arial" size="1"><u><br>
</u></font><a href="http://www.cmhc.ca/" target="_blank" onclick="return top.js
.OpenExtLink(window,event,this)"><font color="blue" face="Arial" size="1"><u
>http://www.cmhc.ca</u></font></a><font face="Arial" size="1">
</font>
</td><td width="53%"><font face="Arial" size="1"><b>R?mi R. Paquette</b><br>
D?veloppeur <br>
T?l?phone : (613) 748-4041<br>
Courriel : </font><a href="mailto:rpaquett@(protected)" target="_blank"
onclick="return top.js.OpenExtLink(window,event,this)"><font color="blue" face=
"Arial" size="1"><u>rpaquett@(protected)</u></font></a><font face="Arial"
size="1">

<br>
700 chemin Montr?al, Ottawa (Ontario) K1A 0P7 <br>
Soci?t? canadienne d&#39;hypoth?ques et de logement (SCHL)</font><font color=
"blue" face="Arial" size="1"><u><br>
</u></font><a href="http://www.schl.ca/" target="_blank" onclick="return top.js
.OpenExtLink(window,event,this)"><font color="blue" face="Arial" size="1"><u
>http://www.schl.ca</u></font></a><font face="Arial" size="1">
</font></td></tr></tbody></table>
<br>
<p><font size="3">&nbsp; </font>
</p><p></p><p></p><br>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
-- ---- ---- ---<br>This SF.net email is sponsored by: Microsoft<br>Defy all
challenges. Microsoft(R) Visual Studio 2005.<br><a onclick="return top.js
.OpenExtLink(window,event,this)" href="http://clk.atdmt.com/MRT/go
/vse0120000070mrt/direct/01/" target="_blank">
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/</a><br>__ ____ ____ ___
__ ____ ____ ____ ____ ____ ___<br>iText-questions mailing list<br><a onclick=
"return top.js.OpenExtLink(window,event,this)" href="mailto:iText-questions
@(protected)">
iText-questions@(protected)</a><br><a onclick="return top.js
.OpenExtLink(window,event,this)" href="https://lists.sourceforge.net/lists
/listinfo/itext-questions" target="_blank">https://lists.sourceforge.net/lists
/listinfo/itext-questions
</a><br>Buy the iText book: <a onclick="return top.js.OpenExtLink(window,event
,this)" href="http://itext.ugent.be/itext-in-action/" target="_blank">http:/
/itext.ugent.be/itext-in-action/</a><br><br></blockquote></div><br>

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

©2008 junlu.com - Jax Systems, LLC, U.S.A.