PHP 서버 스크립트에 간단한 XMLHttpRequest가 있습니다. 코드 서버 스크립트의XMLHttpRequest로 큰 pdf 파일을 읽을 수 없습니다.
fxhr.onload = function (data) {
//console.log(JSON.parse(data.target.response));
var string = JSON.parse(data.target.response).data.content;
console.log(JSON.parse(data.target.response));
DEFAULT_URL = convertDataURIToBinary(string);
var config = getViewerConfiguration();
window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication.run(config);
};
fxhr.open('POST', window.location.pathname + 'content');
가 :
public function execute()
{
$productModel = new shopProductModel();
$bookModel = new shopEbooksPluginItemModel();
$item = $productModel->getByField('url', waRequest::param('product_code'));
$bookFile = $bookModel->getByField(array(
'product_id' => $item['id'],
'book_type' => waRequest::param('reader_state')
), false);
$content = @file_get_contents($this->getBookFullPath($bookFile));
$this->response = array('content' => $this->getBaseEncodedFile());
}
private function getBookFullPath($bookFileRow)
{
return $bookFileRow['file_path'] . $bookFileRow['file_name'];
}
private function getBaseEncodedFile($content)
{
return 'data:application/pdf;base64,' . base64_encode($content);
}
내가 작은 PDF 파일을 읽을려고하면 그것은 작품 좋은,하지만 난 40메가바이트 pdf 파일 서버 응답을 읽어보십시오 경우에만 "데이터가 : 응용 프로그램/PDF로; base64로 , ". file_exists가 true를 반환합니다.
'error_log'에 도움이 될만한 메시지가 있습니까? –
어쩌면 내가 시도해보십시오 –