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
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
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
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: 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
 
Question about splitCharacter

Question about splitCharacter

2007-11-09       - By Paulo Soares

 Back
Reply:     1     2     3     4     5  

You are only looking at "current" but can also look at "current + 1" and
"current - 1" to decide what to do.

Paulo


__ ____ ____ ____ ____ ____ ____

  From: itext-questions-bounces@(protected)
[mailto:itext-questions-bounces@(protected)] On Behalf Of Tom
Tolman
  Sent: Thursday, November 08, 2007 7:02 PM
  To: itext-questions@(protected)
  Subject: [iText-questions] Question about splitCharacter
 
 

 

 

  I have implemented SplitCharacter and was hoping to have it
split after the close parenthesis ')', but not before this character,
As such I have something like:

 

  public boolean isSplitCharacter(int start, int current, int end,
char[] cc, PdfChunk[] ck) {

    char c;

    if (ck == null)

        c = cc[current];

    else

        c = ck[Math.min(current, ck.length -
1)].getUnicodeEquivalent(cc[current]);

    if ((c ')') || (c==' ')) {

        return true;

    }

 

  This appears to work in some situations such as the breaking of
"aaa)bbb" is correct and desired as:

  aaa)

  bbb

 

  However, in the case where a closing parenthesis ends the line,
it is treating it as a "split before character".  In other words, the
line:

 

  hello (test)

 

  is split as follows:

  hello (test

  )

 

  instead of what I want which is:

  hello

  (test)

 

 

  According to the implicit definition "treat a split character as
if it can go at the beginning or end of a line" it is working, but what
I desire is "treat this split character as if it only can go on the end
of the line".

 

  So my questions are:

 

  1) Is there native support for this concept of the split
character being at the start or end of a contiguous set of characters?

  2) If not, can I "force" it by breaking the text into chunks
that are stuck next to each other?

  3) If breaking the text into chunks does not work, is the only
real remaining course of action to insert line breaks manually?

 

  Thanks for any ideas,

 

 

 



Aviso Legal:
Esta mensagem ? destinada exclusivamente ao destinat?rio. Pode conter informa?
?o confidencial ou legalmente protegida. A incorrecta transmiss?o desta mensagem
n?o significa a perca de confidencialidade. Se esta mensagem for recebida por
engano, por favor envie-a de volta para o remetente e apague-a do seu sistema
de imediato. ? proibido a qualquer pessoa que n?o o destinat?rio de usar,
revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:x =
"urn:schemas-microsoft-com:office:excel" xmlns:p =
"urn:schemas-microsoft-com:office:powerpoint" xmlns:a =
"urn:schemas-microsoft-com:office:access" xmlns:dt =
"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s =
"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs =
"urn:schemas-microsoft-com:rowset" xmlns:z = "#RowsetSchema" xmlns:b =
"urn:schemas-microsoft-com:office:publisher" xmlns:ss =
"urn:schemas-microsoft-com:office:spreadsheet" xmlns:c =
"urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:oa =
"urn:schemas-microsoft-com:office:activation" xmlns:html =
"http://www.w3.org/TR/REC-html40" xmlns:q =
"http://schemas.xmlsoap.org/soap/envelope/" XMLNS:D = "DAV:" xmlns:x2 =
"http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois =
"http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir =
"http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds =
"http://www.w3.org/2000/09/xmldsig#" xmlns:dsp =
"http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc =
"http://schemas.microsoft.com/data/udc" xmlns:xsd =
"http://www.w3.org/2001/XMLSchema" xmlns:sps =
"http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi =
"http://www.w3.org/2001/XMLSchema-instance" xmlns:udcxf =
"http://schemas.microsoft.com/data/udc/xmlfile" xmlns:wf =
"http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:mver =
"http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels =
"http://schemas.openxmlformats.org/package/2006/relationships" xmlns:ex12t =
"http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m =
"http://schemas.microsoft.com/exchange/services/2006/messages"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16525" name=GENERATOR>
<STYLE>@(protected) {
  font-family: Calibri;
}
@(protected) Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
  FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
  FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
  FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
  COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
  COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
  COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
  COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
