You posted the wrong program.
-----Original Message-----
From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
Sent: Tuesday, February 17, 2004 17:17
To: Paulo Soares
Subject: RE: [iText-questions] java.lang.OutOfMemoryError
This is a java program. It read a input txt file and creates a output pdf
file. The program has been run for long time. I tried to convert a big txt
file and got the java.lang.OutOfMemoryError. Do you have any suggestion?
Thanks,
Frank
import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
public class Encrypt40bits extends java.lang.Object {
public static void main (String args[]) {
if (args.length != 3) {
System.err.println("This tools needs 3 parameters:\njava
Encrypt srcfile destfile password");
}
else {
try {
PdfReader reader = new PdfReader(args[0]);
int n = reader.getNumberOfPages();
String pin = args[1].substring(3);
if (pin.equals("null") ==true ){
pin = "";
}
//String pin = args[1];
System.out.println("There are " + n + " pages in the
original file.");
Document document = new
Document(reader.getPageSizeWithRotation(1));
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("Encrypted_" + args[0]));
document.open();
PdfContentByte cb = writer.getDirectContent();
PdfImportedPage page;
int rotation;
int i = 0;
while (i < n) {
i++;
document.setPageSize(reader.getPageSizeWithRotation(i));
document.newPage();
page = writer.getImportedPage(reader, i);
rotation = reader.getPageRotation(i);
if (rotation == 90 || rotation == 270) {
cb.addTemplate(page, 0, -1f, 1f, 0, 0,
reader.getPageSizeWithRotation(i).height());
}
else {
cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
}
}
document.close();
}
catch(Exception e) {
System.err.println(e.getClass().getName() + ": " +
e.getMessage());
}
}
}
}
"Paulo Soares"
<[EMAIL PROTECTED] To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
.pt> cc:
Subject: RE: [iText-questions] java.lang.OutOfMemoryError
02/17/2004 12:05
PM
What program is that?
Best Regards,
Paulo Soares
-----Original Message-----
From: [EMAIL PROTECTED]
[SMTP:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, February 17, 2004 16:03
To: [EMAIL PROTECTED]
Subject: [iText-questions] java.lang.OutOfMemoryError
Hi,
I have been using itext txt2pdf for a long time. It is a great!,
I am using java 1.1. I tried to convert a big file and got
java.lang.OutOfMemoryError massge.
Can any one give me help?
Thanks,
Frank
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions