Go Back   Android Forums > Android Development > Application Development
Application Development Dev Lounge for the Coder Folks
Gamers - Check out our new sister sites!
Nintendo Wii U!    |    OUYA - $99 Android System!

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
 
Device(s):
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(
"/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[i] = paragraphs[i].replaceAll("\\cM?\r?\n",
"");
System.out.println("Length:" + paragraphs[i].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.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
Sponsors
Old March 13th, 2012, 08:38 AM   #2 (permalink)
eschew obfuscation
 
Unforgiven's Avatar
 
Join Date: Jun 2010
Location: Douglas, MA
Gender: Male
Posts: 14,524
 
Device(s): OG Droid, DroidX2, HTC Rhyme, Kindle Fire, Galaxy Nexus, Nexus 7 (8GB & 16GB)
Carrier: VZW

Thanks: 7,159
Thanked 8,109 Times in 4,626 Posts
Default

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

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
*** Check out the new AF forum app!!! ***

I'm supporting BabyBlues with this. Please consider this worthy cause. Details

Unforgiven is online now  
Reply With Quote
Reply
Tags
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 05:07 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.