Thank you for your help, We had tried with below code
private void processExcel() {
String input = “E:\sample\9149.pdf”;
InputStream is = null;
try {
File licFile = new File(“E:\sample\GenerateExcel\src\Aspose_Total.lic”);
is = new FileInputStream(licFile);
License lic = new License();
lic.setLicense(is);
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
} finally {
try {
if (is != null)
is.close();
} catch (Exception ignored) {
}
}
try
{
Document pdfDocument = new Document(input);
ExcelSaveOptions excelsave = new ExcelSaveOptions();
pdfDocument.save("E:\\sample\\test123.xls", excelsave);
Document doc = new Document(input);
ExcelSaveOptions options1 = new ExcelSaveOptions();
options1.setFormat(ExcelSaveOptions.ExcelFormat.XLSX);
doc.save("E:\\sample\\test1.xlsx", options1);
System.out.println("end");
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
}
XLS format output was generated(attached generated output test123.xls) but it is like excel file not template format, we need excel output with given template format (like excel_template.xls attached)
and we are getting below error while executing the above code to generate xlsx format file. We are using aspose.pdf-18.6-java.jar
Exception in thread “main” java.lang.NoSuchMethodError: com.aspose.pdf.ExcelSaveOptions.setFormat(I)V
at com.javacodegeeks.example.HelloWorldApplication.processExcel(HelloWorldApplication.java:79)
at com.javacodegeeks.example.HelloWorldApplication.main(HelloWorldApplication.java:30)
Can you please provide sample code for generating an excel template file with input as a pdf or XML Files.zip (107.8 KB)
file.
Thanks,
Durga
This Topic is created by Amjad_Sahi using Email to Topic tool.
Would you please try using Aspose.PDF for Java 20.3 at your end as we tested the scenario using this version and were unable to notice the exception.
Regarding your template based requirements, we have logged an investigation ticket as PDFJAVA-39302 in our issue tracking system. We will look into details of it and keep you posted with the status of its resolution. Please be patient and spare us some time.
Hi Aspose Team,
Thank you for your help, We had tried with below code using aspose.pdf-20.3-java.jar
private void processExcel() {
String input = “E:\sample\9149.pdf”;
InputStream is = null;
try {
File licFile = new File(“E:\sample\GenerateExcel\src\Aspose_Total.lic”);
is = new FileInputStream(licFile);
License lic = new License();
lic.setLicense(is);
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
} finally {
try {
if (is != null)
is.close();
} catch (Exception ignored) {
}
}
try
{
Document pdfDocument = new Document(input);
ExcelSaveOptions excelsave = new ExcelSaveOptions();
pdfDocument.save("E:\\sample\\test123.xls", excelsave);
Document doc = new Document(input);
ExcelSaveOptions options1 = new ExcelSaveOptions();
options1.setFormat(ExcelSaveOptions.ExcelFormat.XLSX);
doc.save("E:\\sample\\test1.xlsx", options1);
System.out.println("end");
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
}
we are getting below error while executing the above code
java.lang.IllegalStateException: The subscription included in this license allows free upgrades until 22 May 2019, but this version of the product was released on 18 Mar 2020. Please renew the subscription or use a previous version of the product.
at com.aspose.pdf.l9h.lI(Unknown Source)
at com.aspose.pdf.License.setLicense(Unknown Source)
at com.javacodegeeks.example.HelloWorldApplication.processExcel(HelloWorldApplication.java:42)
at com.javacodegeeks.example.HelloWorldApplication.main(HelloWorldApplication.java:26)
Can you please provide trail license code for aspose.pdf-20.3-java.jar for generating an excel template file
Hi Aspose Team,
Thank you for your help, We got the temporary license and tried with that license now excel file was generated with xlsx format using aspose.pdf-20.3-java.jar but in this RTF template format not applied just data was copied from pdf to excel file as like XLS format. attached sample RTF and XML.Test_pdf.pdf (26.9 KB)
We need template-based excel with the input of pdf / xml / rtf file.
Can we know the status of PDFJAVA-39302 ticket.
The ticket has already been logged in our issue tracking system to investigate your requirements. The ticket is logged under the free support model and will be resolved on a first come first serve basis. We will surely inform you as soon as we have additional updates in this regard. Please spare us some time.
Thank you for your help. Could you please provide trail license for aspose-pdf-20.5.jar for checking excel template file generation with above provided jar files.
We always recommend to use the latest version as all previous fixes and enhancements are part of the latest version. You can surely get a trial license in order to test the Aspose.PDF for Java 21.8 by clicking on the share link and following the wizard.
Tried with latest version( Aspose.PDF for Java 21.8) and now also only data got copied to excel file from pdf template file but the excel file data is not displaying in a template format i.e. pdf data styles(like background color, alignments) are not displaying in excel. Could you please assist how can we achieve pdf template also along with data from pdf to excel ?
We were able to replicate the issue in our environment. Therefore, a ticket has been logged as PDFJAVA-40869 in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its resolution. Please be patient and spare us some time.
Thanks for the update. Getting one more issue as getting Java heap size issue while converting pdf template to excel template for 1lakh rows PDF input file(16MB file size) and for 50k rows(8MB) pdf input file takes 4 mins to generate excel file.
Could you please suggest how to overcome this Java heap size and generate in less time?
Thank you…
We may also need a sample source file for this case in order to test and observe the same issue in our environment. Would you please provide it so that we can further proceed to assist you accordingly.
Hi Team,
Do you get a chance to check the case PDFJAVA-40869…
If yes , could you please provide the solution …
And regarding java heap size issue while generating excel template file from pdf template file… Please find below attached pdf template file(This file generated with 50k rows and size is around 14.4mb).
We are afraid that the earlier logged ticket has not been yet resolved due to other pending issues in the queue. We will surely inform you once it is fixed. Regarding Java Heap related issue, can you please share the allocated Java Heap Size at your side and RAM size you have? Please also try increasing the Java Heap Size and see if it impacts the performance while generating Excel from PDF.
Hi Team,
Thanks for the update.
Regarding Java heap size issue, we have tested excel template file generation with pdf template file in two servers.
Please find below details of those servers…
1st server, allocated heap size is 4GB and RAM size is 15GB, in this server getting heap size issue while tested with pdf template file size is 14.4 MB and having 50K rows(previous comment related file).
And 2nd server, allocated heap size is 10GB and RAM size is 28GB and in this server with same above file(14.4MB pdf template file as input) not getting any issues and excel template file generation taken 33 mins.
In this 2nd server, tried with 22MB pdf template file(with 75K rows), in this time server got down while generating excel template file , same case tested more times but every time getting same issue.
Thanks for providing requested details. We have logged an issue as PDFJAVA-41859 in our issue tracking system to further investigate it. We will definitely look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.