We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to convert from doc to pdf

I m using

code......

public class DOCToPDF { public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getDataDir(DOCToPDF.class); // Instantiate PDF object Pdf pdf1 = new Pdf(); // bind the source PCL file with Pdf object pdf1.bindPCL(dataDir + "letterlegal5.doc"); // save the resultant PDF document pdf1.save(dataDir + "converted.pdf"); System.out.println("PCL to PDF conversion performed successfully!"); } }

it giving :-Error: Could not find or load main class com.aspose.pdf.examples.asposepdf.conversion.DOCToPDF


Could u help me.how to convert doc to pdf file.




Hi there,

Thanks for your inquiry. Please read following article about converting Word document to Pdf.
http://www.aspose.com/docs/display/wordsjava/How+to++Convert+a+Document+to+PDF

Please let us know if you have any more queries.

Hi

Your link is too short.Please check in my queries and embed your code and rectify this.

Thanks
Ganesh kumar sharma
TrilaSoft Solutions Pvt Ltd.

Hi there,

Thanks for your inquiry. If you want to convert MS Word document to Pdf, you need to use Aspose.Words for Java. Please check following code example of Aspose.Words for Java to convert Word document to Pdf.

com.aspose.words.Document doc = new com.aspose.words.Document(MyDir + "Document.doc");

doc.save(MyDir + "Document.Doc2PdfSave Out.pdf");

//Instantiate LoadOption object using PCL load option

com.aspose.pdf.PclLoadOptions loadoptions = new com.aspose.pdf.PclLoadOptions();

//Create Document object

com.aspose.pdf.Document doc = new com.aspose.pdf.Document(MyDir + "in.pcl",loadoptions);

//Save the resultant PDF document

doc.save(MyDir + "Output.pdf");



Hope this helps you. If you still face problem, please share some more detail about your requirements. We will then provide you more information about your query along with code.

Hi Manzoor
I am using your code but some problem has been occurred.Could you give me com.aspose.words class code.so I can easily used.

Please check this Url for 472284 in reply to 395305:-
Error trying to save a .doc to a pdf file
I have showing same Exception.Like this.
Exception in thread “main” class com.aspose.pdf.exceptions.InvalidPdfFileFormatException: Startxref not found


Hi there,

Thanks for your inquiry. Could you please share some detail about your requirement what exact you want to achieve using Aspose.Words and/or Aspose.Pdf? We will then provide you more information about your query along with code.

Please note that com.aspose.words.Document is used for Word Document and com.aspose.pdf.Document is used for Pdf Document.

I have word doc and I want to convert pdf file from doc file.Please if you have code then please share with me asap.

Hi there,

Thanks for sharing the detail. Please download latest version of Aspose.Words for Java 15.9.0 from here:
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/entry661990.aspx

Please use following code example to convert Word document to Pdf.

com.aspose.words.Document doc = new com.aspose.words.Document(MyDir + "input.docx");

doc.save(MyDir + "Out.pdf");


Please let us know if you have any more queries.

Hi Manzoor

you have already given code for that:-

com.aspose.words.Document doc = new com.aspose.words.Document(MyDir + “input.docx”);

doc.save(MyDir + "Out.pdf");


But I want to whole class code.How to use this code in class.


Hi there,

Thanks for your inquiry. Please note that Aspose.Words for Java
is a class library and with it you can programmatically generate,
modify, convert, render and print documents without utilizing Microsoft
Word®. The code of Aspose.Words APIs is not public/open source.

You can download Aspose.Words Jar file from here and use it in your application. Please read about Aspose.Words documentation from here:
http://www.aspose.com/docs/display/wordsjava/Home

Hi Manzoor
Thanks It is working.Could you Elaborate How much charges for paid.

Hi there,

Thanks for your inquiry. Please read about pricing information from here:
http://www.aspose.com/purchase/pricing-info-step-1-of-4.aspx

If you have any further query about purchasing license, please post your query in Aspose.Purchase forum.