You are here

Doc to Pdf Converter

8 posts / 0 new
Last post
mayureshwatharkar
Offline
Last seen: 11 years 8 months ago
Joined: 2009-12-29 07:06
Doc to Pdf Converter

Hello all,
I want to convert .doc file to .pdf format using PortableOpenOffice that too programmatically. i.e. the file should get converted into pdf format on the fluy of c#.net code. I got one document from "codeproject" giving brief details to do this. Here is the link.

https://www.codeproject.com/KB/office/PortableOpenOffice.aspx

But I am getting problems in it. I have actually implemented everything from top to bottom of this page. But I am getting an exception at the c# code statement.

It will be very useful for me if someone throws more light on this. Its urgent!! Thanks in advance..

dinosoep
Offline
Last seen: 10 years 9 months ago
Joined: 2009-12-14 15:12
please, post your errors.

please, post your errors.

mayureshwatharkar
Offline
Last seen: 11 years 8 months ago
Joined: 2009-12-29 07:06
The Exception

The Exception that I am getting is "The system cannot find the file specified"...I don't understand which file it is not getting. The file that I have given as a input file is perfectly alright. It is taking the path rightfully. So the doubt is whether the class is getting the path of portable office or not. I tried changing the value="OpenOfficePortable.exe" to value= fullpath in the web.config; but without success.

-- regards,
Mayuresh

trhalvorson
Offline
Last seen: 11 years 7 months ago
Joined: 2010-01-30 07:57
Likely causes per author's article

In the article on CodeProject.com, the author points out several likely sources of error that could be your problem: 1.) long filenames (install OpenOffice Portable in a short path, best if directly off the root); 2.) OpenOffice should be in the installation folder of your application (so run it from the same short path where you install OpenOffice Portable); 3.) certain characters in path are rejected by OpenOffice Portable (so use only very common characters in it); 4.) for the example C# calling code to find your Basic macro that you create in OpenOffice Portable, to find OpenOffice Portable executable, etc. you need to correctly point your code to them (the author did it in an application configuration file with an appsettings section that he showed in the article, and you might have to modify that to fit your installation).

gluxon
gluxon's picture
Offline
Last seen: 1 year 2 weeks ago
Developer
Joined: 2008-06-21 19:26
This is a product made by

This is a product made by PortableApps.com

But OpenOffice.org, Portable or not, can convert a .doc to .pdf

Just open the .doc file in OpenOffice.org and export it to .pdf

mayureshwatharkar
Offline
Last seen: 11 years 8 months ago
Joined: 2009-12-29 07:06
I want to do it programmatically

I want to do it programmatically. As I mentioned; I want to write a c# code where Input and output filenames would be the strings given and the file will get converted into pdf format on the fly of this code...I want this to work in a web application on a server....

-- regards,
Mayuresh

John T. Haller
John T. Haller's picture
Online
Last seen: 23 min 5 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Local

The .NET code I've seen that instantiates OpenOffice.org to do things requires a LOCAL install of OpenOffice.org that is registered on the PC. OpenOffice.org Portable is not registered and, thus, does not have the appropriate objects available for .NET. Your best bet is to install OpenOffice.org and then instantiate it using the code available. If you're on a shared host where you can't install it, you may be out of luck.

Sometimes, the impossible can become possible, if you're awesome!

mayureshwatharkar
Offline
Last seen: 11 years 8 months ago
Joined: 2009-12-29 07:06
Installed OpenOffice.org

I have OpenOffice.org as well installed on my machine alongwith OpenOfficePortable.

-- regards,
Mayuresh

Log in or register to post comments