I myself had to go for OpenOffice as I couldn’t find any free solution regarding this. The drawback is, your sever need to have OpenOffice installed 😦 There’s definitely a lot of proprietary libraries that allows to convert documents to PDF. Aspose.Words for .NET is a good one that I know of!
How can I convert a file to a pdf/a instead of a pdf. I know there is a “SelectPdfVersion” property for the open office API but I dont know how to use it with .Net
GREAT article man. Very well explained, not just a bunch of code. I have a question: would it be advisable to use a portable version of openoffice? I don’t like the idea of having OpenOffice (or any other office suite) actually installed on my server.
Would the source code be very different if I want to execute a portable edition of OO?
[Error]
Could not load file or assembly ‘cli_cppuhelper, Version=1.0.22.0, Culture=neutral, PublicKeyToken=ce2cb7e279207b9e’ or one of its dependencies. The system cannot find the file specified.
Hi, I keep getting the following error… System.MissingMemberException: Public member ‘getServiceManager’ on type ‘Object’ not found. at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
Thiago (@thdotnet)
6:49 pm on August 27, 2012 Permalink
| Reply
Is there a way to do the same task without install de Open Office, only working with the SDK dll’s?
This is great article. I find it more useful. But there is one thing I want to know. Is this can be applied using windows service running on ther server?
How can I set the spreadsheet or excel page scale? so i can able to see the page to fit? What I mean is I can able to see the converted pdf without missing any content of it. I tried converting excel to pdf but some of the content are cut and then some of it are place in another page. pls help. thank you in advance.
Hi, thanks for your article. But I had a problem about it. When I ran the code, it showed me an error: URL seems to be unsupported one. I thought it was happened in “PathConverter” function. The code: return String.format(“file:///{0}”, file.Replace(@”\”,”/”)), did it return a file include Url, right?
jeevan reddy
5:28 pm on December 2, 2013 Permalink
| Reply
I was able to find a low cost but excellent solution, there is nothing out there Free to convert docx to PDF
since office 2013 things have gone complicated. , I am posting this in case it is help full to someone. I am not related to this company. here is the link: http://www.gemboxsoftware.com/ . These people have unlimited server licensing. 🙂 at a low cost.
Open office will not convert Office SDK documents properly to PDF. It will convert OO documents properly
Hi,
this example rocks, well done.
We are however noticing that after about a week or two of use our app stops working and need to be restarted. any idea why Open office might be choking after a while
Munim,
this was a great article.. While the code works fine for a while, it stops working after about a week or two if you are running it as background process. It appears that this is a issue with OpenOffice.
Have you run into this and if so how did you resolve this?
StartOpenOffice() code seems weird. If ps.Length is greater than 0, it will throw “OpenOffice not found. Is OpenOffice installed?” exception. but second check has early return if process is found. Also on my machine I can find process under “soffice” without “.exe”
[…] helped us start without reading through all the documentation: .Net: Working with OpenOffice 3 and HOW TO: Convert office documents to PDF using Open Office in C#. They are more than enough to get you started. However, we were not happy with idea that every […]
Carl Cubillas 4:02 pm on May 16, 2011 Permalink |
Hi there, great article. Do you know a way to convert doc/docx to PDF without using major application such as OO or MS Word?
munim 4:40 pm on May 16, 2011 Permalink |
Hi,
I myself had to go for OpenOffice as I couldn’t find any free solution regarding this. The drawback is, your sever need to have OpenOffice installed 😦 There’s definitely a lot of proprietary libraries that allows to convert documents to PDF. Aspose.Words for .NET is a good one that I know of!
ranadheer 6:38 pm on July 21, 2011 Permalink |
hi munim
i have tried the above code but am getting the XComponent NULL can u please solve my problem….
munim 3:20 pm on July 22, 2011 Permalink |
XComponent is null when OpenOffice instance is not running. Please check your system’s security privileges and the instance is running.
Keith Cromm 1:59 am on October 26, 2011 Permalink |
This might be helpful to some in regards to getting the Open Office bin path into the environment variable,
.Net: Working with OpenOffice 3
http://blog.nkadesign.com/2008/net-working-with-openoffice-3/
Keith Cromm 2:00 am on October 26, 2011 Permalink |
This also might be helpful:
http://stackoverflow.com/questions/7685661/programmatically-convert-word-docx-tot-pdf
Convert any Office document to PDF using Open Office in C#.net « Prakash Rathod 3:58 pm on December 8, 2011 Permalink |
[…] Add below method to .cs page, Or download class from here. […]
Chris 9:16 am on December 11, 2011 Permalink |
How can I convert a file to a pdf/a instead of a pdf. I know there is a “SelectPdfVersion” property for the open office API but I dont know how to use it with .Net
Ramon 3:41 pm on March 7, 2012 Permalink |
GREAT article man. Very well explained, not just a bunch of code. I have a question: would it be advisable to use a portable version of openoffice? I don’t like the idea of having OpenOffice (or any other office suite) actually installed on my server.
Would the source code be very different if I want to execute a portable edition of OO?
Again, thanks and congrats!
David 7:27 pm on June 12, 2015 Permalink |
did you find a way to use portable version ?
Rushabh Patel 7:36 pm on April 18, 2012 Permalink |
I have a open office and open office sdk installed in my machine. but still getting error..how to use dll’s of open office ?
PASena 8:32 pm on April 23, 2012 Permalink |
[Error]
Could not load file or assembly ‘cli_cppuhelper, Version=1.0.22.0, Culture=neutral, PublicKeyToken=ce2cb7e279207b9e’ or one of its dependencies. The system cannot find the file specified.
[Web.Config]
cli_cppuhelper is registred
what am I doing wrong?
john 9:31 pm on June 12, 2012 Permalink |
Hi, I keep getting the following error… System.MissingMemberException: Public member ‘getServiceManager’ on type ‘Object’ not found. at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
Thiago (@thdotnet) 6:49 pm on August 27, 2012 Permalink |
Is there a way to do the same task without install de Open Office, only working with the SDK dll’s?
munim 1:00 pm on August 28, 2012 Permalink |
Well, I haven’t found any free solution for this. You may check this StackOverflow question for some paid solution they have provided.
kmi_4k 3:57 pm on October 21, 2013 Permalink |
This topic must help you:
http://www.oooforum.org/forum/viewtopic.phtml?t=193243
stevens 1:42 pm on October 22, 2013 Permalink |
You can convert all office documents to PDF by using Aspose .NET Component below is the link i hope it will be useful for many users:
http://www.aspose.com/.net/total-component.aspx
Jingle 9:50 am on October 24, 2013 Permalink |
Hi munim,
This is great article. I find it more useful. But there is one thing I want to know. Is this can be applied using windows service running on ther server?
Jingle 10:21 am on October 28, 2013 Permalink |
Hi there,
How can I set the spreadsheet or excel page scale? so i can able to see the page to fit? What I mean is I can able to see the converted pdf without missing any content of it. I tried converting excel to pdf but some of the content are cut and then some of it are place in another page. pls help. thank you in advance.
Richard 3:33 pm on November 5, 2013 Permalink |
Hi, thanks for your article. But I had a problem about it. When I ran the code, it showed me an error: URL seems to be unsupported one. I thought it was happened in “PathConverter” function. The code: return String.format(“file:///{0}”, file.Replace(@”\”,”/”)), did it return a file include Url, right?
jeevan reddy 5:28 pm on December 2, 2013 Permalink |
its working when i hoste in iis 7 not working
emily 3:29 pm on December 6, 2013 Permalink |
There is a C#/.NET Library available for converting word document to PDF known as Aspose.Words for .NET. Below is the link of this API you can try it:
http://www.aspose.com/.net/word-component.aspx
woolf 8:23 pm on December 17, 2013 Permalink |
Hi munim, thanks a lot. Your article saved me many hours of work.
For me, it worked all well on my development machine but after deployment
it started hanging at the ” var xLocalContext = Bootstrap.bootstrap(); ” line and not returning a response.
As for the solution, running Open Office as a Windows service on the server and using “LocalSystem” as application pool identity worked for me.
These links may be useful if anyone else has the same problem :
http://stackoverflow.com/questions/15388526/openoffice-uno-util-bootstrap-bootstrap-hangs-and-does-not-return
http://blog.a25apps.com/2009/09/29/run-openoffice-org-3-as-windows-service-updated-instructions/
Jessica 1:53 pm on June 2, 2014 Permalink |
I did everything as stated here, however for some reason it doesn’t conduct conversion. Are there some extra tips or settings that should be applied?
Anurag 12:46 pm on November 18, 2014 Permalink |
I m stuck in the while loop, not getting out. Plz reply
Amol 5:31 pm on December 27, 2014 Permalink |
reported error is:
map_to_uno (): [] com.sun.star.beans.PropertyValue] conversion failed
[map_to_uno ( ): unoidl.com.sun.star.beans.PropertyValue.Value [map_to_uno (): any] could not convert type!
Naveed 9:27 am on January 16, 2015 Permalink |
I was able to find a low cost but excellent solution, there is nothing out there Free to convert docx to PDF
since office 2013 things have gone complicated. , I am posting this in case it is help full to someone. I am not related to this company. here is the link: http://www.gemboxsoftware.com/ . These people have unlimited server licensing. 🙂 at a low cost.
Open office will not convert Office SDK documents properly to PDF. It will convert OO documents properly
Randall 9:38 am on October 3, 2015 Permalink |
Hi,
this example rocks, well done.
We are however noticing that after about a week or two of use our app stops working and need to be restarted. any idea why Open office might be choking after a while
Surya 6:33 pm on October 18, 2015 Permalink |
yes above code is working, so is any way to convert doc file to docx file ?
randall 7:47 am on October 28, 2015 Permalink |
Munim,
this was a great article.. While the code works fine for a while, it stops working after about a week or two if you are running it as background process. It appears that this is a issue with OpenOffice.
Have you run into this and if so how did you resolve this?
Ivan 4:16 pm on November 3, 2015 Permalink |
StartOpenOffice() code seems weird. If ps.Length is greater than 0, it will throw “OpenOffice not found. Is OpenOffice installed?” exception. but second check has early return if process is found. Also on my machine I can find process under “soffice” without “.exe”
Axilis | How to use Open Office for MS Office Documents Conversion to PDF 9:09 pm on November 4, 2015 Permalink |
[…] helped us start without reading through all the documentation: .Net: Working with OpenOffice 3 and HOW TO: Convert office documents to PDF using Open Office in C#. They are more than enough to get you started. However, we were not happy with idea that every […]