# Exporting Julia code as HTML or PDF

**URL:** https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340
**Category:** New to Julia
**Created:** [February 29, 2020, 10:02pm UTC](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340 "2020-02-29T22:02:02Z")
**Posts on this page:** 7
**Page:** 2

<div class="post-metadata">

### Author: ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)
#### Post date: [March 13, 2020, 12:06pm UTC](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340/21 "2020-03-13T12:06:47Z")

</div>

> **[GitHub - rofinn/FilePaths.jl: A type based approach to working with...](https://github.com/rofinn/FilePaths.jl)**
>
> A type based approach to working with filesystem paths in julia - GitHub - rofinn/FilePaths.jl: A type based approach to working with filesystem paths in julia

---

<div class="post-metadata">

### Author: ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)
#### Post date: [March 17, 2020, 4:53am UTC](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340/22 "2020-03-17T04:53:13Z")

</div>

The expected outcome is to write a pdf file with the .jl file in it.

---

<div class="post-metadata">

### Author: ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)
#### Post date: [March 17, 2020, 5:22am UTC](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340/23 "2020-03-17T05:22:44Z")

</div>

> [@brett\_knoss](#):
>
> weave(“C:/Users/brett/OneDrive/Documents/”, out\_path=C:/Users/brett/OneDrive/Documents/ECON214Assignment3.pdf, doctype=“md2pdf”)

/ = not a unary operator  
//= not a unary operator  
\ = invalid escape sequence

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [March 17, 2020, 5:32am UTC](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340/24 "2020-03-17T05:32:47Z")

</div>

You need to copy and paste exactly what you are writing in Julia and exactly what Julia “replies”. Put everything inside triple backticks at the beginning and end.

---

<div class="post-metadata">

### Author: ![magister-ludi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magister-ludi/32/4003_2.png) [@magister-ludi](https://discourse.julialang.org/u/magister-ludi)
#### Post date: [March 17, 2020, 11:48pm UTC](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340/25 "2020-03-17T23:48:24Z")

</div>

> [@brett\_knoss](#):
>
> The expected outcome is to write a pdf file with the .jl file in it.

Yes, we (I and the others who are trying to help you) got that. The title you provided for the topic was a good one, and makes it clear what you want to achieve. But you haven’t explained enough for us to understand why it isn’t working for you.

I think one of the problems is that you haven’t learned to quote code. If you wrap code, and Julia output in sets of triple backticks, like this:

````julia
```
This text won't be formatted, and is displayed exactly
the way I type it.
```

````

we will get a better picture of what you tried and what the result was.

So lets take a look at what I think isn’t working for you:

> [@brett\_knoss](#):
>
> weave(“C:/Users/brett/OneDrive/Documents/”, out\_path=C:/Users/brett/OneDrive/Documents/ECON214Assignment3.pdf, doctype=“md2pdf”)

Based on this, I think you need to read the [Weave.jl documentation](http://weavejl.mpastell.com/stable/usage/#Weave.weave-Tuple%7BAny%7D) more carefully.

1. The first argument to `weave` should be a string that represents the source file **not** a directory.
2. The `out_path` argument should be a string that represents a directory, **not** a file. The directory must exist before you run `weave`. Note that you can also use the special symbol `:doc` for this argument, so that the output lands in the same directory as the input.

What you should have used is

```julia
weave("C:/Users/brett/OneDrive/Documents/ECON214Assignment3.jl", out_path="C:/Users/brett/OneDrive/Documents", doctype="md2pdf")

```

I hope this helps.

---

<div class="post-metadata">

### Author: ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)
#### Post date: [March 18, 2020, 12:14am UTC](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340/26 "2020-03-18T00:14:20Z")

</div>

> [@brett\_knoss](#):
>
> eave(“C:/Users/brett/OneDrive/Documents/”, out\_path=C:/Users/brett/OneDrive/Documents/ECON214Assignment3.pdf, doctype=“md2pdf”)

```julia
weave("C:/Users/brett/OneDrive/Documents/", ECON214Assignment3.jl, out_path=C:/Users/brett/OneDrive/Documents/ECON214Assignment3.pdf, doctype="md2pdf")

```

the file I’m trying to weave is Econ214Assignment3.jl  
the pdf I want is to be called Econ214Assignment3.pdf

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [March 18, 2020, 12:37am UTC](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340/27 "2020-03-18T00:37:23Z")

</div>

It would be much more helpful if you could post error messages more. But more importantly, you it would be best for you to _read_ the error messages. For instance, in your `out_path`, above, you haven’t quoted your strings, which is probably going to give you an error.

[Previous page](https://discourse.julialang.org/t/exporting-julia-code-as-html-or-pdf/35340.md?page=1)
