{ "id": "142364", "key": "TIMOB-18329", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2018-03-09T19:36:27.000+0000", "created": "2015-01-06T21:14:49.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "document", "qe-3.5.0", "toimage" ], "versions": [ { "id": "16676", "description": "Release 3.4.1", "name": "Release 3.4.1", "archived": false, "released": true, "releaseDate": "2014-11-14" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" } ], "issuelinks": [], "assignee": null, "updated": "2018-03-09T19:36:27.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Calling .toImage() on a DocumentViewer causes an error. The documentation indicates that this is a valid method.\r\n\r\n*Steps to reproduce issue*:\r\n1. Build and launch app with below code and attached file\r\n2. Click on Launch Doc\r\n3. Wait 3 seconds\r\n4. Notice the error below\r\n\r\n*Expected Results*:\r\nA blob containing the image of the document viewer is returned\r\n\r\n*Actual Results*:\r\nThis error is thrown:\r\n{code}\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 48;\r\n[ERROR] : line = 36;\r\n[ERROR] : message = \"undefined is not a function (evaluating 'docViewer.toImage()')\";\r\n[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\";\r\n[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\";\r\n[ERROR] : }\r\n{code}\r\n\r\nUse this code to repro:\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\n\r\n// Use a NavigationWindow to create a navigation bar for the window\r\nvar navWin = Ti.UI.iOS.createNavigationWindow({\r\n\twindow : win\r\n});\r\n\r\nvar navButton = Titanium.UI.createButton({\r\n\ttitle : 'Launch'\r\n});\r\nwin.RightNavButton = navButton;\r\n\r\nvar docButton = Titanium.UI.createButton({\r\n\ttitle : 'Launch Doc',\r\n\theight : 40,\r\n\twidth : 200,\r\n\ttop : 180\r\n});\r\nwin.add(docButton);\r\n\r\n// Create a document viewer to preview a PDF file\r\nvar docViewer = Ti.UI.iOS.createDocumentViewer();\r\n// Opens the options menu and when the user clicks on 'Quick Look'\r\n// the document viewer launches with an animated transition\r\nnavButton.addEventListener('click', function() {\r\n\tdocViewer.show({\r\n\t\tview : navButton,\r\n\t\tanimated : true\r\n\t});\r\n});\r\n// The document viewer immediately launches without an animation\r\ndocButton.addEventListener('click', function() {\r\n\tdocViewer.url = 'test1.doc';\r\n\tdocViewer.show();\r\n\tsetTimeout(function(){\r\n\t\tTi.Media.saveToPhotoGallery(docViewer.toImage());\r\n\t}, 2500);\r\n});\r\n\r\nnavWin.open();\r\n{code}", "attachment": [ { "id": "53430", "filename": "test1.doc", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-01-06T21:14:49.000+0000", "size": 548864, "mimeType": "application/msword" } ], "flagged": false, "summary": "iOS: DocumentViewer.toImage() throws error", "creator": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK 3.5.0.v20150106102524 & 3.4.1.GA\r\nStudio 3.4.1.201410281743 \r\nXcode 6.1.1\r\n\r\nOn: \r\niPad mini, iOS 8.1\r\niPhone 6, iOS 8.2b3\r\niPhone 4S Sim, iOS 8.1", "comment": { "comments": [ { "id": "427482", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "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.\r\n\r\nAnyway, we can expose this if you want - let me know!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-09-01T09:15:01.000+0000", "updated": "2017-09-01T09:15:01.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }