#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    Android pdf api needed


    Hi all,
    I want to view a pdf file within my app (not using abode or etc) and the pdf is downloaded from my own server.

    i don't want to open my source code, thus cannot use some free api.

    Do you know some api that satisfy my need, free will be best!

    Thanks a lot!
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2006
    Posts
    529
    Rep Power
    58

    itext


    Hi, there is the following library that handles pdf. it's for java and c++. i think you can import the library into Android.

    itext
  4. #3
  5. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    9
    Rep Power
    0
    Public class PdfopenActivity extends Activity {
    String selectedFilePath;

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Button btnOpen=(Button)findViewById(R.id.button1);

    btnOpen.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
    // Sample.pdf is my file name it is in /Root/Download/Sample.pdf
    // path of the file

    File file = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + "/Sample.pdf");
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file),"application/pdf");
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    startActivity(intent);
    }
    });
    }
    }

    Have a glance of this code to open pdf file in your app. Android Game Developer
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    1
    Rep Power
    0
    If you want to load the pdf as text-based pdf, I think the only ones how does this are Adobe but if you just want to display the pdf as a rasterrized image, I once work on an Android image processing application that needed to open many formats including pdfs. We used a library called leadtools to do this and we were happy with it.
    If you want, take a look at it and see if it enables you to do what you want. I believe that they have a demo app you can test.

IMN logo majestic logo threadwatch logo seochat tools logo