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
 
Size of iText-generated RTF file growing after saving in

Size of iText-generated RTF file growing after saving in

2007-11-15       - By Alexis Pigeon

 Back
Hi all,

I'm using iText 2.0.6 to generate an RTF file that has to be edited
manually afterwards with Word.

The problem is that, after editing, the file size is 10 times bigger
than the original one. Here's a stripped-down example :

public static void main(String[] args) throws Exception {
       FileOutputStream fos = new FileOutputStream("C:/Temp/itext/test.rtf");
       Document document = new Document();
       RtfWriter2.getInstance(document, fos);

       Table tableHeader = new Table(1);
       tableHeader.setBorder(0);
       tableHeader.getDefaultLayout().setBorder(0);
       tableHeader.setWidth(100);
       tableHeader.addCell(new
Cell(Image.getInstance("C:/Temp/itext/test.jpeg")));
       document.setHeader(new RtfHeaderFooter(tableHeader));

       document.open();

       for (int i = 0; i < 25; i++) {
           document.add(new Phrase("Lorem Ipsum "));
           document.newPage();
       }

       document.close();
}

In this example, the Image class is com.lowagie.text.Image, and
test.jpeg is attached to this mail. In case it doesn't make it through
the sourceforge list filter, I got the image from [1].

If you run the example, you'll get a 13Kb file. Open it (I tried with
Word97, Word2000 and OpenOffice.org 2.3), edit the content by adding
just a single character, and save it. You get a 150+ Kb file! And in
our real-life implementation, the original file size is 250 Kb, making
2.5 Mb file after editing.

Adding a String instead of an Image in the header results in a much
smaller generated file of course, but after editing it the file size
is far from growing that much.

I guess it's related to the different ways pictures in headers are
managed in iText and Word, but I wanted to know if there would be some
tweak or parameter I could set with iText to force Word to do it the
"iText-way".

Anyway, thanks again for the great library!

Regards,
alexis

[1] : http://itext.ugent.be/img/lowagie_3d.jpg

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