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

Free Support Forum - aspose.com

PDFtoExcel sample can't run

PDFtoExcel.zip (909.7 KB)
I have convert PDFtoExcel sample to gradle version and add aspose.pdf jar(v19) to the libs dir.
But when I step over into the code:
Document doc = new Document(inputPath);

There are no any response.

public class MainActivity extends Activity {

@SuppressWarnings("static-access")
private static void PDFtoExcel()
{
	String path=Environment.getExternalStorageDirectory().getPath();
	String inputPath  = path + "/Documents/test.pdf";
	String outputPath = "/storage/emulated/0/Documents/Table_out.xlsx";
	//                    '/storage/emulated/0/Documents/my.pdf'
	// Method 1
	File file=new File(inputPath);
	if (file.exists()) {
		Document doc = new Document(inputPath);
		doc.save(outputPath, SaveFormat.Excel);
	}
	// Method 2
	ExcelSaveOptions options = new ExcelSaveOptions();
	options.setInsertBlankColumnAtFirst(false);
	options.setMinimizeTheNumberOfWorksheets(true);
	//Save document in XLSX format
	options.setFormat(ExcelSaveOptions.ExcelFormat.XLSX);

	Document pdfDocument = new Document(inputPath);
	pdfDocument.save(outputPath, options);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	PDFtoExcel();
	try
	{
	TextView tx = (TextView)findViewById(R.id.textBox);
	tx.setText("Done.");
	}catch (Exception ex){
		ex.printStackTrace();
	}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
	// Inflate the menu; this adds items to the action bar if it is present.
	getMenuInflater().inflate(R.menu.main, menu);
	return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
	// Handle action bar item clicks here. The action bar will
	// automatically handle clicks on the Home/Up button, so long
	// as you specify a parent activity in AndroidManifest.xml.
	int id = item.getItemId();
	if (id == R.id.action_settings) {
		return true;
	}
	return super.onOptionsItemSelected(item);
}

}

@sonadorje

Would you please share the complete version of the API which you are using at your side? e.g. 19.3, 19.12, etc. Also, would you kindly try using Android Studio as well and let us know in case you face any issue. Please also share the sample source PDF document which you are trying to convert. We will test the scenario in our environment and address it accordingly.

hi
I use version 19.12 in Android Studio 4.0.test.pdf (1.6 MB)
PDFtoExcel.zip (909.7 KB)
By the way, I want to use aspose.pdf in a APP which developed by delphi XE 10.4, I will order the product if these problem is resolved.

@sonadorje

We were able to notice the issue in our environment while testing the scenario with your shared file. We have logged it as PDFANDROID-603 in our issue management system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.