04-07-2011 09:46 AM
if you can not modify the html then scale the content after documentLoaded
_bf2 = new BrowserField(config);
_bf2.addListener(new MyBrowserFieldListener());
class MyBrowserFieldListener extends BrowserFieldListener{
public void documentLoaded(BrowserField browserField, Document document) throws Exception {
super.documentLoaded(browserField, document);
try{
int cw = _bf2.getContentWidth();
int sw = display.getWidth();
System.out.println("loaded content width = " + cw);
// scaling
if(cw > sw){
float scalFactor = ((float)sw)/cw;
_bf2.setZoomScale(scalFactor);
_bf2.invalidate();
doPaint();
invalidate();
}
}catch(Exception e){
System.out.println("Error in scaling", e);
}
The solution work perfectly for me.