我有在表单中使用的代码,因此当我单击“打印”时,将打开“打印”对话框,并且可以打印我的表单。问题是我正在尝试格式化表格的打印版本(我希望表格打印在一页上),并且出现问题。有没有办法更改此代码,以便打印版本显示在新窗口中?我希望,如果我能看到印刷版本,可以进行CSS更改。我希望这是有道理的。这是我当前正在使用的代码:
package ...
imports ...
class MainActivity {
//Global variables
var videoBGGlobal: VideoView = VideoView(this) //this just doesn't
var mMediaPlayer: MediaPlayer? = MediaPlayer() //this works
var mCurrentVideoPosition: Int? = 0 //this works
override fun onCreate() {
var videoBG = findViewById<VideoView>(R.id.videoView) //here it //works
}
override fun onPause(){
//need to access videoBGGlobal here
}
}
我尝试更改<!--BLOCK_ID_11--><script>window['printForm']=function(selector){function _cloneCanvas(newCanvas,oldCanvas){var context=newCanvas.getContext('2d');newCanvas.width=oldCanvas.width;newCanvas.height=oldCanvas.height;context.drawImage(oldCanvas,0,0);};function _getStyles(){var r='';$(document).find('link[type*="css"],style').each(function(){r+=this.outerHTML;});return r;};function _callPrint(w){if(w&&w["printMe"]) w["printMe"]();else setTimeout(function(){_callPrint(w);},50);};try{if(typeof jQuery!='undefined'){if(typeof selector!='undefined'){var $=jQuery,f=$(selector),c,e,h,t,w,d;if(f.length){c=f.clone();c.find('script').remove();c.find('input').each(function(){e=$(this);if(typeof e.prop('checked')!='undefined') e.attr('CHECKED',e.prop('checked'));e.attr('value',e.val());});c.find('SELECT').each(function(){e=$(this);t=f.find('[id="'+e.attr('id')+'"] option:selected').text();e.replaceWith(t);});c.find('TEXTAREA').each(function(){e=$(this);t=e.val();e.replaceWith(t);});h=c[0].outerHTML;w=$('#cff_iframe_for_printing');if(w.length==0){w=$('<iframe id="cff_iframe_for_printing" name="cff_iframe_for_printing" style="display:none;"></iframe>');w.appendTo('body');} d=w[0].contentWindow.document;d.write('<body>'+_getStyles()+h+'</body>');setTimeout(function(){d.close();$(d).find('canvas').each(function(i,e){_cloneCanvas(e,f.find('canvas:eq('+i+')')[0]);});var ua=window.navigator.userAgent,msie=ua.indexOf("MSIE ");if(-1<msie){w[0].contentWindow.document.execCommand('print',false,null);}else{w[0].contentWindow.print();}},1500);}else{throw"Form's selector is incorrect";}}else{throw'Requires the selector';}}else{throw'Requires the jQuery framework';}}catch(err){if(typeof console!='undefined') console.log(err);}};</script><!--END_BLOCK_ID_11-->
的onclick
到
printForm("#cp_calculatedfieldsf_pform_1");
我可以打开一个新窗口,但是那里什么也没有
例如,当我打印表格时,我会输入名字和姓氏。在表格中它的布局使它们在同一行中,但是当我打印时,它们以列表形式(一个在另一个之上)打印。实际上,整个表格被打印为一长串。我想保留印刷表格的在线表格设计。