Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Development and suggestions about third part tool integration.
Cordova, Xamarin, Basic4Android topics are listed here.
  • Page:
  • 1
  • 2

TOPIC:

Xamarin android - missing binding for PDFReader 6 years 10 months ago #12433

  • petcha
  • petcha's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
  • Thank you received: 0
Hi,

I'm trying to implement the PDFReader in a xamarin android project.
However I cannot find a reference to the PDFReader class anywhere in the lib.
Does the C# binding to the PDFReader in the java lib still need to implemented?
Or is there another way of achieving the same?

Thank you

Please Log in or Create an account to join the conversation.

Xamarin android - missing binding for PDFReader 6 years 10 months ago #12435

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
PDFReader is deprecated since version 3.9 (has limits for performance and memory usage), we recommend to use PDFLayout instead.

For a guide, you can check:

Please Log in or Create an account to join the conversation.

Xamarin android - missing binding for PDFReader 6 years 10 months ago #12437

  • petcha
  • petcha's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
  • Thank you received: 0
Thank you for quick response.

I have tried the RadaeePDFManager.Show() method, but that creates a new activity.
My requirement is to access the reader's View in order to display it within a fragment view.

I have also tried to use the PDFLayoutView class, from which I was able to set as the fragment's View, but the pdf displays as blank white pages.

Please Log in or Create an account to join the conversation.

Xamarin android - missing binding for PDFReader 6 years 10 months ago #12438

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Using PDFLayoutView should be the correct way.
Can you share how extactly are you including it, to check why you see blank pages?

Please Log in or Create an account to join the conversation.

Xamarin android - missing binding for PDFReader 6 years 10 months ago #12439

  • petcha
  • petcha's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
  • Thank you received: 0
In the fragment's OnResume method I open the file from internal storage with PDFFileStream.

the variables for is_open, size, result_open, all indicate that the file was successfully loaded.

public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
    pdfLayoutView = new PDFLayoutView(Context);
    return pdfLayoutView;
}

public override void OnResume()
{
    base.OnResume();
    var path = "/data/user/0/com.myproject.android/files/1/Documents/TestDoc.pdf"
    showDocument(path);
}

public void showDocument(string path)
{
    Global.Init(Context);

    PDFFileStream fileStream = new PDFFileStream();
    bool is_open = fileStream.Open(path);
    int size = fileStream.Get_size();

    Document pdfDoc = new Document();
    int result_open = pdfDoc.OpenStream(fileStream, "");
    bool result_cache = pdfDoc.SetCache(Global.TmpPath + "/temp.dat");

    pdfLayoutView.PDFOpen(pdfDoc, this);
}

Please Log in or Create an account to join the conversation.

Xamarin android - missing binding for PDFReader 6 years 10 months ago #12444

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
We have tried your same code, and the pdf if rendered correctly.

Can you try with different documents? also from sdcard?
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by nermeen.
  • Page:
  • 1
  • 2
Powered by Kunena Forum