Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CcActivity:
- package andprac.ch1;
- import net.sf.andpdf.pdfviewer.PdfViewerActivity;
- import android.app.Activity;
- import android.content.Intent;
- import android.os.Bundle;
- public class CcActivity extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- /*
- * String FILE = "C:/ss.pdf";
- file = Environment.getExternalStorageDirectory().getPath() + "myFileName.pdf";
- PdfWriter.getInstance(document, new FileOutputStream(FILE));
- */
- try
- {
- String filename = "/mnt/sdcard/sample3.pdf";
- // shortcuts.pdf it is in assets and raw folder please copy it to sdcard when you run this in device
- Intent intent = new Intent(this, MyPdfAcitivty.class);
- intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, filename);
- startActivity(intent);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- MyPdfAcitivty
- package andprac.ch1;
- import android.os.Bundle;
- import net.sf.andpdf.pdfviewer.PdfViewerActivity;
- public class MyPdfAcitivty extends PdfViewerActivity{
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- // TODO Auto-generated method stub
- super.onCreate(savedInstanceState);
- }
- public int getPreviousPageImageResource() {
- return R.drawable.left_arrow;
- }
- public int getNextPageImageResource() {
- return R.drawable.right_arrow;
- }
- public int getZoomInImageResource() {
- return R.drawable.zoom_in;
- }
- public int getZoomOutImageResource() {
- return R.drawable.zoom_out;
- }
- public int getPdfPasswordLayoutResource() {
- return R.layout.pdf_file_password;
- }
- public int getPdfPageNumberResource() {
- return R.layout.dialog_pagenumber;
- }
- public int getPdfPasswordEditField() {
- return R.id.etPassword;
- }
- public int getPdfPasswordOkButton() {
- return R.id.btOK;
- }
- public int getPdfPasswordExitButton() {
- return R.id.btExit;
- }
- public int getPdfPageNumberEditField() {
- return R.id.pagenum_edit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement