How to convert libreoffice ODT to PDF in bash

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
7
down vote

favorite
3












I am using libreoffice under CentOS 6. I can convert ODT files to PDF with:



libreoffice --headless --convert-to pdf *.odt
but the problem is that it only works when no document is open in libreoffice.



When I specify --env:UserInstallation=file:///path/to/some/directory
as suggested in one of the comments of this question , it doesn't help.



What am I doing wrong? It is a nuisance to close all libreoffice instances before running the before command.










share|improve this question



























    up vote
    7
    down vote

    favorite
    3












    I am using libreoffice under CentOS 6. I can convert ODT files to PDF with:



    libreoffice --headless --convert-to pdf *.odt
    but the problem is that it only works when no document is open in libreoffice.



    When I specify --env:UserInstallation=file:///path/to/some/directory
    as suggested in one of the comments of this question , it doesn't help.



    What am I doing wrong? It is a nuisance to close all libreoffice instances before running the before command.










    share|improve this question

























      up vote
      7
      down vote

      favorite
      3









      up vote
      7
      down vote

      favorite
      3






      3





      I am using libreoffice under CentOS 6. I can convert ODT files to PDF with:



      libreoffice --headless --convert-to pdf *.odt
      but the problem is that it only works when no document is open in libreoffice.



      When I specify --env:UserInstallation=file:///path/to/some/directory
      as suggested in one of the comments of this question , it doesn't help.



      What am I doing wrong? It is a nuisance to close all libreoffice instances before running the before command.










      share|improve this question















      I am using libreoffice under CentOS 6. I can convert ODT files to PDF with:



      libreoffice --headless --convert-to pdf *.odt
      but the problem is that it only works when no document is open in libreoffice.



      When I specify --env:UserInstallation=file:///path/to/some/directory
      as suggested in one of the comments of this question , it doesn't help.



      What am I doing wrong? It is a nuisance to close all libreoffice instances before running the before command.







      pdf libreoffice






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:22









      Community

      1




      1










      asked Apr 18 '15 at 12:04









      Johan

      3815




      3815




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          7
          down vote



          accepted










          That is unlikely going to work, as the suggestion in the comment is both incomplete (you cannot just specify some directory) and incorrect (--env:... should be -env:...
          Here is what I recommend you do:



          1. Stop all instances of libreoffice


          2. Start libreoffice from the commandline without specifying --headless:



            libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt


            you should replace /home/username with your home directory (and adjust .config if you don't have that on your CentOS, I did this on Ubuntu and Linux Mint). The above will create a new configuration directory for the alternate libreoffice in your .config directory, without which you would get some error about java not being found.



          3. Exit that instance of libreoffice

          4. That directory /home/username/.config/libreoffice-alt should now have been created for you.

          Now start another libreoffice from the command-line (doing so allows you to see some useful messages if things go wrong when starting the second instance), without the -env:..., and while that is still running start the conversion using:



          libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt --headless --convert-to pdf *.odt





          share|improve this answer




















          • PS I have .config as well on CentOS
            – Johan
            Apr 18 '15 at 15:22










          • Instead of stopping all instances, you can simply log in as a different user, create the .config-files and copy those to your own home dir.
            – Ole Tange
            Feb 26 at 20:21










          • On an Ubuntu 16.04 machine, I just ran libreoffice --headless --convert-to pdf <filename>.odt and it did it, without those prep steps. It did print a warning about Java tho.
            – Kyle
            Aug 31 at 23:10

















          up vote
          7
          down vote













          One possible approach is to install unoconv (if not already installed) and



          unoconv file.odt


          Please see man unoconv for details




          unoconv is a command line utility that can convert any file format that LibreOffice can import, to any file format that
          LibreOffice is capable of exporting.
          unoconv uses the LibreOffice’s UNO bindings for non-interactive conversion....




          In some platforms it is also necessary to install libreoffice-headless thanksAaron






          share|improve this answer






















          • Under CentOS7, I also had to add the package libreoffice-headless to have it automated. If the user has never used it before, the first call to unoconv fails with error 81 after creating a bunch of files in ~/.config/.
            – Aaron D. Marasco
            Feb 11 '16 at 14:32






          • 1




            @AaronD.Marasco, thank you very much for this important information! Probably there is a dependency missing in the spec file. I will add your tip to the answer.
            – JJoao
            Feb 12 '16 at 14:53






          • 1




            @JJoao, if you are a CentOS user, you should report your finding as a bug report.
            – vonbrand
            Feb 12 '16 at 19:32










          • Not a spec dependency... just a use case. The error 81 issue is supposedly fixed but I don't know what version; I guess CentOS doesn't have it yet.
            – Aaron D. Marasco
            Feb 12 '16 at 19:34

















          up vote
          0
          down vote













          why to do sso many things LibreOffice now supports odt to PDF in 2018 please see this video






          share|improve this answer








          New contributor




          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.













          • 1




            Hello and welcome to the U&L stack exchange site! Please review the Help Center to get information on how to best post to this site. To get to your post, could you please edit your post to include the relevant steps needed to complete this task instead of only linking to a video. Please see this post
            – kemotep
            yesterday










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f197063%2fhow-to-convert-libreoffice-odt-to-pdf-in-bash%23new-answer', 'question_page');

          );

          Post as a guest






























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          7
          down vote



          accepted










          That is unlikely going to work, as the suggestion in the comment is both incomplete (you cannot just specify some directory) and incorrect (--env:... should be -env:...
          Here is what I recommend you do:



          1. Stop all instances of libreoffice


          2. Start libreoffice from the commandline without specifying --headless:



            libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt


            you should replace /home/username with your home directory (and adjust .config if you don't have that on your CentOS, I did this on Ubuntu and Linux Mint). The above will create a new configuration directory for the alternate libreoffice in your .config directory, without which you would get some error about java not being found.



          3. Exit that instance of libreoffice

          4. That directory /home/username/.config/libreoffice-alt should now have been created for you.

          Now start another libreoffice from the command-line (doing so allows you to see some useful messages if things go wrong when starting the second instance), without the -env:..., and while that is still running start the conversion using:



          libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt --headless --convert-to pdf *.odt





          share|improve this answer




















          • PS I have .config as well on CentOS
            – Johan
            Apr 18 '15 at 15:22










          • Instead of stopping all instances, you can simply log in as a different user, create the .config-files and copy those to your own home dir.
            – Ole Tange
            Feb 26 at 20:21










          • On an Ubuntu 16.04 machine, I just ran libreoffice --headless --convert-to pdf <filename>.odt and it did it, without those prep steps. It did print a warning about Java tho.
            – Kyle
            Aug 31 at 23:10














          up vote
          7
          down vote



          accepted










          That is unlikely going to work, as the suggestion in the comment is both incomplete (you cannot just specify some directory) and incorrect (--env:... should be -env:...
          Here is what I recommend you do:



          1. Stop all instances of libreoffice


          2. Start libreoffice from the commandline without specifying --headless:



            libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt


            you should replace /home/username with your home directory (and adjust .config if you don't have that on your CentOS, I did this on Ubuntu and Linux Mint). The above will create a new configuration directory for the alternate libreoffice in your .config directory, without which you would get some error about java not being found.



          3. Exit that instance of libreoffice

          4. That directory /home/username/.config/libreoffice-alt should now have been created for you.

          Now start another libreoffice from the command-line (doing so allows you to see some useful messages if things go wrong when starting the second instance), without the -env:..., and while that is still running start the conversion using:



          libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt --headless --convert-to pdf *.odt





          share|improve this answer




















          • PS I have .config as well on CentOS
            – Johan
            Apr 18 '15 at 15:22










          • Instead of stopping all instances, you can simply log in as a different user, create the .config-files and copy those to your own home dir.
            – Ole Tange
            Feb 26 at 20:21










          • On an Ubuntu 16.04 machine, I just ran libreoffice --headless --convert-to pdf <filename>.odt and it did it, without those prep steps. It did print a warning about Java tho.
            – Kyle
            Aug 31 at 23:10












          up vote
          7
          down vote



          accepted







          up vote
          7
          down vote



          accepted






          That is unlikely going to work, as the suggestion in the comment is both incomplete (you cannot just specify some directory) and incorrect (--env:... should be -env:...
          Here is what I recommend you do:



          1. Stop all instances of libreoffice


          2. Start libreoffice from the commandline without specifying --headless:



            libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt


            you should replace /home/username with your home directory (and adjust .config if you don't have that on your CentOS, I did this on Ubuntu and Linux Mint). The above will create a new configuration directory for the alternate libreoffice in your .config directory, without which you would get some error about java not being found.



          3. Exit that instance of libreoffice

          4. That directory /home/username/.config/libreoffice-alt should now have been created for you.

          Now start another libreoffice from the command-line (doing so allows you to see some useful messages if things go wrong when starting the second instance), without the -env:..., and while that is still running start the conversion using:



          libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt --headless --convert-to pdf *.odt





          share|improve this answer












          That is unlikely going to work, as the suggestion in the comment is both incomplete (you cannot just specify some directory) and incorrect (--env:... should be -env:...
          Here is what I recommend you do:



          1. Stop all instances of libreoffice


          2. Start libreoffice from the commandline without specifying --headless:



            libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt


            you should replace /home/username with your home directory (and adjust .config if you don't have that on your CentOS, I did this on Ubuntu and Linux Mint). The above will create a new configuration directory for the alternate libreoffice in your .config directory, without which you would get some error about java not being found.



          3. Exit that instance of libreoffice

          4. That directory /home/username/.config/libreoffice-alt should now have been created for you.

          Now start another libreoffice from the command-line (doing so allows you to see some useful messages if things go wrong when starting the second instance), without the -env:..., and while that is still running start the conversion using:



          libreoffice -env:UserInstallation=file:///home/username/.config/libreoffice-alt --headless --convert-to pdf *.odt






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 18 '15 at 12:37









          Anthon

          59.6k17101162




          59.6k17101162











          • PS I have .config as well on CentOS
            – Johan
            Apr 18 '15 at 15:22










          • Instead of stopping all instances, you can simply log in as a different user, create the .config-files and copy those to your own home dir.
            – Ole Tange
            Feb 26 at 20:21










          • On an Ubuntu 16.04 machine, I just ran libreoffice --headless --convert-to pdf <filename>.odt and it did it, without those prep steps. It did print a warning about Java tho.
            – Kyle
            Aug 31 at 23:10
















          • PS I have .config as well on CentOS
            – Johan
            Apr 18 '15 at 15:22










          • Instead of stopping all instances, you can simply log in as a different user, create the .config-files and copy those to your own home dir.
            – Ole Tange
            Feb 26 at 20:21










          • On an Ubuntu 16.04 machine, I just ran libreoffice --headless --convert-to pdf <filename>.odt and it did it, without those prep steps. It did print a warning about Java tho.
            – Kyle
            Aug 31 at 23:10















          PS I have .config as well on CentOS
          – Johan
          Apr 18 '15 at 15:22




          PS I have .config as well on CentOS
          – Johan
          Apr 18 '15 at 15:22












          Instead of stopping all instances, you can simply log in as a different user, create the .config-files and copy those to your own home dir.
          – Ole Tange
          Feb 26 at 20:21




          Instead of stopping all instances, you can simply log in as a different user, create the .config-files and copy those to your own home dir.
          – Ole Tange
          Feb 26 at 20:21












          On an Ubuntu 16.04 machine, I just ran libreoffice --headless --convert-to pdf <filename>.odt and it did it, without those prep steps. It did print a warning about Java tho.
          – Kyle
          Aug 31 at 23:10




          On an Ubuntu 16.04 machine, I just ran libreoffice --headless --convert-to pdf <filename>.odt and it did it, without those prep steps. It did print a warning about Java tho.
          – Kyle
          Aug 31 at 23:10












          up vote
          7
          down vote













          One possible approach is to install unoconv (if not already installed) and



          unoconv file.odt


          Please see man unoconv for details




          unoconv is a command line utility that can convert any file format that LibreOffice can import, to any file format that
          LibreOffice is capable of exporting.
          unoconv uses the LibreOffice’s UNO bindings for non-interactive conversion....




          In some platforms it is also necessary to install libreoffice-headless thanksAaron






          share|improve this answer






















          • Under CentOS7, I also had to add the package libreoffice-headless to have it automated. If the user has never used it before, the first call to unoconv fails with error 81 after creating a bunch of files in ~/.config/.
            – Aaron D. Marasco
            Feb 11 '16 at 14:32






          • 1




            @AaronD.Marasco, thank you very much for this important information! Probably there is a dependency missing in the spec file. I will add your tip to the answer.
            – JJoao
            Feb 12 '16 at 14:53






          • 1




            @JJoao, if you are a CentOS user, you should report your finding as a bug report.
            – vonbrand
            Feb 12 '16 at 19:32










          • Not a spec dependency... just a use case. The error 81 issue is supposedly fixed but I don't know what version; I guess CentOS doesn't have it yet.
            – Aaron D. Marasco
            Feb 12 '16 at 19:34














          up vote
          7
          down vote













          One possible approach is to install unoconv (if not already installed) and



          unoconv file.odt


          Please see man unoconv for details




          unoconv is a command line utility that can convert any file format that LibreOffice can import, to any file format that
          LibreOffice is capable of exporting.
          unoconv uses the LibreOffice’s UNO bindings for non-interactive conversion....




          In some platforms it is also necessary to install libreoffice-headless thanksAaron






          share|improve this answer






















          • Under CentOS7, I also had to add the package libreoffice-headless to have it automated. If the user has never used it before, the first call to unoconv fails with error 81 after creating a bunch of files in ~/.config/.
            – Aaron D. Marasco
            Feb 11 '16 at 14:32






          • 1




            @AaronD.Marasco, thank you very much for this important information! Probably there is a dependency missing in the spec file. I will add your tip to the answer.
            – JJoao
            Feb 12 '16 at 14:53






          • 1




            @JJoao, if you are a CentOS user, you should report your finding as a bug report.
            – vonbrand
            Feb 12 '16 at 19:32










          • Not a spec dependency... just a use case. The error 81 issue is supposedly fixed but I don't know what version; I guess CentOS doesn't have it yet.
            – Aaron D. Marasco
            Feb 12 '16 at 19:34












          up vote
          7
          down vote










          up vote
          7
          down vote









          One possible approach is to install unoconv (if not already installed) and



          unoconv file.odt


          Please see man unoconv for details




          unoconv is a command line utility that can convert any file format that LibreOffice can import, to any file format that
          LibreOffice is capable of exporting.
          unoconv uses the LibreOffice’s UNO bindings for non-interactive conversion....




          In some platforms it is also necessary to install libreoffice-headless thanksAaron






          share|improve this answer














          One possible approach is to install unoconv (if not already installed) and



          unoconv file.odt


          Please see man unoconv for details




          unoconv is a command line utility that can convert any file format that LibreOffice can import, to any file format that
          LibreOffice is capable of exporting.
          unoconv uses the LibreOffice’s UNO bindings for non-interactive conversion....




          In some platforms it is also necessary to install libreoffice-headless thanksAaron







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 12 '16 at 14:54

























          answered Apr 18 '15 at 12:38









          JJoao

          6,9441826




          6,9441826











          • Under CentOS7, I also had to add the package libreoffice-headless to have it automated. If the user has never used it before, the first call to unoconv fails with error 81 after creating a bunch of files in ~/.config/.
            – Aaron D. Marasco
            Feb 11 '16 at 14:32






          • 1




            @AaronD.Marasco, thank you very much for this important information! Probably there is a dependency missing in the spec file. I will add your tip to the answer.
            – JJoao
            Feb 12 '16 at 14:53






          • 1




            @JJoao, if you are a CentOS user, you should report your finding as a bug report.
            – vonbrand
            Feb 12 '16 at 19:32










          • Not a spec dependency... just a use case. The error 81 issue is supposedly fixed but I don't know what version; I guess CentOS doesn't have it yet.
            – Aaron D. Marasco
            Feb 12 '16 at 19:34
















          • Under CentOS7, I also had to add the package libreoffice-headless to have it automated. If the user has never used it before, the first call to unoconv fails with error 81 after creating a bunch of files in ~/.config/.
            – Aaron D. Marasco
            Feb 11 '16 at 14:32






          • 1




            @AaronD.Marasco, thank you very much for this important information! Probably there is a dependency missing in the spec file. I will add your tip to the answer.
            – JJoao
            Feb 12 '16 at 14:53






          • 1




            @JJoao, if you are a CentOS user, you should report your finding as a bug report.
            – vonbrand
            Feb 12 '16 at 19:32










          • Not a spec dependency... just a use case. The error 81 issue is supposedly fixed but I don't know what version; I guess CentOS doesn't have it yet.
            – Aaron D. Marasco
            Feb 12 '16 at 19:34















          Under CentOS7, I also had to add the package libreoffice-headless to have it automated. If the user has never used it before, the first call to unoconv fails with error 81 after creating a bunch of files in ~/.config/.
          – Aaron D. Marasco
          Feb 11 '16 at 14:32




          Under CentOS7, I also had to add the package libreoffice-headless to have it automated. If the user has never used it before, the first call to unoconv fails with error 81 after creating a bunch of files in ~/.config/.
          – Aaron D. Marasco
          Feb 11 '16 at 14:32




          1




          1




          @AaronD.Marasco, thank you very much for this important information! Probably there is a dependency missing in the spec file. I will add your tip to the answer.
          – JJoao
          Feb 12 '16 at 14:53




          @AaronD.Marasco, thank you very much for this important information! Probably there is a dependency missing in the spec file. I will add your tip to the answer.
          – JJoao
          Feb 12 '16 at 14:53




          1




          1




          @JJoao, if you are a CentOS user, you should report your finding as a bug report.
          – vonbrand
          Feb 12 '16 at 19:32




          @JJoao, if you are a CentOS user, you should report your finding as a bug report.
          – vonbrand
          Feb 12 '16 at 19:32












          Not a spec dependency... just a use case. The error 81 issue is supposedly fixed but I don't know what version; I guess CentOS doesn't have it yet.
          – Aaron D. Marasco
          Feb 12 '16 at 19:34




          Not a spec dependency... just a use case. The error 81 issue is supposedly fixed but I don't know what version; I guess CentOS doesn't have it yet.
          – Aaron D. Marasco
          Feb 12 '16 at 19:34










          up vote
          0
          down vote













          why to do sso many things LibreOffice now supports odt to PDF in 2018 please see this video






          share|improve this answer








          New contributor




          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.













          • 1




            Hello and welcome to the U&L stack exchange site! Please review the Help Center to get information on how to best post to this site. To get to your post, could you please edit your post to include the relevant steps needed to complete this task instead of only linking to a video. Please see this post
            – kemotep
            yesterday














          up vote
          0
          down vote













          why to do sso many things LibreOffice now supports odt to PDF in 2018 please see this video






          share|improve this answer








          New contributor




          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.













          • 1




            Hello and welcome to the U&L stack exchange site! Please review the Help Center to get information on how to best post to this site. To get to your post, could you please edit your post to include the relevant steps needed to complete this task instead of only linking to a video. Please see this post
            – kemotep
            yesterday












          up vote
          0
          down vote










          up vote
          0
          down vote









          why to do sso many things LibreOffice now supports odt to PDF in 2018 please see this video






          share|improve this answer








          New contributor




          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          why to do sso many things LibreOffice now supports odt to PDF in 2018 please see this video







          share|improve this answer








          New contributor




          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered yesterday









          user42003

          11




          11




          New contributor




          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          user42003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.







          • 1




            Hello and welcome to the U&L stack exchange site! Please review the Help Center to get information on how to best post to this site. To get to your post, could you please edit your post to include the relevant steps needed to complete this task instead of only linking to a video. Please see this post
            – kemotep
            yesterday












          • 1




            Hello and welcome to the U&L stack exchange site! Please review the Help Center to get information on how to best post to this site. To get to your post, could you please edit your post to include the relevant steps needed to complete this task instead of only linking to a video. Please see this post
            – kemotep
            yesterday







          1




          1




          Hello and welcome to the U&L stack exchange site! Please review the Help Center to get information on how to best post to this site. To get to your post, could you please edit your post to include the relevant steps needed to complete this task instead of only linking to a video. Please see this post
          – kemotep
          yesterday




          Hello and welcome to the U&L stack exchange site! Please review the Help Center to get information on how to best post to this site. To get to your post, could you please edit your post to include the relevant steps needed to complete this task instead of only linking to a video. Please see this post
          – kemotep
          yesterday

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f197063%2fhow-to-convert-libreoffice-odt-to-pdf-in-bash%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?