phantomjs rendering
来源:互联网 发布:学生成绩管理系统c语言 编辑:程序博客网 时间:2024/06/05 14:24
http://wwwy3y3.ghost.io/pageres-phantomjs-capture-sreenshot-chinese-fonts-not-render-correctly/
在使用中文时可能出现乱码,上面的链接可能能够解决问题
var system = require( 'system' );var args = system.args;var url = args[ 1 ];var page = require( 'webpage' ).create();/** * Proper error handling */phantom.onError = function( msg, trace ) { var msgStack = [ 'PHANTOM ERROR: ' + msg ]; if ( trace && trace.length ) { msgStack.push( 'TRACE:' ); trace.forEach( function( t ) { msgStack.push( ' -> ' + ( t.file || t.sourceURL ) + ': ' + t.line + ( t.function ? ' (in function ' + t.function + ')' : '' ) ); } ); } console.error( msgStack.join('\n') ); phantom.exit( 1 );};if ( args.length === 1 ) { throw new Error( 'URL as system argument missing.' );}page.viewportSize = { height : 1000, width : 1200};page.open( url, function( status ) { console.log( '********************************************' ); console.log( 'Opened ' + url + ' with status: ' + status ); page.render( 'image-1200.png' ); console.log( 'Rendered ' + url + ' with width of 1200px' ); page.viewportSize = { height : 1000, width : 800 }; page.render( 'image-800.png' ); console.log( 'Rendered ' + url + ' with width of 800px' ); page.viewportSize = { height : 1000, width : 500 }; page.render( 'image-500.png' ); console.log( 'Rendered ' + url + ' with width of 500px' ); page.clipRect = { top: 0, left: 0, width: 500, height: 300 }; page.render( 'image-header-500.png' ); console.log( 'Rendered header of ' + url + ' with width of 500px' ); phantom.exit();} );
阅读全文
0 0
- phantomjs rendering
- phantomjs
- phantomjs
- phantomjs
- PhantomJS
- PhantomJS
- phantomjs
- phantomjs
- PhantomJS
- phantomjs
- Rendering
- Rendering
- 安装phantomjs
- python phantomjs
- 推荐 phantomjs
- phantomjs note
- phantomjs 简介
- phantomjs入门教程
- mobile webiste 中的css的font-size em及line-height等换算
- 【CUGBACM15级BC第11场 B】hdu 5055 Bob and math problem
- git internal for computer scientists
- 选择Code Style及Default Pro
- angularJS web应用SEO
- phantomjs rendering
- git多账户配置
- css中attribute selector及pseudo class
- css tips: 清除float影响,containing的div跟随floated sub等
- c++值、对象、指针、const
- CSS animation online生成工具
- angularJS articles and resources
- linux clone函数使用
- react native 持续优化篇之1 原生优化