Search code examples
titaniumtitanium-mobileappceleratorappcelerator-mobile

How to adjust the height of document viewer in IPOD using titanium?


I have PDF , to view that pdf i have used document viewer

var viewer = Ti.UI.iOS.createDocumentViewer({ url:"Barcode.pdf", height:'100%', bottom:0 }); viewer.show();

The pdf will be displayed as center, top as title bar, but bottom as empty, I am unable to set the height as 100%. I have also used Ti.UI.FILL but still no use. Can any one please share the ideas.

Thanks in Advance,

Swathi.


Solution

  • Your example is correct. The height of your viewer component is filling the height of the parent component.

    The issue you have is related to the specific pdf document you're using. I don't know which is the ratio (width/height) of your document, but if it's greater then your device screen ratio you will have something like this: documentRatio > iPhoneScreenRatio

    If you try to zoom in then the entire screen of your device will be used!

    Only in two cases the entire screen will be completely used:

    • if the document ratio is smaller then the screen ratio (try with a document with a very small width)
    • if the document has many pages

    If you are in the first case (document ratio > device screen ratio) and you want to have a well designed page then I suggest to just center the DocumentViewer instead of setting the height to 100%