Can't convert pdf file to word file

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

@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.

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

sample.pdf (3.0 KB)

@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.

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

@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.

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);

@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.

We have a valid license for Aspose.Words for Android via Java and we wish to have new features with Aspose.Pdf for Android via Java.
I had two types of problems with the same starting code:
String inputPath = Environment.getExternalStorageDirectory (). GetAbsolutePath () + “/ Download / Brochure.pdf”;
String outputPath = Environment.getExternalStorageDirectory (). GetAbsolutePath () + “/ Download / converted_text_aspose.docx”;

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document (inputPath);

now, with pdfDocument.save (outputPath, com.aspose.pdf.SaveFormat.DocX);
I receive the following error:
class com.aspose.pdf.internal.ms.System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
com.aspose.pdf.ADocument.saveInternal (Unknown Source: 8)
com.aspose.pdf.Document.saveInternal (Unknown Source: 0)
com.aspose.pdf.ADocument.save (Unknown Source: 78)
com.aspose.pdf.Document.save (Unknown Source: 0)
com.example.extracttext.MainActivity.ExtractText (MainActivity.java:48)
com.example.extracttext.MainActivity.onCreate (MainActivity.java:59)
android.app.Activity.performCreate (Activity.java:7023)
android.app.Activity.performCreate (Activity.java:7014)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1215)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2734)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2859)
android.app.ActivityThread.-wrap11 (Unknown Source: 0)
android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1592)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6518)
java.lang.reflect.Method.invoke (Native Method)
com.android.internal.os.RuntimeInit $ MethodAndArgsCaller.run (RuntimeInit.java:438)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)

but with

com.aspose.pdf.DocSaveOptions saveOption = new com.aspose.pdf.DocSaveOptions ();
saveOption.setFormat (DocSaveOptions.DocFormat.DocX);
pdfDocument.save (OutputPath, saveOption);

I receive the following error:
class com.aspose.pdf.internal.ms.System.ArgumentException: Save a document to a doc format is not supported.
com.aspose.pdf.ADocument.m1 (Unknown Source: 74)
com.aspose.pdf.Document.m1 (Unknown Source: 0)
com.aspose.pdf.ADocument.save (Unknown Source: 38)
com.aspose.pdf.Document.save (Unknown Source: 0)
com.example.extracttext.MainActivity.ExtractText (MainActivity.java:41)
com.example.extracttext.MainActivity.onCreate (MainActivity.java:54)
android.app.Activity.performCreate (Activity.java:7023)
android.app.Activity.performCreate (Activity.java:7014)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1215)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2734)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2859)
android.app.ActivityThread.-wrap11 (Unknown Source: 0)
android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1592)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6518)
java.lang.reflect.Method.invoke (Native Method)
com.android.internal.os.RuntimeInit $ MethodAndArgsCaller.run (RuntimeInit.java:438)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)

I use the latest version (19.3) of Aspose.PDF
for Android via Java.
On the other hand when i run my code in a Java Application with version (19.8) of Aspose.PDF
for Java, it worked well. No issue at all.
Is there a way to use version (19.8) of Aspose.PDF
for Java in an application running in Android 8.1 device
If no, can you investigate please these issues.
Best Regards

@roro213

Would you kindly share your sample input PDF document with us. We will test the scenario in our environment and address it accordingly.

Hi Asad,
Here are two samples.
Best Regards DocumentConversion.zip (1.8 MB)

Hi,
As i said, i need that it works with version (19.3) of Aspose.PDF
for Android via Java because i’ll use it in Android app.
Version (19.8) of Aspose.PDF works fine in a Java Application but not in Android app.
If i can use (19.8) of Aspose.PDF in Android app successfully as an alternative in case Android version is not working it’ll be great.

Hi,
Is there any update regarding my request?
Best regards

@roro213

We apologize for the delayed response.

We have tested the scenario in our environment and were unable to notice the exception you have shared. However, we did notice that output DOCX file was unable to open in MS Word with an error that document was corrupted.

It seems like API is not creating correct output DOCX and we logged this issue for your both files under following ticket IDs:

  • PDFANDROID-564
  • PDFANDROID-565

We will surely look into details of these issues and keep you posted with the status of their correction. Please spare us little time.

Upcoming Aspose.PDF for Android via Java release will have latest Aspose.PDF for Java library ported into it and as soon as it is available or any update regarding resolution of logged issues is available, we will surely inform you.

We are sorry for the inconvenience faced.

Thanks for your response. Hope compatible version will be released shortly.

Could you please give us a rough estimate as to when this issue will be resolved please?
This is a significant part of many products roadmaps and decisions need to be taken weather we continue with Aspose or a competitor.

It seems this has been reported a long time ago with no update. Our company is prepared to upgrade its licenses providing this is resolved.

I hope to hear from you soon.

@Andytrax

We apologize for the inconvenience which has been faced. Please note that we resolve every logged issue and pay equal attention to each logged issue. However, issues are resolved on first come first serve basis. Nevertheless, we have recorded your concerns and will definitely consider them during issue resolution.

We have escalated the issue to next level of priority and will surely let you know as soon as we have further updates regarding resolution ETA. Please spare us little time.

We are sorry for the inconvenience.