Bug Hunting Session
Bug 67756 - LibreOffice suddenly stops exporting to PDF: "The file could not be written."
Summary: LibreOffice suddenly stops exporting to PDF: "The file could not be written."
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Mac OS X (All)
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2013-08-04 19:51 UTC by kurt.pfeifle
Modified: 2015-05-22 22:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

ODT sample file exhibiting this bug; file can successfully be exported to PDF in Apache OO. (7.24 KB, application/vnd.oasis.opendocument.text)
2013-08-04 22:54 UTC, kurt.pfeifle
Screen shot of error (22.46 KB, image/png)
2013-11-16 06:46 UTC, Kevin W. Gagel
Troubled Document (22.55 KB, application/vnd.oasis.opendocument.text)
2013-11-16 06:48 UTC, Kevin W. Gagel

Note You need to log in before you can comment on or make changes to this bug.
Description kurt.pfeifle 2013-08-04 19:51:44 UTC
OS: Mac OS X Mountain Lion,
Hardware: MacBook Pro,

I was working on rather long .odt document, from time to time exporting to PDF to check the layout.

All was working fine.

Since about 3 hours, all attempts to "Export to PDF..." fail. This is what I observe:

 1. The PDF options dialog pops up.
 2. I confirm the dialog, clicking 'Export'.
 3. The "save to" dialog pops up.
 4. I confirm the dialog, clicking 'Save'.
 5. I watch the progress bar on the bottom of the LO window moving to the right.
 6. The bar stops just before completion.
 7. A small message window pops up, saying:

       Error saving the document MyLOTestFile:
       Write Error.
       The file could not be written.


So, what have I tried to resolve the problem?

* I checked if there is still enough free space on the harddisk. Yes, there is.
* I tried to export to a different file name. No, it doesn't work.
* I tried to export to a directory on a USB thumb drive. Still no dice.
* I tried to save the .odt file under a new name. This works!
* I tried to export the newly named .odt file to PDF. No luck.
* Closed LibreOffice, restarted it again, opened .odt, exported to PDF. Same problem.
* Rebooted the Mac, started LO, opened .odt, exported to PDF. Guess what?
* Created a completely new LO writer document, typed "a", exported to PDF. Guess again?
* Opened .ods file in Calc, exported to PDF. Ok, new one: Calc also no longer exports PDFs.
(* Opened my LO .odt file in Apache OpenOffice 4.0.0. -- Yes, it opens. OH NOOOOs! It 
   doesn't show me the same layout. Let's not go there for now... {I assure you, all
   the document does use properly defined styles, but still Apache OO decided to use
   bold for MyStyle instead of regular...} -- OO however, DOES export my file to PDF!)

The weird thing is that this behavior suddenly started in the middle of my previous LO session. To the best of my knowledge, I didn't do anything which could have caused it: 
 didn't update the system, 
 didn't update LO, 
 didn't update Java, 
 didn't update other software, 
 didn't change any of my LO settings in 'Styles and Formatting'. 

I was only adding + deleting words, changing sentences, saving file, exporting to PDF.

The only fact I can say is: "My LO was working fine, but then
 _     ___         _                             _ 
| |   / _ \    ___| |_ ___  _ __  _ __   ___  __| |
| |  | | | |  / __| __/ _ \| '_ \| '_ \ / _ \/ _` |
| |__| |_| |  \__ \ || (_) | |_) | |_) |  __/ (_| |
|_____\___/   |___/\__\___/| .__/| .__/ \___|\__,_|
                           |_|   |_|               
                            _   _                _        
  _____  ___ __   ___  _ __| |_(_)_ __   __ _   | |_ ___  
 / _ \ \/ / '_ \ / _ \| '__| __| | '_ \ / _` |  | __/ _ \ 
|  __/>  <| |_) | (_) | |  | |_| | | | | (_| |  | || (_) |
 \___/_/\_\ .__/ \___/|_|   \__|_|_| |_|\__, |   \__\___/ 
          |_|                           |___/             
 ____  ____  _____        
|  _ \|  _ \|  ___|__     
| |_) | | | | |_ / __|    
|  __/| |_| |  _|\__ \  _ 
|_|   |____/|_|  |___/ (_)  (for no apparent reason)"
Comment 1 retired 2013-08-04 21:30:34 UTC
Please attach a test file. Otherwise it's impossible to confirm this bug report.

Works fine for me on OS X 10.8.4 and LO
Comment 2 retired 2013-08-04 21:31:28 UTC
After providing the file please re-set this bug to UNCONFIRMED. Thanks :)
Comment 3 kurt.pfeifle 2013-08-04 22:54:28 UTC
Created attachment 83632 [details]
ODT sample file exhibiting this bug; file can successfully be exported to PDF in Apache OO.

This is the most simple sample file exhibiting the bug. Created via:

* File->New->Text Document
* Hit "a" key
* Save file.
Comment 4 Emir Sarı (away) 2013-08-05 06:05:10 UTC
Could not reproduce with the sample file with version:
Build ID: aa5683e18de07c9e86325595ead4574efa685c3a
TinderBox: MacOSX-X86_64@43, Branch:master, Time: 2013-08-04_00:00:19 and under 10.7.5.
Comment 5 Michael 2013-08-06 17:46:28 UTC

I can't confirm it as well with on OSX 10.8.4
As the document is very minimal, is there any odt file you can successfully export to pdf with your LO install?
Please try to run LO with a new user or a clean user profile and test it again. https://wiki.documentfoundation.org/User_Profile#Mac_OS_X
Comment 6 kurt.pfeifle 2013-08-06 19:00:47 UTC
Hi Michael, thank you for your feedback.

As you can see from my original report, the problem started, and it started for no apparent reason, in the middle of an LO Writer editing session during which I had repeatedly exported to PDF and checked the results for a rather complex .odt. After the problem started, I couldn't export from LO Calc either (which I had not been opened during the Writer session). Also, restaring LO and rebooting the Mac didn't help. And testing again with the minimal .odt attached to this report didnt succeed. So no, there is no other .odt file where I succeeded to export to PDF.

I'll try your hint about running LO with a newly created user and report back the results.
Comment 7 BC Admin 2013-09-25 04:24:45 UTC
I manage an office with 30 Macs, all updated to the latest version of OSX 10.6, 10.7 or 10.8 depending on purchase date in August. Everybody was standardised with the same software in August including the initial release of Libre Office v4.1. All users are locked down with heavily managed accounts i.e. it has to be me or one of my team who makes any changes.

I have one user on OSX 10.8.4 who has exactly the same problem as this. Unfortunately, we do not know when it started as it was only reported today but has been happening for a while.

As well as what was originally tried in this bug (with the exception of OO), I have also tried the following:-

1. Check user has write permissions for the temporary folder used by LO

2. Create a fresh temp folder in the user's root directory with standard permissions and set LO to use it as the temporary directory instead.

3. Update LO to the newest release

4. Update OSX to 10.8.5

After each change, I tried to export an existing odt or docx file to PDF and also tried creating a fresh, unsaved file with LO Writer then exporting that to PDF. On every iteration, 

Error saving the document MyLOTestFile:
       Write Error.
       The file could not be written.

Will try changing with the user as was suggested below but am confirming that I have the exact same issue i.e. it does look like a bug.
Comment 8 BC Admin 2013-09-26 01:27:13 UTC
Update - tried logging in with the generic guest account we create on all our Macs (standard user managed with parental controls as well as the company profile limitations).

Was able to create a document and export it to pdf after unchecking the box saying "View pdf after export".

Logged in to the problem user account and was able to open an existing docx file and export to pdf successfully after after unchecking the box saying "View pdf after export".

Not sure whether this "View pdf after export" box is the cause or logging in as the guest user cleared something locked in Libre Office but the problem has vanished from the user machine completely. As such it may be pre-emptive to mark as resolved. Maybe Kurt could confirm whether this works?
Comment 9 kurt.pfeifle 2013-09-26 02:26:56 UTC
Thanks @Michael from comment #5. I did the following:

1. Closed LibreOffice

2. Opened Terminal.app

3. Issued the following commands:

     mv "~/Library/Application Support/libreoffice/4/user" \
        "~/Library/Application Support/libreoffice/4/user.old"

4. Restart LibreOffice, open an ODT file.

5. Export the ODT to PDF file successfully.

The restart of LibreOffice re-created a brand-new "user" directory at "~/Library/Application Support/libreoffice/4/". 

I did not (yet) try to figure out which of the files/subdirectories in "user.old" is corrupted in a way that prevents successful PDF export and triggers this weird error message.

As soon as I have more time, I'll try to find out by moving back, one by one, the subdirectories and files in "user.old" to "user" and see if this restores the corruption.

I suggest to keep this bug open until a more precise narrowing down of the cause has happened.
Comment 10 Bernhard 2013-09-26 09:04:48 UTC
For me, disabling "View pdf after export" also solves the problem, as described by BC_Admin.

Could it be that with a new account, the option is disabled by default?
Comment 11 earthsound 2013-10-22 21:27:35 UTC
Using LibreOffice on OS X 10.7.5, I can confirm that trying to export a document to PDF will fail with the error message as stated in the original post if the "View PDF after Export" option is checked.

On my machine, the default setting had that option not checked. I turned it on so that I could see the PDF immediately after export. 

After reading through this bug, I unchecked that option and it now allows export to PDF. 

With easy steps to reproduce, shouldn't this be marked as Confirmed?
Comment 12 David Strauss 2013-11-08 11:41:00 UTC
Got this on Fedora 19, too, with a Word-format docx file.

