# Is it possible to manually set the content-type to make a pdf

**URL:** <https://zola.discourse.group/t/is-it-possible-to-manually-set-the-content-type-to-make-a-pdf/2207>\
**Category:** Uncategorized\
**Created:** [July 11, 2024, 5:07am UTC](https://zola.discourse.group/t/is-it-possible-to-manually-set-the-content-type-to-make-a-pdf/2207 "2024-07-11T05:07:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knzai](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/knzai/32/1262_2.png) [@knzai](https://zola.discourse.group/u/knzai)\
**Post date:** [July 11, 2024, 5:07am UTC](https://zola.discourse.group/t/is-it-possible-to-manually-set-the-content-type-to-make-a-pdf/2207/1 "2024-07-11T05:07:31Z")

</div>

So, originally I was using a GH Action to download a pdf export from the Google Drive apis (was going to link to the post for content, but I think my site is flagged cause I posted about a project fixing what I thought was an issue, and it was considered spammy?).

But anyway, I realized that since I’m doing a load\_data for the html version, which is nice for local testing, why not try to see if I can do it for the pdf. The docs have an svg after all.

From poking at the docs and code, I suspect the answer is “no, only these specific text content-types work” (but I missed aliases and made my own redirects, so maybe I missed something here too). I can get the data, but it’s still being wrapped in an `<html>etc` and I haven’t looked at the headers yet, but I feel like they are not gonna tell me anything I like.

Is it possible?

Repo for context: wow, I’m disallowed from posting even github for a question. Harsh.

```md
+++
title = "test"
template = "test.md"
path="resume.pdf"
content-type="application/pdf"
draft=true
[extra]
file_id = "1kIqp7dlp3ve_OZwADFs-07_ufVsyChBLz_1YKgn8ElU"
+++

```

template:

```auto
{%-set url = "https://www.googleapis.com/drive/v2/files/" ~ page.extra.file_id ~ "/export?mimeType=application/pdf&key=" ~ get_env(name="GAPI_KEY")-%}{{- load_data(url=url) | safe -}}

```

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [July 11, 2024, 11:41am UTC](https://zola.discourse.group/t/is-it-possible-to-manually-set-the-content-type-to-make-a-pdf/2207/2 "2024-07-11T11:41:25Z")

</div>

No you can’t, zola is only outputting HTML (or in some cases XML for feeds)

---

<div class="post-metadata">

**Author:** ![knzai](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/knzai/32/1262_2.png) [@knzai](https://zola.discourse.group/u/knzai)\
**Post date:** [July 11, 2024, 2:12pm UTC](https://zola.discourse.group/t/is-it-possible-to-manually-set-the-content-type-to-make-a-pdf/2207/3 "2024-07-11T14:12:36Z")

</div>

Thought not, Thanks!

… And images (image\_resize does write non text based files). 😉

It’s less "ouput pdf’ specifically than “prefetch remote assets” but I can’t figure out any other way to get it to output a file from the load\_data than running it through a template.

Well I guess I’m excited to see what you come up with for scripting or extensions so I can make a “fetch\_asset” step or a “write\_to\_file” filter for load\_data or something. 🙂

Time to figure a simple wrapper that runs a GH action through `act` before a zola serve maybe? Maybe extract the wget, test, move to a “fetch assets” shell script (that the GH deploy actions calls to avoid repetition) that I can call locally && with zola serve? Yeah that sounds cleaner (edit: and it was pretty easy to [extract](https://github.com/knzai/knzai.github.io/blob/main/fetch_assets.sh) and [call](https://github.com/knzai/knzai.github.io/blob/main/.github/workflows/main.yml)).
