GCSに保存したPDFファイルをモーダル内に表示するためにGoogle\Cloud\Storage\StorageClient;
を利用
プロセスは以下になります
1.署名付きURLを取得
2.response()->file
でPDFをDL
3.取得したファイルをモーダルに表示する
現在2でエラーが出ています( GCSの署名付きURLから取得できていない)
The file "signedUrl" does not exist
一旦Storage
に保存するしか方法はないのかを含めて同様の事象に遭遇されたことがある方がいらっしゃいましたら助言をいただきたいです。
GCSから取得するロジック
$bucket = $this->utilityService->bucket; $targetObject = $bucket->object($skillSheet->other_document_path); $signedPath = $targetObject->exists() ? $targetObject->signedUrl(new \DateTime('tomorrow')) : null; $name = $targetObject->exists() ? $targetObject->name() : null; if ($signedPath && $name) { $header = [ 'Content-Type', 'application/pdf', 'Content-Disposition: inline' ]; return response()->file($signedPath, $header); }
埋め込み先
<object data="/admin/get-pdf/private/{{ $jobOffer->id }}" type="application/pdf" width="100%" height="100%"> <iframe src="/admin/get-pdf/private/{{ $jobOffer->id }}" width="100%" height="100%"> </iframe> </object>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。