Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Like Tree1Likes
  • 1 Post By Unforgiven

test: Reply
LinkBack Thread Tools
Old March 13th, 2012, 08:22 AM   #1 (permalink)
New Member
Thread Author (OP)
Join Date: Mar 2012
Posts: 1
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Cry Doc To PDF Converter in Android Code

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(

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[i] = paragraphs[i].replaceAll("\\cM?\r?\n",
System.out.println("Length:" + paragraphs[i].length());
} catch (Exception e) {

Document document = new Document(PageSize.A4, 36, 72, 108, 180);
PdfWriter.getInstance(document, new FileOutputStream(

System.out.println("Text is inserted into pdf file");
} 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.checkPDFXConformanc e
E/dalvikvm(3192): Could not find class 'java.awt.Color', referenced from method com.lowagie.text.pdf.PdfDocument.writeLineToConten t
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.createPrinterG raphics

vishal07 is offline  
Reply With Quote
sponsored links
Old March 13th, 2012, 08:38 AM   #2 (permalink)
~Play Nice~
Unforgiven's Avatar
Join Date: Jun 2010
Location: Douglas, MA
Gender: Male
Posts: 24,921
Device(s): Moto X Developer Edition, Nexus 7 (2012 & 2013), Note II, S3
Carrier: Not Provided

Thanks: 15,571
Thanked 16,902 Times in 9,297 Posts

I've moved this thread to Application Development so it gets the right eyeballs on it.
vishal07 likes this.

Join the fun and make some friends, register for free here.
If someone helped, hit Thanks, if you see rude or abusive posts, spam, or threads that need staff attention, hit Report.
Site Rules / Android Forums FAQ
*** Do you want to talk guns? ***

Unforgiven is offline  
Reply With Quote
android, conve, doc, itext, pdf

Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -5. The time now is 11:40 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.