Can't convert pdf file to word file


#1

class com.aspose.pdf.internal.ms.System.ArgumentException: Save a document to a doc format is not supported.


#2

@hardik24895

Could you please make sure that you are using code snippet as given in this example. In case issue still persists, please share your PDF document with us. We will test the scenario in our environment and address it accordingly.


#3

Document pdfDocument = new Document(SdPath + “/sample.pdf”);
pdfDocument.save(SdPath + “/sample.doc”, SaveFormat.Doc);


#4

sample.pdf (3.0 KB)


#5

@hardik24895

Thanks for sharing sample PDF.

Please use following code snippet to convert your PDF document into .doc format using Aspose.PDF for Java 19.4.

Document doc = new Document(dataDir + "sample.pdf");
DocSaveOptions saveOption = new DocSaveOptions();
saveOption.setFormat(DocSaveOptions.DocFormat.Doc);
doc.save(dataDir + "sample.doc", saveOption);

sample.zip (6.7 KB)

Attached is the output .doc file which was generated in our environment without raising any issue. In case of any further assistance, please feel free to let us know.


#6

hi is there any licence required to conversion ? because i m using free version


#7

@hardik24895

Yes, in order to perform conversion without any limitation, you need to use a valid license. In case you do not have one, you can consider applying 30-days free temporary license over our website.


#8

i have applied temporary licence but same problem plz help me

class com.aspose.pdf.internal.ms.System.ArgumentException: Save a document to a doc format is not supported. i have got this error

here is the example

License license = new License();

            InputStream inputStream = getResources().openRawResource(R.raw.license);

            try {
                license.setLicense(inputStream);
            } catch (Exception e) {
                e.printStackTrace();
            }
            Document doc = new Document(new File(selectedPath).getAbsolutePath());
            DocSaveOptions saveOption = new DocSaveOptions();
            saveOption.setFormat(DocSaveOptions.DocFormat.Doc);
            doc.save(Environment.getExternalStorageDirectory().getAbsolutePath() + "/sample.doc", saveOption);

#9

@hardik24895

Please make sure to use latest version i.e. Aspose.PDF for Java 19.5. In case issue still persists, please share a sample console application, which is able to reproduce the issue. We will test the scenario in our environment and address it accordingly.