小编meh*_*hdi的帖子

使用Knp Snappy生成pdf文件时出现错误字符

我正在使用Symfony2.使用此代码生成pdf文件时:

public function printAction($id)
    {
        // initialiser $demande
        $html = $this->renderView('PFETimeBundle:Demande:print.html.twig',
            array('demande'=> $demande)
        );

            return new Response(
                $this->get('knp_snappy.pdf')->getOutputFromHtml($html),
                200,
                array(
                    'Content-Type'          => 'application/pdf',
                    'Content-Disposition'   => 'attachment; filename="file.pdf"'
                )
            );
    }
Run Code Online (Sandbox Code Playgroud)

我收到这个内容(法语字符出现在坏字符中): 在此输入图像描述

php pdf pdf-generation wkhtmltopdf symfony

6
推荐指数
1
解决办法
4594
查看次数

使用IONIC 2中的Javascript API计算2点之间的距离

我想得到用户的当前位置并计算该位置与其他位置之间的距离.我正在使用本教程:在Ionic 2中使用Google地图创建附近的地方列表.这是代码:

let usersLocation;
Geolocation.getCurrentPosition().then((position) => {

   usersLocation = { lat :position.coords.latitude ,  lng : position.coords.longitude }
   locations.map((location) => {

    let placeLocation = {
      lat: location.latitude,
      lng: location.longitude
    };

    location.distance = this.getDistanceBetweenPoints(
        usersLocation,
        placeLocation,
        'miles'
    ).toFixed(2);
  });

});
Run Code Online (Sandbox Code Playgroud)

问题是:usersLocation变量未设置当前用户位置的纬度和经度.你能帮助我吗!!

google-maps-api-3 typescript ionic-framework ionic2

3
推荐指数
1
解决办法
7754
查看次数