Wkhtmltopdf
으로 생성 된 내 pdf
파일의 방향을 어떻게 바꿀 수 있습니까? 나는 다음과 같이 PHP에서 호출 :wkhtmltopdf를 사용하여 가로 방향 설정
$file = fopen("tmp/html/pdfTmp_$numRand.html",
"w") or exit("Unable to open file!");
fwrite($file, $html);
fclose($file);
exec("..\library\wkhtmltopdf\wkhtmltopdf " .
"tmp/html/pdfTmp_$numRand.html tmp/pdf/pdfTmp_$numRand.pdf");
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename=".$nom."_".$residence.".pdf");
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize("tmp/pdf/pdfTmp_$numRand.pdf"));
ob_clean();
flush();
readfile("tmp/pdf/pdfTmp_$numRand.pdf");
$html
는 HTML에서 내 모든 페이지를 포함,이 임시 파일을 엽니 다.
이렇게하면 세로 방향으로 .pdf
이 생성됩니다. 나는 wkhtlktopdf가 방향을 바꾸기 위해 -O landscape
옵션을 가지고 있지만, 내가 어디에서 어떻게 PHP PHP 스크립트로 이것을 작성할 수 있는지 알지 못한다. Windows 7을 사용하고 있습니다.
wkhtmltopdf 명령 바로 다음에 두 개의 플래그'-O landscape'를 전달합니다. 예 :'wkhtmltopdf -O landscape foobar.html foobar.pdf' –