WkWebView

127 views
Skip to first unread message

Michael Lee

unread,
Dec 7, 2016, 3:11:06 PM12/7/16
to PDFTron WebViewer
Hi,

Can you please advise if you have tested iOS WkWebView.

We experience issue with iFrame origin preventing initialisation.

Thanks

Mike

Matt Parizeau

unread,
Dec 8, 2016, 7:19:40 PM12/8/16
to PDFTron WebViewer
Hi Mike,

We've tried having a WKWebView pointing to a server URL which worked. Do you have it pointing to local files inside the app and did the same code work before with a UIWebView? Do you have a sample project that you could provide that we could use to look into the issue?

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Michael Lee

unread,
Dec 12, 2016, 1:14:54 PM12/12/16
to PDFTron WebViewer
Hi Matt,

We are developing for local content and WkWebView.

Whilst we have mitigated the severe shortcomings of WkWebView through installing our own flavour of local web-server, the iFrame issue is still presenting us an issue: "Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match."

Q. Can WebViewer be instantiated without an iFrame ?!

Mike

Matt Parizeau

unread,
Dec 13, 2016, 1:48:38 PM12/13/16
to PDFTron WebViewer
Hi Mike,

You could load MobileReaderControl.html directly and use the hash parameters instead of the passing options to the WebViewer constructor. The last page of the WebViewer Developer Guide (https://www.pdftron.com/webviewer/demo/doc/WebViewer_Developer_Guide.html) talks about the different parameters you can use but I'll give a quick example.

lib/html5/MobileReaderControl.html#a=1&d=path/to/my/doc.xod&config=path/to/my/config.js&did=mydocumentid&server_url=path/to/my/serverurl

This loads the mobile viewer with annotations enabled, a document ID of mydocumentid and an initialDoc, config and serverURL as specified.

Note that for the URLs you'll want to encode them. For example in JavaScript you would use encodeURIComponent.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Michael Lee

unread,
Dec 14, 2016, 8:08:24 PM12/14/16
to PDFTron WebViewer
Hi Matt,

I found the reference at the end of that document thank you.

No encryption reference exists for this instance as it does for the object constructor approach.

I'll advise further when we advance with this, however for the interim it would be good to obtain some notes on rolling-up encryption.

Regards

Mike

Michael Lee

unread,
Dec 14, 2016, 8:08:25 PM12/14/16
to PDFTron WebViewer on behalf of Matt Parizeau
Hi Matt,

Thanks for providing your recent reference.

For the interim whilst I wait for additional lead on configuring encryption, I've been trying to instantiate WebViewer to no-avail. No error is visible in console and we see a loading animation modal.

Will update you as I progress..

Regards

Mike

--
You received this message because you are subscribed to a topic in the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pdfnet-webviewer/pJ2FDATvLno/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pdfnet-webviewer+unsubscribe@googlegroups.com.
To post to this group, send email to pdfnet-webviewer@googlegroups.com.
Visit this group at https://groups.google.com/group/pdfnet-webviewer.
For more options, visit https://groups.google.com/d/optout.

Matt Parizeau

unread,
Dec 14, 2016, 8:36:04 PM12/14/16
to PDFTron WebViewer
Hi Mike,

Would you be able to send a screenshot of the what you see in the failed load of the mobile viewer?

For encryption we don't put the document password as a query parameter because it would make it very obvious for someone looking at the URL what the password was, especially because often the mobile viewer is configured to redirect to a new window. For your app in a WebView this isn't such a big deal so you could add the password as a parameter in the URL and then make a small modification to loadDocument to use it.

The modification would be in the loadDocument function in BaseReaderControl.js. Add the following lines just before the part retriever is chosen and instantiated:

decrypt = window.CoreControls.Encryption.decrypt;
decryptOptions
= {
    type
: 'aes',
    p
: queryParams.getString('pass')
};

Then as part of your URL you would add "&pass=mydocumentpassword".


For loading a normal document in WebViewer I'm assuming you're trying to open one that isn't encrypted. It's hard to say what's going on without seeing the code so if you're able to send some sample code that might be helpful.

Thanks,

Matt Parizeau
Software Developer
PDFTron Systems Inc.

On Wednesday, December 14, 2016 at 5:08:25 PM UTC-8, Michael Lee wrote:
Hi Matt,

Thanks for providing your recent reference.

For the interim whilst I wait for additional lead on configuring encryption, I've been trying to instantiate WebViewer to no-avail. No error is visible in console and we see a loading animation modal.

Will update you as I progress..

Regards

Mike

Michael Lee

unread,
Dec 14, 2016, 8:44:56 PM12/14/16
to PDFTron WebViewer on behalf of Matt Parizeau
Awesome thanks Matt,

Inline image 1


I'm working through this now, taking our MobileReaderControl.html and pointing it to my loginlogic.nz server for the XOD.

This url presents an initialised WebViewer but no content. Within the AngularJS environment, it does not initialise however I'm sure I can overcome that, screenshot below.

Initial reaction is that no errors exist in the console.

I've also looked for a debug flag I can switch.

Q. Does a debug flag exist somewhere ?

Best regards

Mike

Inline image 2

On Thu, Dec 15, 2016 at 2:36 PM, Matt Parizeau via PDFTron WebViewer <pdfnet-webviewer+APn2wQfzwjN3K1P...@googlegroups.com> wrote:
Hi Mike,

Would you be able to send a screenshot of the what you see in the failed load of the mobile viewer?

For encryption we don't put the document password as a query parameter because it would make it very obvious for someone looking at the URL what the password was, especially because often the mobile viewer is configured to redirect to a new window. For your app in a WebView this isn't such a big deal so you could add the password as a parameter in the URL and then make a small modification to loadDocument to use it.

The modification would be in the loadDocument function in BaseReaderControl.js. Add the following lines just before the part retriever is chosen and instantiated:

decrypt = window.CoreControls.Encryption.decrypt;
decryptOptions
= {
    type
: 'aes',
    p
: queryParams.getString('pass')
};

Then as part of your URL you would add "&pass=mydocumentpassword".


For loading a normal document in WebViewer I'm assuming you're trying to open one that isn't encrypted. It's hard to say what's going on without seeing the code so if you're able to send some sample code that might be helpful.

Thanks,

Matt Parizeau
Software Developer
PDFTron Systems Inc.

On Wednesday, December 14, 2016 at 5:08:25 PM UTC-8, Michael Lee wrote:
Hi Matt,

Thanks for providing your recent reference.

For the interim whilst I wait for additional lead on configuring encryption, I've been trying to instantiate WebViewer to no-avail. No error is visible in console and we see a loading animation modal.

Will update you as I progress..

Regards

Mike

Matt Parizeau

unread,
Dec 14, 2016, 8:50:39 PM12/14/16
to PDFTron WebViewer
You'll want to use a "#" instead of a "?" before the parameters otherwise you are effectively passing it no parameters. The reason it's using a hash is because when we implemented offline mode we wanted WebViewer to work with AppCache and AppCache considers different query parameters as different URLs which caused problems with caching. If you really need to you can change this behavior by passing false into getQueryStringMap inside ControlUtils.js but by default WebViewer is expecting #.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

On Wednesday, December 14, 2016 at 5:44:56 PM UTC-8, Michael Lee wrote:
Awesome thanks Matt,

Inline image 1


I'm working through this now, taking our MobileReaderControl.html and pointing it to my loginlogic.nz server for the XOD.

This url presents an initialised WebViewer but no content. Within the AngularJS environment, it does not initialise however I'm sure I can overcome that, screenshot below.

Initial reaction is that no errors exist in the console.

I've also looked for a debug flag I can switch.

Q. Does a debug flag exist somewhere ?

Best regards

Mike

Inline image 2
On Thu, Dec 15, 2016 at 2:36 PM, Matt Parizeau via PDFTron WebViewer <pdfnet-webviewer+APn2wQfzwjN3K1PXhwB2EpteOBUOrXzBt3Iu_yTiKOGMlKG@googlegroups.com> wrote:
Hi Mike,

Would you be able to send a screenshot of the what you see in the failed load of the mobile viewer?

For encryption we don't put the document password as a query parameter because it would make it very obvious for someone looking at the URL what the password was, especially because often the mobile viewer is configured to redirect to a new window. For your app in a WebView this isn't such a big deal so you could add the password as a parameter in the URL and then make a small modification to loadDocument to use it.

The modification would be in the loadDocument function in BaseReaderControl.js. Add the following lines just before the part retriever is chosen and instantiated:

decrypt = window.CoreControls.Encryption.decrypt;
decryptOptions
= {
    type
: 'aes',
    p
: queryParams.getString('pass')
};

Then as part of your URL you would add "&pass=mydocumentpassword".


For loading a normal document in WebViewer I'm assuming you're trying to open one that isn't encrypted. It's hard to say what's going on without seeing the code so if you're able to send some sample code that might be helpful.

Thanks,

Matt Parizeau
Software Developer
PDFTron Systems Inc.

On Wednesday, December 14, 2016 at 5:08:25 PM UTC-8, Michael Lee wrote:
Hi Matt,

Thanks for providing your recent reference.

For the interim whilst I wait for additional lead on configuring encryption, I've been trying to instantiate WebViewer to no-avail. No error is visible in console and we see a loading animation modal.

Will update you as I progress..

Regards

Mike

Michael Lee

unread,
Dec 15, 2016, 12:58:59 PM12/15/16
to PDFTron WebViewer on behalf of Matt Parizeau
Progressing further with that thanks Matt. Mike

On Thu, Dec 15, 2016 at 2:50 PM, Matt Parizeau via PDFTron WebViewer <pdfnet-webviewer+APn2wQfzwjN3K1P...@googlegroups.com> wrote:
You'll want to use a "#" instead of a "?" before the parameters otherwise you are effectively passing it no parameters. The reason it's using a hash is because when we implemented offline mode we wanted WebViewer to work with AppCache and AppCache considers different query parameters as different URLs which caused problems with caching. If you really need to you can change this behavior by passing false into getQueryStringMap inside ControlUtils.js but by default WebViewer is expecting #.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

On Wednesday, December 14, 2016 at 5:44:56 PM UTC-8, Michael Lee wrote:
Awesome thanks Matt,

Inline image 1


I'm working through this now, taking our MobileReaderControl.html and pointing it to my loginlogic.nz server for the XOD.

This url presents an initialised WebViewer but no content. Within the AngularJS environment, it does not initialise however I'm sure I can overcome that, screenshot below.

Initial reaction is that no errors exist in the console.

I've also looked for a debug flag I can switch.

Q. Does a debug flag exist somewhere ?

Best regards

Mike

Inline image 2
Reply all
Reply to author
Forward
0 new messages