Skip to content

Commit 34c52a5

Browse files
committed
Hide embedded PDF chrome where supported and improve iframe sizing.
Made-with: Cursor
1 parent 9b142cd commit 34c52a5

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

resources/views/training/partials/roadmap-pdf-embed.blade.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
@props([
22
'url',
33
])
4+
@php
5+
// Strip any fragment from stored URL for the "open in new tab" link.
6+
$tabUrl = \Illuminate\Support\Str::before($url, '#');
7+
// Adobe-style PDF open parameters: hide toolbar/side panes in many Chromium viewers.
8+
// Safari / iOS often ignore these; users can use "Open in new tab" for the native viewer.
9+
$embedSrc = $tabUrl.'#toolbar=0&navpanes=0&scrollbar=1&view=FitH';
10+
@endphp
411
<div class="w-full max-w-full my-6 rounded-xl overflow-hidden border border-slate-200 bg-slate-100 shadow-sm">
512
<iframe
613
title="{{ __('Roadmap (PDF)') }}"
7-
src="{{ $url }}"
8-
class="w-full border-0 block"
9-
style="height: min(75vh, 880px); min-height: 480px;"
14+
src="{{ $embedSrc }}"
15+
class="w-full border-0 block max-w-full"
16+
style="width: 100%; height: min(85dvh, 920px); min-height: min(60dvh, 520px);"
1017
loading="lazy"
18+
referrerpolicy="no-referrer-when-downgrade"
1119
></iframe>
1220
</div>
1321
<p class="text-sm mt-2 mb-0 text-[#333E48]">
14-
<a href="{{ $url }}" target="_blank" rel="noopener noreferrer" class="text-dark-blue underline font-medium">
22+
<a href="{{ $tabUrl }}" target="_blank" rel="noopener noreferrer" class="text-dark-blue underline font-medium">
1523
{{ __('Open roadmap PDF in a new tab') }}
1624
</a>
1725
{{ __('if the preview does not load in your browser.') }}

0 commit comments

Comments
 (0)