Tutorial #22: Generate PDF using DroidText in Android

Hi guys!

I am back with another fun Android tutorial. This exercise will help you generate your own PDF file in Android. Sometimes, you need to create certain applications where in you want to output the details in the form of a PDF file so that it could printed or used in some other way.

In order to generate PDF we are going to use an external library called Droidtext which is used for PDF creation. It comes with a desktop version and an Android version, the differences between the two can be found over here. For this tutorial, I will be using the Android version.

So let’s begin creating our Android project to generate PDF!

Requirements: Eclipse Helios/Indigo, Android SDK

Step 1: Create a new Android project in Eclipse. Select Target SDK as Android 2.3.3. Create new Activity named MainActivity.

Step 2: Add Droidtext .jar file to Android project

You need to first download the latest version of the droidText jar file from over here. Copy the .jar file inside the libs folder of your Android project and then start writing your code.

Step 3: MainActivity.java


package com.example;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.HeaderFooter;
import com.lowagie.text.Image;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.PdfWriter;

import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {

	
	private Button b;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		b= (Button)findViewById(R.id.button1);
		b.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				createPDF();

			}
		});
		
	}

	
	public void createPDF()
	{
	 	Document doc = new Document();
        
		
		 try {
			 	String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/droidText";
			 	 
			 	File dir = new File(path);
			        if(!dir.exists())
			        	dir.mkdirs();

			    Log.d("PDFCreator", "PDF Path: " + path);
			    
			        
			    File file = new File(dir, "sample.pdf");
			    FileOutputStream fOut = new FileOutputStream(file);
     
        	 	PdfWriter.getInstance(doc, fOut);
                 
                //open the document
                doc.open();
                
                
                Paragraph p1 = new Paragraph("Hi! I am generating my first PDF using DroidText");
                Font paraFont= new Font(Font.COURIER);
                p1.setAlignment(Paragraph.ALIGN_CENTER);
                p1.setFont(paraFont);
                
                 //add paragraph to document    
                 doc.add(p1);
                
                 Paragraph p2 = new Paragraph("This is an example of a simple paragraph");
                 Font paraFont2= new Font(Font.COURIER,14.0f,Color.GREEN);
                 p2.setAlignment(Paragraph.ALIGN_CENTER);
                 p2.setFont(paraFont2);
                 
                 doc.add(p2);
                 
                 ByteArrayOutputStream stream = new ByteArrayOutputStream();
                 Bitmap bitmap = BitmapFactory.decodeResource(getBaseContext().getResources(), R.drawable.android);
                 bitmap.compress(Bitmap.CompressFormat.JPEG, 100 , stream);
                 Image myImg = Image.getInstance(stream.toByteArray());
                 myImg.setAlignment(Image.MIDDLE);
                
                 //add image to document
                 doc.add(myImg);
                
                 //set footer
                 Phrase footerText = new Phrase("This is an example of a footer");
                 HeaderFooter pdfFooter = new HeaderFooter(footerText, false);
                 doc.setFooter(pdfFooter);
                

                
         } catch (DocumentException de) {
                 Log.e("PDFCreator", "DocumentException:" + de);
         } catch (IOException e) {
                 Log.e("PDFCreator", "ioException:" + e);
         } 
		 finally
         {
                 doc.close();
         }
       
	}      
}

activity_main.xml


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

    <Button android:id="@+id/button1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:text="Generate PDF" />
    
</RelativeLayout>

No changes are to be made in the AndroidManifest.xml file. Run the Android application and you should see the following output!

android_pdf_generator_2

android_pdf_generator_3

Screenshot

Screenshot

Source code for this tutorial can be found over here.

Karan Balkar About Karan Balkar
self proclaimed extraterrestrial fandroid, computer engineer, amateur gamer and die hard punk rock fan!

