[TIMOB-18329] iOS: DocumentViewer.toImage() throws error
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2018-03-09T19:36:27.000+0000 |
Affected Version/s | Release 3.4.1, Release 3.5.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | document, qe-3.5.0, toimage |
Reporter | Eric Wieber |
Assignee | Unknown |
Created | 2015-01-06T21:14:49.000+0000 |
Updated | 2018-03-09T19:36:27.000+0000 |
Description
Calling .toImage() on a DocumentViewer causes an error. The documentation indicates that this is a valid method.
*Steps to reproduce issue*:
1. Build and launch app with below code and attached file
2. Click on Launch Doc
3. Wait 3 seconds
4. Notice the error below
*Expected Results*:
A blob containing the image of the document viewer is returned
*Actual Results*:
This error is thrown:
[ERROR] : Script Error {
[ERROR] : column = 48;
[ERROR] : line = 36;
[ERROR] : message = "undefined is not a function (evaluating 'docViewer.toImage()')";
[ERROR] : sourceURL = "file:///Users/ewieber/Library/Developer/CoreSimulator/Devices/35905601-B2DA-40C8-B7AE-4FAE55D439CA/data/Containers/Bundle/Application/C464C7E6-CD8C-4E64-8F94-27146A23AFFB/docviewer.app/app.js";
[ERROR] : stack = "file:///Users/ewieber/Library/Developer/CoreSimulator/Devices/35905601-B2DA-40C8-B7AE-4FAE55D439CA/data/Containers/Bundle/Application/C464C7E6-CD8C-4E64-8F94-27146A23AFFB/docviewer.app/app.js:36:48";
[ERROR] : }
Use this code to repro:
var win = Ti.UI.createWindow();
// Use a NavigationWindow to create a navigation bar for the window
var navWin = Ti.UI.iOS.createNavigationWindow({
window : win
});
var navButton = Titanium.UI.createButton({
title : 'Launch'
});
win.RightNavButton = navButton;
var docButton = Titanium.UI.createButton({
title : 'Launch Doc',
height : 40,
width : 200,
top : 180
});
win.add(docButton);
// Create a document viewer to preview a PDF file
var docViewer = Ti.UI.iOS.createDocumentViewer();
// Opens the options menu and when the user clicks on 'Quick Look'
// the document viewer launches with an animated transition
navButton.addEventListener('click', function() {
docViewer.show({
view : navButton,
animated : true
});
});
// The document viewer immediately launches without an animation
docButton.addEventListener('click', function() {
docViewer.url = 'test1.doc';
docViewer.show();
setTimeout(function(){
Ti.Media.saveToPhotoGallery(docViewer.toImage());
}, 2500);
});
navWin.open();
Attachments
File | Date | Size |
---|---|---|
test1.doc | 2015-01-06T21:14:49.000+0000 | 548864 |
Hey Eric, since I am currently working on other DocumentViewer-related tickets and found this one. I would mark it as invalid, since the doc-view is not a Ti.UI.View subclass and therefore does not have that API. It's rather a docs-issue where it states that it would have all the properties / methods that a Ti.UI.View has, but that's not the case. Anyway, we can expose this if you want - let me know!