2

I have some PDF Files in assests and i want to open the pdf files without using 3rd party apps,

I have used PDFViewer and will not render properly sometimes and also is not working on some devices.

So i found in this link https://stackoverflow.com/questions/11027719/is-there-any-library-for-viewing-pdf-in-android-app-other-than-apv

He says "If you want to have the ability to both read and write pdf files. You can consider using DroidText Droidtext It is a port of iText java library for Android.

I have personally used it and seems good!"

So how use the jar file and implement in my app?

Community
  • 1
  • 1
Goofy
  • 6,098
  • 17
  • 90
  • 156

1 Answers1

1

Did you check the "examples" package ?

http://code.google.com/p/droidtext/source/browse/trunk/droidTextTest/src/examples/com/lowagie/examples/

For integrating that library in your project, you do it like for the others :

  • Download the Jar from the project homepage.
  • Create a lib folder and put the jar there.
  • Right click on your project, and add your jar in the build path.

EDIT 1: Well, you have to create a stream :

PdfWriter.getInstance(document, new FileOutputStream("Path/to/your/document.pdf"));
document.open();

EDIT 2:

I misunderstood your question : I thought you wanted to read the PDF programmatically speaking. DroidText is not a PDF viewer.

Zakaria
  • 14,892
  • 22
  • 84
  • 125
  • yes i know how to include the jar file in the class path, but how to use that jar, i mean i have a pdf file in assests how to view that using this jar?, can you please guide me – Goofy Feb 13 '13 at 10:23
  • can you please explain me in detail, i hope you dont mind – Goofy Feb 13 '13 at 10:35
  • i have class called reader, and have included the jar file in the lib, ok now? – Goofy Feb 13 '13 at 10:37
  • yes i want to read the pdf files – Goofy Feb 13 '13 at 10:39
  • @Goofy Maybe I wasn't clear : DroidText is for reading the PDF byte by byte and is used to apply edits and other "inner" file manipulations. For viewing PDFs, you can use the stock APV. – Zakaria Feb 13 '13 at 13:04
  • can you please help me on how to implement that – Goofy Feb 13 '13 at 18:09
  • You can use intents like this : http://stackoverflow.com/a/10689094/644669 – Zakaria Feb 13 '13 at 18:32