Thursday, December 26, 2013

Retrieve SQL Connection Data & Print Desired Number of Pages in Android Apps

What’s new in this release?

The long awaited version of Aspose.Cells for Java 7.7.0 has been released. In this release, we have added a feature that lets you retrieve external data source details. Sometimes, you may want to retrieve details from external data sources, for example if you want to read the SQL connection data. This may include any or all type of data that is required to establish a connection with an SQL Server, such as the server URL, user name, underlying table name, SQL query, query type, the location of the table, etc. In the new version, you can limit the number of pages generated in Excel to PDF conversion. You can print a range of pages to the output PDF file using this new feature. Aspose.Cells allows you to set a limit on how many pages are generated when converting a Microsoft Excel spreadsheet to PDF file format. We have also added a number of enhancements in the new release. We have improved the chart to image and sheet to image modules. This release is also a maintenance release that contains fixes for issues reported in earlier versions. In this release, we have fixed the issues with manipulating charts and shapes. Several other important issues have also been addressed. For example, issues to do with rendering Microsoft Excel file formats, rendering images from Excel worksheets, rendering shapes and controls and exporting Excel workbooks to PDF format have been resolved. A few improvements have also been made to Aspose.Cells for Jav’s formula calculation engine. This release includes plenty of improved features and bug fixes as listed below
  • Retrieving SQL Connection Data
  • Aspose.Cells saving as TIFF - missing resolution tag
  • Chart Image Mapping for all Chart Types
  • Conversion to TIFF: setting PhotometricInterpretation tag
  • Limiting the number of pages generated when converting to PDF
  • Value read after calculation is corrected
  • Incorrect output of Style.getCultureCustom() is fixed
  • Value read after calculation corrected
  • IF Calculation Error is resolved
  • Column formattings were now re-saved correctly
  • Column formattings were now re-saved correctly
  • Shape object in Excel form now getting word-wrapped
  • AreaChart transparency is fixed and working
  • Active-X objects are changed to images
  • Cells.MaxDataRow gave corrected value
  • While converting XLSX to PDF, one Japanese character gets missing is fixed
  • Greater than calculation calcullation
  • setPrintGridlines now working in Sheet-to-Image feature
  • Charts by page margin now rendered when converting to image/PDF format
  • DisplayRightToLeft problem for SheetRender is fixed
  • Wrong calculated value of Yield function is fixed
  • Cells RTL problem fixed - Sheet to Image
Other most recent bug fixes are also included in this release.

Overview: Aspose.Cells for Java

Aspose.Cells is a Java component for spreadsheet reporting without using Microsoft Excel. Other features include creating spreadsheets, opening encrypted excel files, macros, VBA, unicode, formula settings, pivot tables, importing data from JDBC ResultSet and support of CSV, SpreadsheetML, PDF, ODS and all file formats from Excel 97 to Excel 2007. It is compatible with Windows, Linux & Unix and supports all advanced features of data management, formatting, worksheet, charting and graphics

Read more about Homepage of Aspose.Cells for Java

Tuesday, December 10, 2013

Add, Delete or Get Attachments from PDF Document in Android & Java Apps

This technical tip shows how to work with attachment in a PDF document using Aspose.Pdf. Developers can add, delete, get attachment from a PDF file. In order to add attachment in a PDF document, you need to create a FileSpecification object with the file, which needs to be added, and the file description. After that the FileSpecification object can be added to EmbeddedFiles collection of Document object using add(..) method of EmbeddedFiles collection. The EmbeddedFiles collection contains all the attachments added in the PDF file.
The following code snippet shows you how to add attachment in a PDF document.
//open document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("/mnt/sdcard/input.pdf");
//setup new file to be added as attachment
com.aspose.pdf.FileSpecification fileSpecification = new com.aspose.pdf.FileSpecification("/mnt/sdcard/sample.txt", "Sample text file");
//add attachment to document's attachment collection
pdfDocument.getEmbeddedFiles().add(fileSpecification);
// Save updated document containing table object
pdfDocument.save("/mnt/sdcard/output.pdf");
The following code snippet shows you how to delete all the attachments from the PDF document.
//open document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("/mnt/sdcard/input.pdf");
//delete all attachments
pdfDocument.getEmbeddedFiles().delete();
//save updated file
pdfDocument.save("/mnt/sdcard/output.pdf");
The following code snippet shows you how to get an individual attachment from the PDF document.
//open document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("/mnt/sdcard/input.pdf");
//get particular embedded file
com.aspose.pdf.FileSpecification fileSpecification = pdfDocument.getEmbeddedFiles().get_Item(1);
//get the file properties
System.out.printf("Name: - " + fileSpecification.getName());
System.out.printf("\nDescription: - " + fileSpecification.getDescription());
System.out.printf("\nMime Type: - " + fileSpecification.getMIMEType());
// get attachment form PDF file
try {
    InputStream input = fileSpecification.getContents();
    File file = new File(fileSpecification.getName());
    // create path for file from pdf
    file.getParentFile().mkdirs();
    // create and extract file from pdf
    java.io.FileOutputStream output = new java.io.FileOutputStream("/mnt/sdcard/"+fileSpecification.getName(), true);
    byte[] buffer = new byte[4096];
    int n = 0;
    while (-1 != (n = input.read(buffer)))
    output.write(buffer, 0, n);
    // close InputStream object
    input.close();
    output.close();
} catch (IOException e) {
e.printStackTrace();
}
// close Document object
pdfDocument.dispose();
Overview: Aspose.Pdf for Android
Aspose.Pdf for Android is a PDF document creation & manipulation component that enables Android applications to read, write & manipulate PDF document without using any other third party application. It allows PDF compression options, table creation & manipulation, support for graph objects, extended security controls, custom font handling, add or remove bookmarks, create table of contents, add, update, delete attachments & annotations, import or export PDF form data, print PDF docs &  much more.

Read more about Aspose.Pdf for Android