:'(
Hello Guys,
I am making an application in which I need to convert selected .doc file into .pdf file..I am not getting why I
am geeting the error which I have mentioned below.I am using iText 5.1.1 to do file operations related to .doc &
.pdf..Any single help/hint will be appreciated..Thanks in advance..
This is my code of onClick() event for "Convert" button::
String[] paragraphs = null;
//Color clr=new Color();
try {
POIFSFileSystem fs = null;
try {
InputStream is = new FileInputStream(
"/sdcard/Spring.doc");
WordExtractor we = new WordExtractor(is);
paragraphs = we.getParagraphText();
System.out.println("Word Document has " + paragraphs.length
+ " paragraphs");
for (int i = 0; i < paragraphs.length; i++) {
paragraphs = paragraphs.replaceAll("\\cM?\r?\n",
"");
System.out.println("Length:" + paragraphs.length());
}
} catch (Exception e) {
e.printStackTrace();
}
Document document = new Document(PageSize.A4, 36, 72, 108, 180);
PdfWriter.getInstance(document, new FileOutputStream(
"/sdcard/pdfFile.pdf"));
document.open();
System.out.println("Text is inserted into pdf file");
document.close();
} catch (Exception e) {
}
==========================================================
This is my imports which I have used ::
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import android.graphics.*;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.action.R;
import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfWriter;
==========================================================
And the error I am geeting is ::
E/dalvikvm(3192): Could not find class 'com.lowagie.text.pdf.ExtendedColor', referenced from method
com.lowagie.text.pdf.PdfWriter.checkPDFXConformance
E/dalvikvm(3192): Could not find class 'java.awt.Color', referenced from method
com.lowagie.text.pdf.PdfDocument.writeLineToContent
E/dalvikvm(3192): Could not find class 'com.lowagie.text.pdf.PdfGraphics2D', referenced from method
com.lowagie.text.pdf.PdfContentByte.createGraphics
E/dalvikvm(3192): Could not find class 'com.lowagie.text.pdf.PdfPrinterGraphics2D', referenced from method
com.lowagie.text.pdf.PdfContentByte.createPrinterGraphics
Hello Guys,
I am making an application in which I need to convert selected .doc file into .pdf file..I am not getting why I
am geeting the error which I have mentioned below.I am using iText 5.1.1 to do file operations related to .doc &
.pdf..Any single help/hint will be appreciated..Thanks in advance..
This is my code of onClick() event for "Convert" button::
String[] paragraphs = null;
//Color clr=new Color();
try {
POIFSFileSystem fs = null;
try {
InputStream is = new FileInputStream(
"/sdcard/Spring.doc");
WordExtractor we = new WordExtractor(is);
paragraphs = we.getParagraphText();
System.out.println("Word Document has " + paragraphs.length
+ " paragraphs");
for (int i = 0; i < paragraphs.length; i++) {
paragraphs = paragraphs.replaceAll("\\cM?\r?\n",
"");
System.out.println("Length:" + paragraphs.length());
}
} catch (Exception e) {
e.printStackTrace();
}
Document document = new Document(PageSize.A4, 36, 72, 108, 180);
PdfWriter.getInstance(document, new FileOutputStream(
"/sdcard/pdfFile.pdf"));
document.open();
System.out.println("Text is inserted into pdf file");
document.close();
} catch (Exception e) {
}
==========================================================
This is my imports which I have used ::
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import android.graphics.*;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.action.R;
import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfWriter;
==========================================================
And the error I am geeting is ::
E/dalvikvm(3192): Could not find class 'com.lowagie.text.pdf.ExtendedColor', referenced from method
com.lowagie.text.pdf.PdfWriter.checkPDFXConformance
E/dalvikvm(3192): Could not find class 'java.awt.Color', referenced from method
com.lowagie.text.pdf.PdfDocument.writeLineToContent
E/dalvikvm(3192): Could not find class 'com.lowagie.text.pdf.PdfGraphics2D', referenced from method
com.lowagie.text.pdf.PdfContentByte.createGraphics
E/dalvikvm(3192): Could not find class 'com.lowagie.text.pdf.PdfPrinterGraphics2D', referenced from method
com.lowagie.text.pdf.PdfContentByte.createPrinterGraphics