我是phantomjs的新手,并试图弄清楚它是如何工作的。我举这个例子
var page = require('webpage').create();
console.log('test');
page.open('https://github.com/', function() {
page.render('github.png');
phantom.exit();
});
放入文件并执行
./phantomjs phantomjs-2.0.0-macosx/examples/github.js
输出
test
仅此而已。我需要的是一些带有渲染页面的pdf文件。
答案 0 :(得分:0)
尝试设置viewportSize并向渲染函数添加更多细节
var northRegion = CLLocationCoordinate2DMake((locationManager.location?.coordinate.latitude)!*1.0001, (locationManager.location?.coordinate.longitude)!*1.01)
var southRegion = CLLocationCoordinate2DMake((locationManager.location?.coordinate.latitude)!*0.99, (locationManager.location?.coordinate.longitude)!*0.9999)
var bounds = GMSCoordinateBounds(coordinate: northRegion, coordinate: southRegion)
print(locationManager.location?.coordinate.latitude)
print(locationManager.location?.coordinate.longitude)
print(bounds.northEast)
print(bounds.southWest)
var filter = GMSAutocompleteFilter()
filter.type = GMSPlacesAutocompleteTypeFilter.Geocode
var yourLat = locationManager.location?.coordinate.latitude
var yourLon = locationManager.location?.coordinate.longitude
placesClient = GMSPlacesClient()
placesClient?.autocompleteQuery("[YOUR TEXTFIELD'S TEXT HERE]", bounds: bounds, filter: filter, callback: { (result, error) -> Void in
for item in result! {
print(item.attributedFullText)
}
})