117 thoughts on “Tutorial #22: Generate PDF using DroidText in Android

      • Hi Karan,

        Can you please guide us towards the functionalities and capabilities that droidtext offers. We are looking at droidtext as possible plugin but the capabilties are not documented.

        • Hi Tushar, droidText is basically used for PDF creation. It is not a PDF viewer. It is also a port of the iText library in Android. See this tutorial for use of iText. With DroidText you can read and write PDF files. That’s the only functionality it offers according to me.

          Btw are you looking for something in particular? What kind of plugin are you planning to develop using droidtext?

          Thanks! 🙂

  1. Hi, what if i’m using NetBeans IDE 7.3? would it be the same code or imports?, i will really appreciate your help.

    • Yes, you can even use the Netbeans IDE. The code will remain the same. Only remember to install the ADT plugin in Netbeans so that you can create Android projects!
      Thanks for visiting! 🙂

  2. Hello Valerio,

    Please follows below steps

    1) Right click on your android project then select option in
    Build path option —-> configure build path option.

    2) Select the java build path option present on left panel on new window.

    3) then select the Libraries option present in right panel then click on
    Add External JARs button then select your jar location.

    4)Then select the order and Export option present on this window then tick on your jar file

    5) And finally click on OK Button…

    your jar is added in your project…:)
    if any problem then please feel free to ask me..

    Thanks

  3. Hello Karan Balkar!
    Thanks a lot for this tutorial! It’s great!
    Do you know if there is a documentation of droidtext somewhere?

    Lukas

  4. Hello Karan Balkar,
    Am getting below the error.pls help me what to do?

    07-17 09:52:49.911: D/PDFCreator(3196): PDF Path: /mnt/sdcard/droidText
    07-17 09:52:49.911: E/PDFCreator(3196): ioException:java.io.FileNotFoundException: /mnt/sdcard/droidText/sample.pdf: open failed: EACCES (Permission denied)

  5. Hello Karan,
    Found the problem! When I created the AVD I never specified the size of the SD card. I edited and set a size of 512MiB and now it’s writeable! Thanks all who replied! 🙂

  6. My basic requirement is that,
    I want to accept a String from user and then generate a Barcode in a PDF file
    I am trying to use Barcodes class from droidText.. But cant figure out how to achieve it.. Because there is no example on it.
    Can you PLEASE provide me some example on the same….?
    Its Urgent and Important

    You can mail me any time on deo,anuj@gmail.com

    • As per above code, the PDF file that is generated will get stored inside a folder droidText in the memory of your the phone. So to view it you need some PDF software like adobe reader. Without the software I don’t think you can view it. One thing you can do is write a code that will convert the pdf file to an image so that it can viewed without any software. Hope it helps! 🙂

    • Karan is right! Its not possible to view a pfd without a pdf-viewer. But as You can see, Almost all devices have pre-installed Pdf-viewers. So you need to just create an Intent of a default Pdf-viewer…

    • This is a sample code to do the same…

      Uri path = Uri.fromFile(pdfFile);
      Intent intent = new Intent(Intent.ACTION_VIEW);
      intent.setDataAndType(path, “application/pdf”);
      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);

      try {
      startActivity(intent);
      }
      catch (Exception e) {
      Toast.makeText(getApplicationContext(), “No PDF Viewer found!”, Toast.LENGTH_SHORT).show();
      }

      Hope this helps u 🙂

  7. Pingback: Android 4 Tutorial Pdf | free pdf download

  8. hello, anyone told pdf creation time onside document inside call another document. its possible? i create one document size A8 but i want implement that document A4 sizedocument

  9. Karan,

    I want to implement above code upon browse a doc file and I want that this doc file should change into pdf as per your tutorial. Its urgent.

    Thanx.

  10. Hi Karan,
    very helpful tutorial, keep going with this stuff.
    I have a question for you.The letters that are not in English don’t appear on pdf document.
    Do you have a solution to that?

  11. its nice tutorial
    But i want to generate a pdf for view/page in anddroid. lets say i have a form in android. When I fill the form and click on save,the whole form should be saved in pdf as it is. Can you please suggest me how to do it.

    • Hi.

      It’s almost the same. You need to create a PDF file with the paragraphs representing the form field names and then once user fills the form and clicks submit , you can get the values for the same and accordingly update/create paragraphs. Basically, you need to first create a PDF structure for your form and then pass the values to the various components (like paragraph, header, footer etc)

  12. hii.. this demo is really nice and I need your help… i want to make pdf viewer like features but its extension should be something else… you have any idea for that..

  13. hi Karan,
    Thanks for the tutorial.please tell me how to increas size of paragraph text and draw a vertical line below text and how can i align chunk position please help me, thank you

  14. hi Karan,
    I forgot to tell you the paragraph font size not working in it is increasing only spacing not text size.

  15. I would like create a PDF file for receipt. It contains logo, table for item/quatity/price, QR code. Do you think it is possible with DroidText? Can you please share pointers how to do it?

  16. hiii Karan Balkar I create a Circulum Vitae manage the implementation and I have utilser code ” generate PDF ” in my first Interface ” Synthetic data Personal ” and the second interface I make a call to the procedure ” generates pdf” in the first interface How to help me? ?

  17. stop on document class
    public InvocationTargetException(Throwable exception) {
    super(null, exception);
    target = exception;
    }
    This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.shows this message when i take pointer on document and other class.
    Droidtext.0.2 is in lib folder and path is build from properties-BulidPath-Add Jar
    Karan Explain It .Its my First Project

  18. In Locat

    05-26 19:05:29.153: I/Process(23379): Sending signal. PID: 23379 SIG: 9
    05-26 19:05:35.037: D/jdwp(24017): sendBufferedRequest : len=0x39
    05-26 19:05:35.039: W/asset(24017): AssetManager–>addDefaultAssets CIP path not exsit!
    05-26 19:05:35.061: D/dalvikvm(24017): open_cached_dex_file : /data/app/com.example.p12-2.apk /data/dalvik-cache/data@app@com.example.p12-2.apk@classes.dex
    05-26 19:05:35.067: E/dalvikvm(24017): Could not find class ‘com.lowagie.text.Document’, referenced from method com.example.p12.MainActivity.createPDF
    05-26 19:05:35.067: W/dalvikvm(24017): VFY: unable to resolve new-instance 46 (Lcom/lowagie/text/Document;) in Lcom/example/p12/MainActivity;
    05-26 19:05:35.067: D/dalvikvm(24017): VFY: replacing opcode 0x22 at 0x0000
    05-26 19:05:35.069: D/dalvikvm(24017): DexOpt: unable to opt direct call 0x0032 at 0x02 in Lcom/example/p12/MainActivity;.createPDF
    05-26 19:05:35.069: D/dalvikvm(24017): DexOpt: unable to opt direct call 0x003c at 0x62 in Lcom/example/p12/MainActivity;.createPDF
    05-26 19:05:35.069: D/dalvikvm(24017): DexOpt: unable to opt direct call 0x0037 at 0x6b in Lcom/example/p12/MainActivity;.createPDF
    05-26 19:05:35.070: D/dalvikvm(24017): DexOpt: unable to opt direct call 0x003c at 0x81 in Lcom/example/p12/MainActivity;.createPDF
    05-26 19:05:35.070: D/dalvikvm(24017): DexOpt: unable to opt direct call 0x0038 at 0x93 in Lcom/example/p12/MainActivity;.createPDF
    05-26 19:05:35.070: D/dalvikvm(24017): DexOpt: unable to opt direct call 0x003f at 0xdc in Lcom/example/p12/MainActivity;.createPDF
    05-26 19:05:35.070: D/dalvikvm(24017): DexOpt: unable to opt direct call 0x0039 at 0xe7 in Lcom/example/p12/MainActivity;.createPDF
    05-26 19:05:35.167: D/libEGL(24017): >>> 0 0 android
    05-26 19:05:35.167: D/libEGL(24017): >>> 0 1 mali
    05-26 19:05:35.171: D/libEGL(24017): loaded /system/lib/egl/libEGL_mali.so
    05-26 19:05:35.180: D/libEGL(24017): loaded /system/lib/egl/libGLESv1_CM_mali.so
    05-26 19:05:35.183: D/libEGL(24017): loaded /system/lib/egl/libGLESv2_mali.so
    05-26 19:05:35.187: E/linker(24017): load_library(linker.cpp:759): library “libmaliinstr.so” not found
    05-26 19:05:35.190: E/(24017): appName=com.example.p12, acAppName=com.android.cts.openglperf
    05-26 19:05:35.190: E/(24017): 0
    05-26 19:05:35.190: E/(24017): appName=com.example.p12, acAppName=com.android.browser
    05-26 19:05:35.190: E/(24017): 0
    05-26 19:05:35.197: D/GraphicBuffer(24017): create handle(0x5cc2a658) (w:720, h:1280, f:1)
    05-26 19:05:35.201: D/GraphicBuffer(24017): close handle(0x5cc2a658) (w:720 h:1280 f:1)
    05-26 19:05:35.206: D/GraphicBuffer(24017): create handle(0x5cc2a658) (w:720, h:1280, f:1)
    05-26 19:05:35.211: D/OpenGLRenderer(24017): Enabling debug mode 0
    05-26 19:05:35.213: V/InputMethodManager(24017): onWindowFocus: null softInputMode=288 first=true flags=#1810100
    05-26 19:05:35.214: V/InputMethodManager(24017): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{42397a30 V.E….. R…..ID 0,0-720,1280} ic=null tba=android.view.inputmethod.EditorInfo@423d1b20 controlFlags=#104
    05-26 19:05:35.216: V/InputMethodManager(24017): Starting input: Bind result=InputBindResult{null com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME #4695}
    05-26 19:05:51.887: I/View(24017): Touch down dispatch to android.widget.Button{423baff0 VFED..C. …….. 32,519-688,615 #7f05003c app:id/button1}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=399.40085, y[0]=53.43872, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=193253900, downTime=193253900, deviceId=3, source=0x1002 }
    05-26 19:05:51.903: D/GraphicBuffer(24017): create handle(0x5e4458e8) (w:720, h:1280, f:1)
    05-26 19:05:51.917: I/SurfaceTextureClient(24017): [STC::queueBuffer] (this:0x5cc26e50) fps:0.06, dur:16620.95, max:16620.95, min:16620.95
    05-26 19:05:51.917: I/SurfaceTextureClient(24017): [STC::queueBuffer] this:0x5cc26e50, api:1, last queue time elapsed:16620.95
    05-26 19:05:51.980: I/View(24017): Touch up dispatch to android.widget.Button{423baff0 VFED..C. …P…. 32,519-688,615 #7f05003c app:id/button1}, event = MotionEvent { action=ACTION_UP, id[0]=0, x[0]=398.40222, y[0]=52.439514, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=193253999, downTime=193253900, deviceId=3, source=0x1002 }
    05-26 19:05:51.982: V/Provider/Settings(24017): invalidate [system]: current 1821 != cached 0
    05-26 19:05:51.985: D/ActivityThread(24017): hoder:android.app.IActivityManager$ContentProviderHolder@423d9c08,provider,holder.Provider:android.content.ContentProviderProxy@423da370
    05-26 19:05:51.986: V/Provider/Settings(24017): from db cache, name = sound_effects_enabled , value = 1
    05-26 19:05:52.008: D/AndroidRuntime(24017): Shutting down VM
    05-26 19:05:52.008: W/dalvikvm(24017): threadid=1: thread exiting with uncaught exception (group=0x420c99a8)
    05-26 19:05:52.008: W/dalvikvm(24017): threadid=1: uncaught exception occurred
    05-26 19:05:52.009: W/System.err(24017): java.lang.NoClassDefFoundError: com.lowagie.text.Document
    05-26 19:05:52.009: W/System.err(24017): at com.example.p12.MainActivity.createPDF(MainActivity.java:51)
    05-26 19:05:52.010: W/System.err(24017): at com.example.p12.MainActivity$1.onClick(MainActivity.java:41)
    05-26 19:05:52.010: W/System.err(24017): at android.view.View.performClick(View.java:4222)
    05-26 19:05:52.010: W/System.err(24017): at android.view.View$PerformClick.run(View.java:17620)
    05-26 19:05:52.010: W/System.err(24017): at android.os.Handler.handleCallback(Handler.java:800)
    05-26 19:05:52.010: W/System.err(24017): at android.os.Handler.dispatchMessage(Handler.java:100)
    05-26 19:05:52.010: W/System.err(24017): at android.os.Looper.loop(Looper.java:194)
    05-26 19:05:52.011: W/System.err(24017): at android.app.ActivityThread.main(ActivityThread.java:5391)
    05-26 19:05:52.011: W/System.err(24017): at java.lang.reflect.Method.invokeNative(Native Method)
    05-26 19:05:52.011: W/System.err(24017): at java.lang.reflect.Method.invoke(Method.java:525)
    05-26 19:05:52.011: W/System.err(24017): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
    05-26 19:05:52.011: W/System.err(24017): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    05-26 19:05:52.013: W/System.err(24017): at dalvik.system.NativeStart.main(Native Method)
    05-26 19:05:52.013: W/dalvikvm(24017): threadid=1: calling UncaughtExceptionHandler
    05-26 19:05:52.014: E/AndroidRuntime(24017): FATAL EXCEPTION: main
    05-26 19:05:52.014: E/AndroidRuntime(24017): java.lang.NoClassDefFoundError: com.lowagie.text.Document
    05-26 19:05:52.014: E/AndroidRuntime(24017): at com.example.p12.MainActivity.createPDF(MainActivity.java:51)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at com.example.p12.MainActivity$1.onClick(MainActivity.java:41)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at android.view.View.performClick(View.java:4222)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at android.view.View$PerformClick.run(View.java:17620)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at android.os.Handler.handleCallback(Handler.java:800)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at android.os.Handler.dispatchMessage(Handler.java:100)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at android.os.Looper.loop(Looper.java:194)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at android.app.ActivityThread.main(ActivityThread.java:5391)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at java.lang.reflect.Method.invokeNative(Native Method)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at java.lang.reflect.Method.invoke(Method.java:525)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    05-26 19:05:52.014: E/AndroidRuntime(24017): at dalvik.system.NativeStart.main(Native Method)

    • See this line

      05-26 19:05:52.009: W/System.err(24017): java.lang.NoClassDefFoundError: com.lowagie.text.Document

      There is an exception over here. Can you try checking the droidtext .jar file and see if this class file is present? Try and use the latest version.

  19. 05-27 20:59:32.126: E/dalvikvm(2770): Could not find class ‘com.lowagie.text.Document’, referenced from method com.example.p13.MainActivity.createPDF

    05-27 20:59:32.116: W/asset(2770): AssetManager–>addDefaultAssets CIP path not exsit!
    05-27 20:59:32.126: E/dalvikvm(2770): Could not find class ‘com.lowagie.text.Document’, referenced from method com.example.p13.MainActivity.createPDF
    05-27 20:59:32.126: W/dalvikvm(2770): VFY: unable to resolve new-instance 47 (Lcom/lowagie/text/Document;) in Lcom/example/p13/MainActivity;

    how to add this file and see

  20. when i checked jar file in order and export.Unable to execute dex: GC overhead limit exceeded .Conversion to Dalvik format failed: Unable to execute dex: GC overhead limit exceeded

  21. KARAN i want to know how to order the contents of the pdf in droidtext.

    Example i want to have two paragraphs and then table and then two images at the bottom.

  22. Sumit You may use this code for creating Table

    PdfPTable table = new PdfPTable(3);
    PdfPCell c1 = new PdfPCell(new Phrase(“Table Header 1”));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase(“Table Header 2”));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase(“Table Header 3”));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);

    table.addCell(“1.0”);
    table.addCell(“1.1”);
    table.addCell(“1.2”);
    table.addCell(“2.1”);
    table.addCell(“2.2”);
    table.addCell(“2.3”);

    doc.add(table);

  23. I face this type of the Error :__>
    06-16 17:20:09.302: E/PDFCreator(29417): ioException:java.io.FileNotFoundException: /storage/sdcard0/sample.pdf: open failed: EACCES (Permission denied)

    Can u tell me which version u use the Droidtext.jar ???

  24. Karan I am looking for creating a app which can read and view pdf files.Can u help me with that.
    Thanks in advance 🙂

  25. hi Karan Balkar

    I am looking for
    1.Open password protected PDF file
    2.Modify that PDF file by replacing the text or numbers only.

    Please let me know in case you have any libraries available for the same

  26. Hi,

    Does anybody know if this library supports converting HTML to PDF ? I simply need to save WebView as PDF in Android. any ideas ?

  27. Help !
    i hv followed the same code as mentioned above when i run the application in Genymotion it runs well .
    but when i installed this apk in my Android phone i dont find any folder named as “droidText/samples.pdf” not in internal storage not in External storage too.
    please help me how i know where the samples.pdf is generating?

  28. i m running this code on my pc for creating pdf file but in logcat its showing filenotfoundexception and app is not opening.

  29. Hey, droidText has been shut down and is no longer maintained. So what to do now?
    Can we continue using droidText? Or do we need to buy iTextG(Port for android by iText)

    Any idea?

  30. Hi,
    I have created pdf file of two pages from html template. I am able to place images in first pages. Now i want to place an images in second page. How can i do this ? Can anybody tell?

  31. it creates file but throwing error
    11-21 14:50:45.073: E/AndroidRuntime(3381): FATAL EXCEPTION: main
    11-21 14:50:45.073: E/AndroidRuntime(3381): Process: com.cbsinfosys.FieldWorkMobility, PID: 3381
    11-21 14:50:45.073: E/AndroidRuntime(3381): java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Color;
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfChunk.color(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfDocument.writeLineToContent(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfDocument.flushLines(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.Document.close(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.cbsinfosys.FieldWorkMobility.Pdf.createPDF(Pdf.java:115)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.cbsinfosys.FieldWorkMobility.Pdf$1.onClick(Pdf.java:45)

  32. its creating pdf but no any data inside pdf and force close and this is the print logcat error

    11-21 14:50:45.073: E/AndroidRuntime(3381): FATAL EXCEPTION: main
    11-21 14:50:45.073: E/AndroidRuntime(3381): Process: com.cbsinfosys.FieldWorkMobility, PID: 3381
    11-21 14:50:45.073: E/AndroidRuntime(3381): java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Color;
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfChunk.color(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfDocument.writeLineToContent(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfDocument.flushLines(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.lowagie.text.Document.close(Unknown Source)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.cbsinfosys.FieldWorkMobility.Pdf.createPDF(Pdf.java:115)
    11-21 14:50:45.073: E/AndroidRuntime(3381): at com.cbsinfosys.FieldWorkMobility.Pdf$1.onClick(Pdf.java:45)

  33. hi
    i have problem
    01-18 20:08:57.495 8016-8016/? E/dalvikvm: Could not find class ‘java.awt.Color’, referenced from method com.lowagie.text.Font.setColor

Leave a Reply

Your email address will not be published. Required fields are marked *