我需要帮助将 pdf blob 打印到手机浏览器。它在普通浏览器上运行良好

问题描述 投票:0回答:0

使用 PHP,我可以将 pdf 从一个长 blob 打印到普通浏览器,但不能打印到手机。

$sql = "SELECT * FROM bus WHERE id = '$bid' ";  
$result = mysqli_query($conn, $sql) OR DIE(mysqli_error($conn));

function isMobile() 
{
  return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up.browser|up.link|webos|wos)/i", $\_SERVER\["HTTP_USER_AGENT"\]);
}  

if (isMobile())
{
  while ($row = mysqli_fetch_object($result))
  {
    header("Content-type: ".$row-\>mimetype);  
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");
    $useragent = $\_SERVER\['HTTP_USER_AGENT'\];
    header('Location: http://detectmobilebrowser.com/mobile');
    print_r($row-\>pricelist);
  }
} 
else
{
  while($row = mysqli_fetch_object($result))
  {
    header("Content-type: ".$row-\>mimetype);  
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");
    print_r($row-\>pricelist);
  }
javascript php jquery
© www.soinside.com 2019 - 2024. All rights reserved.