# Admin print function - Preview/Print PDF

**URL:** <https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606>\
**Category:** Extensions\
**Tags:** troubleshooting, Setting-Up\
**Created:** [July 3, 2024, 1:54pm UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606 "2024-07-03T13:54:14Z")\
**Posts on this page:** 10\
**Page:** 1

## AI-generated summary

The issue is whether Shopify’s new admin print extension can preview/print PDF endpoints, not only HTML endpoints. Shopify staff confirmed PDF endpoints should be supported and shared a working Remix loader example returning a PDF buffer with `Content-Type: application/pdf` and `Content-disposition: inline; filename="generated.pdf"`, wrapped with CORS handling.

The original implementation also returns a base64-decoded buffer with similar headers, but the PDF preview does not render correctly in the admin dialog. Screenshots and code snippets are central to the troubleshooting.

Recent updates indicate the problem may be browser-specific: PDFs served this way are reported to work in Firefox and Edge, but Chrome blocks or fails to render them. Multiple participants confirm the issue still persists, including with the newest Admin Print API.

No resolution has been reached. The open question is why Chrome blocks the PDF in the admin print flow and whether Shopify needs to adjust the extension/API behavior or document a required endpoint structure.

<div class="post-metadata">

**Author:** ![skraloupak](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@skraloupak](https://community.shopify.com/u/skraloupak)\
**Post date:** [July 3, 2024, 1:54pm UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/1 "2024-07-03T13:54:14Z")

</div>

Hello all,

We are trying to invoke printing from the new admin print extension. We have an endpoint that is returning a PDF content and we would like to print and preview it directly in the admin dialog (same as HTML endpoint). Is it possible, or we have to preview/print only HTML endpoints?

Thank you

Jan

---

<div class="post-metadata">

**Author:** ![Liam](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/liam/32/223867_2.png) [@Liam](https://community.shopify.com/u/Liam)\
**Post date:** [July 10, 2024, 8:34am UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/2 "2024-07-10T08:34:47Z")

</div>

Hi Jan,

I’ve checked with the admin UI extensions team and PDF endpoints should be supported.

---

<div class="post-metadata">

**Author:** ![skraloupak](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@skraloupak](https://community.shopify.com/u/skraloupak)\
**Post date:** [July 10, 2024, 8:47am UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/3 "2024-07-10T08:47:49Z")

</div>

Thank you for your reply. That’s great.

I’ve tried multiple ways, but the document isn’t previewed correctly.

See anything that might be wrong?

Response data: base64

Headers:

```auto
'Content-Type', 'application/pdf'

```

```auto
'Content-disposition', 'inline; filename="xxxx.pdf"'

```

 ![screenshot 136.png](https://canada1.discourse-cdn.com/shopifyforum/original/3X/3/2/3209f94918d8c9241736347ae62e9537a1a9ad74.png)

 ![screenshot 137.png](https://canada1.discourse-cdn.com/shopifyforum/original/3X/f/c/fc75c77603bf769b64c7091625f0ca652ffd596e.png)

Thank you for letting me know 🙂

Best

Jan

---

<div class="post-metadata">

**Author:** ![skraloupak](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@skraloupak](https://community.shopify.com/u/skraloupak)\
**Post date:** [July 10, 2024, 12:52pm UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/4 "2024-07-10T12:52:19Z")

</div>

Code detail:

```javascript
ctx.res.setHeader('Content-Type', 'application/pdf');
ctx.res.setHeader('Content-disposition', 'inline; filename="' + hash + '.pdf"');
ctx.body = Buffer.from(printLabels.result, 'base64');

```

---

<div class="post-metadata">

**Author:** ![skraloupak](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@skraloupak](https://community.shopify.com/u/skraloupak)\
**Post date:** [July 23, 2024, 11:16am UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/5 "2024-07-23T11:16:07Z")

</div>

@Liam Could you please provide more details or examples on how the endpoint should be structured from the admin UI extensions team? Currently, I need help getting it to work for me.

Best

Jan

---

<div class="post-metadata">

**Author:** ![ElanaK](https://avatars.discourse-cdn.com/v4/letter/e/ed8c4c/32.png) [@ElanaK](https://community.shopify.com/u/ElanaK)\
**Post date:** [September 13, 2024, 6:16pm UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/6 "2024-09-13T18:16:16Z")

</div>

Hi @skraloupak

We came up with a simple, somewhat contrived, example so we could make our Remix app do basically the same thing that you have in your example, with the same headers and the same Base64 encoding.

We have this code working:

```javascript
import { authenticate } from "../shopify.server";
import { type LoaderFunctionArgs } from "@remix-run/node";

export async function loader({request}: LoaderFunctionArgs) {
  const {cors} = await authenticate.admin(request);

  const pdfContent = `
    %PDF-1.1
    1 0 obj
    <<
    /Type /Catalog
    /Pages 2 0 R
    >>
    endobj
    2 0 obj
    <<
    /Type /Pages
    /Kids [3 0 R]
    /Count 1
    >>
    endobj
    3 0 obj
    <<
    /Type /Page
    /Parent 2 0 R
    /MediaBox [0 0 612 792]
    /Contents 4 0 R
    >>
    endobj
    4 0 obj
    <<
    /Length 44
    >>
    stream
    BT
    /F1 24 Tf
    100 700 Td
    (Hello world!) Tj
    ET
    endstream
    endobj
    5 0 obj
    <<
    /Type /Font
    /Subtype /Type1
    /BaseFont /Helvetica
    >>
    endobj
    xref
    0 6
    0000000000 65535 f
    0000000010 00000 n
    0000000053 00000 n
    0000000101 00000 n
    0000000178 00000 n
    0000000246 00000 n
    trailer
    <<
    /Size 6
    /Root 1 0 R
    >>
    startxref
    314
    %%EOF
  `;

    const pdfBase64 = Buffer.from(pdfContent).toString('base64');
    const pdfBuffer = Buffer.from(pdfBase64, 'base64');

  return cors(new Response(pdfBuffer, {
    status: 200,
    headers: {
      'Content-Type': 'application/pdf',
      'Content-disposition': 'inline; filename="generated.pdf"'
    },
  }))
}

```

 ![Screenshot 2024-09-13 at 12.11.51 PM.png](https://canada1.discourse-cdn.com/shopifyforum/original/3X/2/4/241998937ef02019e03f4b7e5f00ee7a4fca9a4b.png)

Do you see any other errors or could something be going wrong in pdf route?

---

<div class="post-metadata">

**Author:** ![samir\_al\_anabi](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@samir\_al\_anabi](https://community.shopify.com/u/samir_al_anabi)\
**Post date:** [October 10, 2025, 5:50am UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/7 "2025-10-10T05:50:44Z")

</div>

Chrome is blocking the PDF when returning the PDF file as base64

---

<div class="post-metadata">

**Author:** ![samir\_al\_anabi](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@samir\_al\_anabi](https://community.shopify.com/u/samir_al_anabi)\
**Post date:** [October 10, 2025, 5:53am UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/8 "2025-10-10T05:53:02Z")

</div>

I have added screen. Its working on firegox and even on edge.

 ![chrome-pdf-block-issue](https://canada1.discourse-cdn.com/shopifyforum/original/4X/b/b/0/bb0386691a0ef2eae46c065a6ff78eff753c769e.png)

---

<div class="post-metadata">

**Author:** ![FifthEffect](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/fiftheffect/32/153749_2.png) [@FifthEffect](https://community.shopify.com/u/FifthEffect)\
**Post date:** [April 13, 2026, 12:16am UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/9 "2026-04-13T00:16:13Z")

</div>

Hello! We’re having this exact issue too - even using the newest Admin Print API

---

<div class="post-metadata">

**Author:** ![Christof89](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Christof89](https://community.shopify.com/u/Christof89)\
**Post date:** [June 13, 2026, 8:40am UTC](https://community.shopify.com/t/admin-print-function-preview-print-pdf/336606/10 "2026-06-13T08:40:40Z")

</div>

Hey, just confirming. This issue still persists as of today.  
When serving a PDF, the PDF is not rendered in Chrome.  
Works fine in Firefox tho.

Could someone look into this? Many thanks!
