Improved performance of PDF to PNG conversion, Render PDF data layers separately in PDF to HTML conversion and Dash line style of graph object with Aspose.Pdf for Java 11.7.0

Share on FacebookTweet about this on TwitterShare on LinkedIn

We are pleased to announce Aspose.Pdf for Java 11.7.0 release. This version includes PDF to PNG conversion performance enhancement in addition to the improvements/enhancements made in its equivalent .NET version.  We have also fixed number of issues in this release, reported by our customers in previous releases. Some of these are PDF to HTML, HTML to PDF, SVG to PDF, PDF to PDF/A, PDF to DOC(X), PDF to Image and some others. Please check release notes of Aspose.Pdf for Java 11.7.0 for complete list of bug fixed.

The following sections describe some details regarding these newly added enhancements.

Rendering PDF document layers separately in PDF to HTML conversion

A PDF document can contain different data layers and can have requirement to render each layer separately as HTML Layer element. We have introduced this feature in current release, we need to set ConvertMarkedContentToLayers property to control the layers rendering in PDF to HTML conversion as following.


// Open the PDF file
Document doc = new Document("input.pdf");
// Instantiate HTML SaveOptions object
HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
// Specify to render PDF document layers separately in output HTML
htmlOptions.setConvertMarkedContentToLayers(true);
// Save the document
doc.save("output.html", htmlOptions);

AutoFitToWindows value in ColumnAdjustment Type Enum

We have introduced a new value AutoFitToWindows in ColumnAdjustment Type Enum in current release. It will adjust table columns to fit to windows.


//Instantiate the Pdf object by calling its empty constructor
Document pdf = new Document();
//Create the section in the Pdf object
Page page = pdf.getPages().add();
//Instantiate a table object
com.aspose.pdf.Table tab = new com.aspose.pdf.Table();
//Add the table in paragraphs collection of the desired section
page.getParagraphs().add(tab);
//Set with column widths of the table
tab.setColumnWidths("50 50 50");
tab.setColumnAdjustment(ColumnAdjustment.AutoFitToWindow);
....

Dash Line style of Graph objects

Sometimes we have requirement to create a Graph Object with dashed line. Now, we can easily achieve the requirement with GraphInfo object, as following.


// instantiate Document instance
Document doc = new Document();
// add page to pages collection of Document object
Page page = doc.getPages().add();
// create Drawing object with certain dimensions
com.aspose.pdf.drawing.Graph canvas = new com.aspose.pdf.drawing.Graph(100, 400);
// add drawing object to paragraphs collection of page instance
page.getParagraphs().add(canvas);
// create Line object
com.aspose.pdf.drawing.Line line = new com.aspose.pdf.drawing.Line(new float[] { 100, 100, 200, 100 });
// set color for Line object
line.getGraphInfo().setColor(com.aspose.pdf.Color.getRed());
// specify dash array for line object
line.getGraphInfo().setDashArray(new int[] { 0, 1, 0 });
// set the dash phase for Line instance
line.getGraphInfo().setDashPhase(1);
// add line to shapes collection of drawing object
canvas.getShapes().add(line);
// save PDF document
doc.save("DashLineInBlack.pdf");

Enhancements

Following is a list of improvements included in this release.

  • Improved XPS to PDF conversion performance
  • Improved PDF to PNG conversion performance

Aspose.Pdf for Java Resources

The following resources will help you work with Aspose.Pdf for Java: