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
 
Subject: Re: Why The image from src of <img > cannot bewritteninto pdf file completely

Subject: Re: Why The image from src of <img > cannot bewritteninto pdf file completely

2007-10-10       - By Scott WoodEasy

 Back
Thanks for your reply,Paulo.

But again it failed to generate the image completely.

Is it a bug?
-- -- Original Message -- --
From: Paulo Soares
To: Post all your questions about iText here
Sent: 2007-10-10, 18:27:38
Subject: Re: [iText-questions] Why The image from src of  cannot bewritteninto
pdf file completely?


Add the element directly to the document instead of a Paragraph.

Paulo

> -- --Original Message-- --
> From: itext-questions-bounces@(protected)
> [mailto:itext-questions-bounces@(protected)] On
> Behalf Of Scott
> Sent: Wednesday, October 10, 2007 3:54 AM
> To: itext-questions
> Subject: [iText-questions] Why The image from src of <img>
> cannot be writteninto pdf file completely?
>
> Hello Everyone
>
> When I was using HTMLWorker to parse some HTML piece into a
> pdf file,I found a problem.
> The image from src of <img> cannot be written into pdf file
> completely,but a part of the image instead.
> Below is my code,and the generated pdf file attached.
> Anyone knows why?
> Thank you so much?
>
>
>
>
> import java.io.FileNotFoundException;
>
> import java.io.FileOutputStream;
>
> import java.io.FileReader;
>
> import java.io.IOException;
>
> import java.io.StringReader;
>
> import java.util.ArrayList;
>
>
>
> import com.lowagie.text.Document;
>
> import com.lowagie.text.DocumentException;
>
> import com.lowagie.text.Element;
>
> import com.lowagie.text.Paragraph;
>
> import com.lowagie.text.html.HtmlWriter;
>
> import com.lowagie.text.html.simpleparser.HTMLWorker;
>
> import com.lowagie.text.pdf.PdfWriter;
>
>
>
> /**
>
> *
>
> * @(protected) HtmlImageToPdf.java
>
> *
>
> * @(protected) Scott
>
> *
>
> * @(protected) at 2007-10-10 ??10:24:01
>
> *
>
> */
>
>
>
> public class HtmlImageToPdf
>
> {
>
>
>
> /**
>
> * @(protected) Scott
>
> *
>
> * @(protected) args
>
> * @(protected) IOException
>
> * @(protected) DocumentException
>
> */
>
> public static void main(String[] args) throws IOException,
>
> DocumentException
>
> {
>
> StringBuffer HtmlPiece = new StringBuffer();
>
> HtmlPiece.append("<body>");
>
> HtmlPiece.append("<h1>Hello Beauty!</h1><br />");
>
> HtmlPiece.append("<img src=?"F:??1.jpg?">");
>
> HtmlPiece.append("</body>");
>
>
>
> Document doc = new Document();
>
> PdfWriter.getInstance(doc, new FileOutputStream(
>
> "D:??HtmlImageToPdf.pdf"));
>
> Paragraph para = new Paragraph();
>
> doc.open();
>
> new HTMLWorker(doc);
>
> ArrayList p = HTMLWorker.parseToList(new
> StringReader(HtmlPiece.toString()), null);
>
> for (int k = 0; k < p.size(); ++k)
>
> {
>
> para.add((Element) p.get(k));
>
> }
>
>
>
> doc.add(para);
>
> doc.close();
>
> System.out.println("??");
>
>
>
> }
>
>
>
> }
>
>
>
>


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.

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
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/

<HTML><HEAD><TITLE>Mail</TITLE>
<META content="KsDHTMLEDLib.ocx, FreeWare HTML Editor 1.164.2, ?Kurt Senfer"
name=GENERATOR>
<META http-equiv=Content-Type content="text/html; charset=GB2312"></HEAD>
<BODY style="FONT-SIZE: 9pt; FONT-FAMILY: ??" leftMargin=5 topMargin=5 #ffffff>
<DIV><!--AID_SENDTO_BEGIN--><FONT face="Lucida Console" size=3>Thanks for your
reply,Paulo.</FONT></DIV>
<DIV><FONT face="Lucida Console" size=3></FONT>&nbsp;</DIV>
<DIV><FONT face="Lucida Console" size=3>But again&nbsp;it failed to generate
the
image completely.</FONT></DIV>
<DIV><FONT face="Lucida Console" size=3></FONT>&nbsp;</DIV>
<DIV><FONT face="Lucida Console" size=3>Is it a bug?</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT:
#000000 2px solid; MARGIN-RIGHT: 0px">
 <DIV
 style="FONT-WEIGHT: normal; FONT-SIZE: 9pt; LINE-HEIGHT: normal; FONT-STYLE:
normal; FONT-VARIANT: normal">-- --
 Original Message -- -- </DIV>
 <DIV
 style="FONT-WEIGHT: normal; FONT-SIZE: 9pt; BACKGROUND: #e4e4e4; LINE-HEIGHT:
normal; FONT-STYLE: normal; FONT-VARIANT: normal; font-color: black"><B>From:
 </B><A href="mailto:psoares@(protected)">Paulo Soares</A> </DIV>
 <DIV
 style="FONT-WEIGHT: normal; FONT-SIZE: 9pt; LINE-HEIGHT: normal; FONT-STYLE:
normal; FONT-VARIANT: normal"><B>To:
 </B><A href="mailto:itext-questions@(protected)">Post all your
 questions about iText here</A> </DIV>
 <DIV
 style="FONT-WEIGHT: normal; FONT-SIZE: 9pt; LINE-HEIGHT: normal; FONT-STYLE:
normal; FONT-VARIANT: normal"><B>Sent:
 </B>2007-10-10, 18:27:38</DIV>
 <DIV
 style="FONT-WEIGHT: normal; FONT-SIZE: 9pt; LINE-HEIGHT: normal; FONT-STYLE:
normal; FONT-VARIANT: normal"><B>Subject:
 </B>Re: [iText-questions] Why The image from src of <IMG> cannot
bewritteninto
 pdf file completely?</DIV>
 <DIV><BR></DIV>
 <DIV></DIV>
 <DIV></DIV>
 <DIV>
 <DIV>Add the element directly to the document instead of a
 Paragraph.<BR><BR>Paulo <BR><BR>&gt; -- --Original Message-- --<BR>&gt; From:
 <A
 href="mailto: itext-questions-bounces@(protected)">itext-questions
-bounces@(protected)</A>
 <BR>&gt; [mailto:<A
 href="mailto: itext-questions-bounces@(protected)">itext-questions
-bounces@(protected)</A>]
 On <BR>&gt; Behalf Of Scott<BR>&gt; Sent: Wednesday, October 10, 2007 3:54
 AM<BR>&gt; To: itext-questions<BR>&gt; Subject: [iText-questions] Why The
 image from src of &lt;img&gt; <BR>&gt; cannot be writteninto pdf file
 completely?<BR>&gt; <BR>&gt; Hello Everyone<BR>&gt; <BR>&gt; When I was using
 HTMLWorker to parse some HTML piece into a <BR>&gt; pdf file,I found a
 problem.<BR>&gt; The image from src of &lt;img&gt; cannot be written into pdf
 file <BR>&gt; completely,but a part of the image instead.<BR>&gt; Below is my
 code,and the generated pdf file attached.<BR>&gt; Anyone knows why?<BR>&gt;
 Thank you so much?<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; import
 java.io.FileNotFoundException;<BR>&gt; <BR>&gt; import
 java.io.FileOutputStream;<BR>&gt; <BR>&gt; import java.io.FileReader;<BR>&gt;
 <BR>&gt; import java.io.IOException;<BR>&gt; <BR>&gt; import
 java.io.StringReader;<BR>&gt; <BR>&gt; import java.util.ArrayList;<BR>&gt;
 <BR>&gt; <BR>&gt; <BR>&gt; import com.lowagie.text.Document;<BR>&gt; <BR>&gt;
 import com.lowagie.text.DocumentException;<BR>&gt; <BR>&gt; import
 com.lowagie.text.Element;<BR>&gt; <BR>&gt; import
 com.lowagie.text.Paragraph;<BR>&gt; <BR>&gt; import
 com.lowagie.text.html.HtmlWriter;<BR>&gt; <BR>&gt; import
 com.lowagie.text.html.simpleparser.HTMLWorker;<BR>&gt; <BR>&gt; import
 com.lowagie.text.pdf.PdfWriter;<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; /**<BR>&gt
;
 <BR>&gt; * <BR>&gt; <BR>&gt; * @(protected) HtmlImageToPdf.java<BR>&gt; <BR>&gt; *
 <BR>&gt; <BR>&gt; * @(protected) Scott<BR>&gt; <BR>&gt; * <BR>&gt; <BR>&gt; *
 @(protected) at 2007-10-10 ??10:24:01<BR>&gt; <BR>&gt; * <BR>&gt; <BR>&gt;
 */<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; public class HtmlImageToPdf<BR>&gt;
 <BR>&gt; {<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; /**<BR>&gt; <BR>&gt; * @(protected)
 Scott<BR>&gt; <BR>&gt; * <BR>&gt; <BR>&gt; * @(protected) args<BR>&gt; <BR>&gt; *
 @(protected) IOException<BR>&gt; <BR>&gt; * @(protected) DocumentException<BR>&gt;
 <BR>&gt; */<BR>&gt; <BR>&gt; public static void main(String[] args) throws
 IOException,<BR>&gt; <BR>&gt; DocumentException<BR>&gt; <BR>&gt; {<BR>&gt;
 <BR>&gt; StringBuffer HtmlPiece = new StringBuffer();<BR>&gt; <BR>&gt;
 HtmlPiece.append("&lt;body&gt;");<BR>&gt; <BR>&gt;
 HtmlPiece.append("&lt;h1&gt;Hello Beauty!&lt;/h1&gt;&lt;br /&gt;");<BR>&gt;
 <BR>&gt; HtmlPiece.append("&lt;img src=?"F:??1.jpg?"&gt;");<BR>&gt; <BR>&gt;
 HtmlPiece.append("&lt;/body&gt;");<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt;
Document
 doc = new Document();<BR>&gt; <BR>&gt; PdfWriter.getInstance(doc, new
 FileOutputStream(<BR>&gt; <BR>&gt; "D:??HtmlImageToPdf.pdf"));<BR>&gt;
 <BR>&gt; Paragraph para = new Paragraph();<BR>&gt; <BR>&gt;
 doc.open();<BR>&gt; <BR>&gt; new HTMLWorker(doc);<BR>&gt; <BR>&gt; ArrayList
p
 = HTMLWorker.parseToList(new <BR>&gt; StringReader(HtmlPiece.toString()),
 null);<BR>&gt; <BR>&gt; for (int k = 0; k &lt; p.size(); ++k)<BR>&gt; <BR>&gt
;
 {<BR>&gt; <BR>&gt; para.add((Element) p.get(k));<BR>&gt; <BR>&gt; }<BR>&gt;
 <BR>&gt; <BR>&gt; <BR>&gt; doc.add(para);<BR>&gt; <BR>&gt;
 doc.close();<BR>&gt; <BR>&gt; System.out.println("??");<BR>&gt; <BR>&gt;
 <BR>&gt; <BR>&gt; }<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; }<BR>&gt; <BR>&gt;
 <BR>&gt; <BR>&gt; <BR><BR><BR>Aviso Legal:<BR>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. <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><BR>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
-- ---- ----<BR>This
 SF.net email is sponsored by: Splunk Inc.<BR>Still grepping through log files
 to find problems? Stop.<BR>Now Search log events and configuration files
using
 AJAX and a browser.<BR>Download your FREE copy of Splunk now &gt;&gt; <A
 href="http://get.splunk.com/">http://get.splunk.com/</A><BR>__ ____ ____ ____
__ ____ ____ ____ ____ ____ __<BR>iText-questions
 mailing list<BR><A
 href="mailto: iText-questions@(protected)">iText-questions@(protected)
.sourceforge.net</A><BR><A
 href="https://lists.sourceforge.net/lists/listinfo/itext-questions">https:/
/lists.sourceforge.net/lists/listinfo/itext-questions</A><BR>Buy
 the iText book: <A
 href="http://itext.ugent.be/itext-in-action/">http://itext.ugent.be/itext-in
-action/</A><BR></DIV></DIV></BLOCKQUOTE></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.