PRE {
  FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Courier New"; mso-style
-priority: 99; mso-style-link: "HTML Preformatted Char"
}
SPAN.EmailStyle17 {
  COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type:
personal-compose
}
SPAN.HTMLPreformattedChar {
  FONT-FAMILY: "Courier New"; mso-style-priority: 99; mso-style-link: "HTML
Preformatted"; mso-style-name: "HTML Preformatted Char"
}
.MsoChpDefault {
  mso-style-type: export-only
}
DIV.Section1 {
  page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
 <o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=971093610-09112007><FONT face="Courier New"
color=#0000ff>You are&nbsp;only looking at "current" but can also look at
"current + 1" and "current&nbsp;- 1" to decide what to do.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=971093610-09112007><FONT face="Courier New"
color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=971093610-09112007><FONT face="Courier New"
color=#0000ff>Paulo</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid;
MARGIN-RIGHT: 0px">
 <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
 <HR tabIndex=-1>
 <FONT face=Tahoma size=2><B>From:</B>
 itext-questions-bounces@(protected)
 [mailto:itext-questions-bounces@(protected)] <B>On Behalf Of </B
>Tom
 Tolman<BR><B>Sent:</B> Thursday, November 08, 2007 7:02 PM<BR><B>To:</B>
 itext-questions@(protected)<BR><B>Subject:</B> [iText-questions]
 Question about splitCharacter<BR></FONT><BR></DIV>
 <DIV></DIV>
 <DIV class=Section1>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>I have implemented SplitCharacter and was hoping to have
it
 split after the close parenthesis ')', but not before this character,&nbsp;
As
 such I have something like:<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">public boolean
 isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
 {<o:p></o:p></SPAN></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp; char
 c;<o:p></o:p></SPAN></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp; if (ck ==
 null)<o:p></o:p></SPAN></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
 c = cc[current];<o:p></o:p></SPAN></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;
 else<o:p></o:p></SPAN></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
 c = ck[Math.min(current, ck.length -
 1)].getUnicodeEquivalent(cc[current]);<o:p></o:p></SPAN></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp; if ((c ')')
 || (c==' ')) {<o:p></o:p></SPAN></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
 return true;<o:p></o:p></SPAN></P>
 <P class=MsoNormal><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;
 }<o:p></o:p></SPAN></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>This appears to work in some situations such as the
 breaking of &nbsp;"aaa)bbb" is correct and desired as:<o:p></o:p></P>
 <P class=MsoNormal>aaa) <o:p></o:p></P>
 <P class=MsoNormal>bbb <o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>However, in the case where a closing parenthesis ends the
 line, it is treating it as a "split before character".&nbsp; In other words,
 the line:<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>hello (test)<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>is split as follows:<o:p></o:p></P>
 <P class=MsoNormal>hello (test<o:p></o:p></P>
 <P class=MsoNormal>)<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>instead of what I want which is:<o:p></o:p></P>
 <P class=MsoNormal>hello<o:p></o:p></P>
 <P class=MsoNormal>(test)<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>According to the implicit definition "treat a split
 character as if it can go at the beginning or end of a line" it is working,
 but what I desire is "treat this split character as if it only can go on the
 end of the line".<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>So my questions are:<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>1) Is there native support for this concept of the split
 character being at the start or end of a contiguous set of
 characters?<o:p></o:p></P>
 <P class=MsoNormal>2) If not, can I "force" it by breaking the text into
 chunks that are stuck next to each other?<o:p></o:p></P>
 <P class=MsoNormal>3) If breaking the text into chunks does not work, is the
 only real remaining course of action to insert line breaks
 manually?<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal>Thanks for any ideas,<o:p></o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P>
 <P class=MsoNormal><o:p>&nbsp;</o:p></P></DIV></BLOCKQUOTE>
<DIV><P><HR>
Aviso Legal:<BR>
Esta mensagem &eacute; destinada exclusivamente ao destinat&aacute;rio. Pode
conter informa&ccedil;&atilde;o confidencial ou legalmente protegida. A
incorrecta transmiss&atilde;o desta mensagem n&atilde;o significa a perca de
confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a
de volta para o remetente e apague-a do seu sistema de imediato. &Eacute;
proibido a qualquer pessoa que n&atilde;o o destinat&aacute;rio de usar,
revelar ou distribuir qualquer parte desta mensagem. <BR>
<BR>
Disclaimer:<BR>
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.<BR>

</P></DIV>
</BODY></HTML>

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
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.