Deleting the user data fixes it:
rm -rf ~/.config/libreoffice
Comment 13 Maxim Monastirsky 2013-11-10 06:18:40 UTC
I guess that it's already fixed in master with http://cgit.freedesktop.org/libreoffice/core/commit/?id=7722a5906d8f6765395205f5074f480ad365aa19, but I don't own a Mac so I can't verify it. Would be great if someone could test it with the build from http://dev-builds.libreoffice.org/pre-releases/mac/. thanks.
Comment 14 Kevin W. Gagel 2013-11-16 06:44:37 UTC
I am also having this issue. I've removed my user profile and tried my document and it still fails. I've tried creating a new document and exporting it before editing and that works fine. But I have a one page document with a couple of frames in it and it just cannot be exported into PDF.

My OS is Windows 7 and my version of LibreOffice is I was finally able to clear the error by opening a new text document and simply copy and pasting my troubled document into the new one. I made no alterations to the new pasted document. I then saved the new document and then tried the PDF export. It worked.
Comment 15 Kevin W. Gagel 2013-11-16 06:46:38 UTC
Created attachment 89301 [details]
Screen shot of error
Comment 16 Kevin W. Gagel 2013-11-16 06:48:46 UTC
Created attachment 89302 [details]
Troubled Document

This document can not be exported as a PDF.
Comment 17 Maxim Monastirsky 2013-11-16 18:59:10 UTC
@Kevin W. Gagel: Please read the whole thread carefully. It's about the inability to export *any* document to pdf when 'View PDF after Export' option is activated. So please open a separate bug for your problem.
Comment 18 kurt.pfeifle 2013-11-16 20:46:34 UTC
@Maxim (comment 17): I'm the original reporter of the bug.

For me the problem happened independent the state of the setting for 'View PDF after Export'. It was just impossible to export *any* document (spreadsheet, text, presentation) to PDF. The message was "The file could not be written."

In my original case, it was solved by renaming this directory

     "~/Library/Application Support/libreoffice/4/user"


      "~/Library/Application Support/libreoffice/4/user.old"

and restarting LO.

Was was away from my home office for quite a while and could not really follow up. Next week, when I have some more time, I'll restore the "user.old" directory and see what happens then. If the problem returns, I'll try to narrow it down to a more specific subdirectory or file which may be at fault.
Comment 19 Peter 2014-01-21 11:12:57 UTC
I have this bug too. 

Exported from odt to pdf. 

LO Version:
Build ID: 0a0440ccc0227ad9829de5f46be37cfb6edcf72
Software  OS X 10.9.1 (13B3116)

Steps to reproduce:

New Spreadshhet
Enter text in some cell "Simple"
Save File
Export to PDF.

I have also created a work around:

Print -> Save as PDF.

subsequent exports to PDF over the same file do work properly
Comment 20 sebastian 2014-02-02 17:22:39 UTC
Hi All,

can confirm the bug, too.

For a couple of subsequent releases of LO 4.x.branch (now on the export to pdf hasn't worked for me. 
What worked once (removing LO, deleting user profile for LO, installing LO) is not reliable - the initial behaviour while exporting reappeared again.
My setup is Mac OS X 10.9.1, LO, 16 GB RAM on a Mac Book Pro 13".
Please advise.

Comment 21 Michael Regoli 2014-02-04 17:11:06 UTC
This behavior still exists when using Mac OS X Mavericks (10.9.1) running on "a "Late 2012" Mac Mini with 16gb of RAM and the latest nightly build of LibreOffice ( 

I am using File/"Export as PDF..." 

If you do not check "View PDF after Export" the PDF is created without any problem.

Comment 22 Maxim Monastirsky 2014-02-05 07:47:35 UTC
The problem of the original reporter was a corrupted user profile, see comment 18. We can't do anything about that, unless we know how to reproduce such corruption. The problem with 'View PDF after Export' is a known bug which was fixed in 4.2, see bug 68099.
Comment 23 Dale 2014-03-08 06:13:09 UTC
This happens with OpenOffice and LibreOffice on Windows XP also. Can't remember where I saw this easy fix, but here you go...

Click FORMAT, PRINT RANGES, EDIT and make sure the existing range is "entire sheet" instead of "none". What makes it flip to "none" and why does this affect writing to mass storage? Damned if I know.

On my system, I could force the maddening error by setting the print range to "none".
Comment 24 Taisuke Yamada 2015-05-22 22:38:29 UTC
> Click FORMAT, PRINT RANGES, EDIT and make sure the existing range
> is "entire sheet" instead of "none". What makes it flip to "none" and
> why does this affect writing to mass storage? Damned if I know.

Dale, tahnks for this valuable info!

I was hit by this "bug" today (I've been able to generate PDF, but it suddenly started to refuse - exactly same as reported), and removing user profile didn't fix, so I was about to give up...this fixed it. Thanks!

Since I have never played around with "print region" setting, I'm not sure what caused it to change to "none". Is there key binding or condition that changes this setting unexpectedly? That, might worth looking into as a "semi-bug".

OS: Windows 8.1
Hardware: Thinkpad X61s
Build ID: 0a0440ccc0227ad9829de5f46be37cfb6edcf72