# LaTeX can't generate PDF

I'm writing my thesis right now using LaTex. Yesterday everything was normal but today, when I run LaTeX I get the error message ' ! I can't write on file 'Filename.pdf'. '

It is definitely not a problem of the code, because I get this error even if I just use a premade template when starting a new document. The Problem also occurs, when I start a new .tex file, so the PDF file I want to generate can't be locked or anything since it doesn't exist.

I have tried Texmaker and TeXnicCenter and they both give me this error message. I also uninstalled an re-installed MiKTeX and restarted Windows. Nothing changed.

Since I saw in a couple of threads where people added their log file to their questions, when researching for this problem, I add mine as well:

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 21.1) (preloaded format=pdflatex 2021.2.11)  12 FEB 2021 13:30
entering extended mode
**./LaTeX1.tex
(LaTeX1.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-06> xparse <2020-03-03>
(C:\Users\Sascha\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(C:\Users\Sascha\AppData\Local\Programs\MiKTeX\tex/latex/base\size10.clo
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
)
\c@part=\count177
\c@section=\count178
\c@subsection=\count179
\c@subsubsection=\count180
\c@paragraph=\count181
\c@subparagraph=\count182
\c@figure=\count183
\c@table=\count184
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
(C:\Users\Sascha\AppData\Local\Programs\MiKTeX\tex/latex/base\inputenc.sty
Package: inputenc 2020/08/01 v1.3d Input encoding file
\inpenc@prehook=\toks15
\inpenc@posthook=\toks16
)
(C:\Users\Sascha\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-pd
ftex.def
File: l3backend-pdftex.def 2021-02-06 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count185
\l__pdf_internal_box=\box47
) (LaTeX1.aux)
\openout1 = LaTeX1.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <12> on input line 10.
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <8> on input line 10.
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <6> on input line 10.

! I can't write on file LaTeX1.pdf'.
Please type another file name for output
! Emergency stop.
<argument> ...shipout:D \box_use:N \l_shipout_box

l.14 \end{document}

*** (job aborted, file error in nonstop mode)

Here is how much of TeX's memory you used:
452 strings out of 479616
8336 string characters out of 2864526
277496 words of memory out of 3000000
17699 multiletter control sequences out of 15000+200000
407070 words of font info for 39 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
44i,6n,50p,154b,189s stack positions out of 5000i,500n,10000p,200000b,50000s
!  ==> Fatal error occurred, no output PDF file produced!
`
• typically that happens if something blocks the pdf, the adobe reader can do this, also the pdf preview in the windows explorer. Overeager security protection can be a reason too. – Ulrike Fischer Feb 12 at 13:17
• in your question you say the error is that it could not write to filename.tex the log shows a very different error can't write to filename.pdf – David Carlisle Feb 12 at 13:26
• @DavidCarlisle thank you for pointing that mistake out. I corrected it. Do you have any clue, how to solve that problem? – crevez Feb 12 at 13:41
• it matters as not being able to write the tex file would be a file permissions error, but not being able to write the pdf usually means it is open in acrobat or another pdf reader that holds the file open and prevents write access. – David Carlisle Feb 12 at 13:43
• You're right. But like I said, I get this error even when I don't have a pdf reader opened. I always get it, even when the pdf file can't possibly exist. – crevez Feb 12 at 13:52