- Posts: 5
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
How to implement a Pdf in a full view
IP: 192.168.0.71
11 years 5 months ago #7386
by narezzi
How to implement a Pdf in a full view was created by narezzi
Hello sir,
I am use a PDFSimple class but i am not show a pdf in a full view according to device screen.
my code
static Fragment mFragment;
static FragmentManager mFragmentManager;
Context mContext;
View v;
private PDFSimple m_vPDF = null;
Global.Init(getActivity());
m_vPDF = new PDFSimple(getActivity());
String val = "/sdcard/LSR_Pdf_WR/dictionary_of_networking.pdf";
showPDF(val);
private void showPDF(String val){
if( val != null )
{
m_vPDF.Close();
//to open encrypted document, modify codes below:
int ret = m_vPDF.Open(val);
switch( ret )
{
case -1://need input password
//finish();
break;
case -2://unknown encryption
//finish();
break;
case -3://damaged or invalid format
//finish();
break;
case -10://access denied or invalid file path
//finish();
break;
case 0://succeeded, and continue
break;
default://unknown error
//finish();
break;
}
}
}
and now i am using a Fragment.
I am use a PDFSimple class but i am not show a pdf in a full view according to device screen.
my code
static Fragment mFragment;
static FragmentManager mFragmentManager;
Context mContext;
View v;
private PDFSimple m_vPDF = null;
Global.Init(getActivity());
m_vPDF = new PDFSimple(getActivity());
String val = "/sdcard/LSR_Pdf_WR/dictionary_of_networking.pdf";
showPDF(val);
private void showPDF(String val){
if( val != null )
{
m_vPDF.Close();
//to open encrypted document, modify codes below:
int ret = m_vPDF.Open(val);
switch( ret )
{
case -1://need input password
//finish();
break;
case -2://unknown encryption
//finish();
break;
case -3://damaged or invalid format
//finish();
break;
case -10://access denied or invalid file path
//finish();
break;
case 0://succeeded, and continue
break;
default://unknown error
//finish();
break;
}
}
}
and now i am using a Fragment.
IP: 192.168.0.158
11 years 5 months ago #7387
by nermeen
Replied by nermeen on topic How to implement a Pdf in a full view
The PDFSimple is a very simple view, it draws the pdf page as a bitmap...(so it wont handle the gestures, tabs,...etc)
I invite you to check PDFReaderAct in the demo project...it supports different view types (Vertical, horizontal, curl, single....)...and as a view to use PDFReader instead of PDFSimple
I invite you to check PDFReaderAct in the demo project...it supports different view types (Vertical, horizontal, curl, single....)...and as a view to use PDFReader instead of PDFSimple
IP: 192.168.0.71
11 years 5 months ago #7448
by narezzi
Replied by narezzi on topic How to implement a Pdf in a full view
sir i am integrate a PDFReaderAct code into my project but issue is that it is grid layout view and how it is possible in these view only want to pass a sd card path in normal type.Means how to remove grid layout.
IP: 192.168.0.71
11 years 5 months ago #7449
by nermeen
Replied by nermeen on topic How to implement a Pdf in a full view
Sure, You can modify PDFReaderAct.onCreate, comment the part that shows the grid view and put the part that opens a pdf from path.
IP: 192.168.0.71
11 years 5 months ago #7450
by narezzi
Replied by narezzi on topic How to implement a Pdf in a full view
m_layout = (RelativeLayout)LayoutInflater.from(this).inflate(R.layout.reader, null);
m_reader = (PDFReader)m_layout.findViewById(R.id.view);
m_thumb = (PDFThumbView)m_layout.findViewById(R.id.thumbs);
//m_doc = new Document();
//m_doc.Open( pdf_path, password );
//m_reader.PDFOpen(m_doc, false, this);
//m_thumb.thumbOpen(m_doc, this);
m_vFiles = new PDFGridView(this, null);
m_vFiles.PDFSetRootPath("/mnt/sdcard/LSR_Pdf_WR/lsr-10313.pdf");///mnt");
m_vFiles.setOnItemClickListener(this);
setContentView(m_vFiles);
sir, it correct path for open a pdf, i try but i found a blank screen
m_reader = (PDFReader)m_layout.findViewById(R.id.view);
m_thumb = (PDFThumbView)m_layout.findViewById(R.id.thumbs);
//m_doc = new Document();
//m_doc.Open( pdf_path, password );
//m_reader.PDFOpen(m_doc, false, this);
//m_thumb.thumbOpen(m_doc, this);
m_vFiles = new PDFGridView(this, null);
m_vFiles.PDFSetRootPath("/mnt/sdcard/LSR_Pdf_WR/lsr-10313.pdf");///mnt");
m_vFiles.setOnItemClickListener(this);
setContentView(m_vFiles);
sir, it correct path for open a pdf, i try but i found a blank screen
Time to create page: 0.415 seconds