Trouble opening docx or pptx files on Android

HI all,

I’m able to open PDF files on Android just fine, but when I try to open docx or pptx files I cannot get them to display correctly. I have used the same files with the sample code, so I know they can be opened by the SDK. I am using PDFViewCtrl’s openUniversalDocument method. I am subscribed as a UniversalDocumentConversionListener and DocumentLoadListener. I see the conversion events all the way up to success and have verified that the DocumentConverter also returns success when I query its status.

I’ve also initialized the PDFNet instance with the pdfnet.res file and have the code copying the plugin files to a temporary directory and set the path with PDFNet.addResourceSearchPath.

The strange thing is that I never get the onDocumentLoaded call.

I’ve combed through the CompleteReader example for Android as it calls both the conversion events and the onDocumentLoaded event but I’ve not been able to determine what it might be doing that I am not. Right now I’m just trying to do a basic open and display of the docx or pptx files so I don’t want to just add in all the sample code without understanding it. Is there some other call that I am missing or should this be enough to do a simple viewing of a non-pdf document? I’ve attached what code I have so far. Its a React Native wrapper for the PDFNet component so it won’t run directly but it should be enough to show what I might be missing.

Thanks,
Steve

OPIPdfNetView.java (6.69 KB)

OPIPdfNetViewManager.java (3.91 KB)

Utils.java (4.07 KB)

Hmm, it looks like its something in the way I’m trying to implement it for React Native. If I do something like toggle the view inspector, then the onDocumentLoaded fires and the document is displayed. I’m somehow setting things so that its not getting to run to completion.

I managed to solve the problem and get a full conversion, however on some pretty straight forward PPTX files the conversion doesn’t seem to honor the view size even though I specify the page view mode as PAGE_VIEW_FIT_PAGE. I’ve attached a screen shot showing the issue. Any ideas as to what is happening to cause this?

screenshot-2017-09-20_14.14.14.369.png

I managed to solve the problem and get a full conversion

Glad to hear. If you have some idea of what the solution was for React Native, feel free to share here in case anyone else runs into the issue.

As for the latest question, if this is file specific, which it sounds like it is, can you post here, or send to support, one of these PPTX files.

Thanks!

I’ve sent in the PPTX file to be looked at. To make the conversion work at all I had to use the tryConvert() method of the DocumentConversion class rather than the event callback interface. Here’s what I have right now, but it does have the PPTX conversion issue mentioned above.

Constants.java (332 Bytes)

OPIPdfNetView.java (6.14 KB)

OPIPdfNetViewManager.java (3.91 KB)

Utils.java (4.07 KB)

Hello Steve,

Sorry for the delay in a response.

There is a fully functional Fragment provided in PDFViewCtrlTools project that allows universal conversion streaming. See PDFViewCtrlTabFragment.java.

Relavent methods:
openOfficeDoc
onConversionEvent

Did you try using this? Does the issue still occur using it?

Hi Ryan,

It did still do it. I sent in the file that was causing issues and a newer release is supposed to contain the fixes for converting it correctly.

Thanks!
Steve