GroupDocs.Merger for Java 18.12 Release Notes

Major Features

There are 18 new features in this regular monthly release. The most notable are:

  • Added Diagram file formats support support (VSDX, VSDM, VSSX, VSSM, VTX, VSTM, VDX, VSTX, VSX)
  • Added Note file formats support (One)
  • Extended Security methods with ODT/OTT formats support
  • Added Rotate method to rotate pages in document 
  • Added ChangeOrientation method to change orientation of pages in document
  • Added functionality to get all supported formats

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
MERGERNET-259Diagram formats support for Join methodNew Feature
MERGERNET-260Diagram formats support for MovePage methodNew Feature
MERGERNET-261Diagram formats support for RemovePage methodNew Feature
MERGERNET-262Diagram formats support for Split document methodNew Feature
MERGERNET-264Diagram formats support for SwapPages methodNew Feature
MERGERNET-265Diagram formats support for Trim methodNew Feature
MERGERNET-251Implement Security methods for ODT formatNew Feature
MERGERNET-302Implement Security methods for OTT formatNew Feature
MERGERNET-321Note formats support for Join methodNew Feature
MERGERNET-322Note formats support for MovePage methodNew Feature
MERGERNET-323Note formats support for RemovePage methodNew Feature
MERGERNET-324Note formats support for Split document methodNew Feature
MERGERNET-325Note formats support for SwapPages methodNew Feature
MERGERNET-326Note formats support for Trim methodNew Feature
MERGERNET-156Implement RotatePages methodNew Feature
MERGERNET-245Implement ChangeOrientation methodNew Feature
MERGERNET-259Implement GetSupportedFormats methodNew Feature

Public API and Backward Incompatible Changes

New method ChangeOrientation

New method ChangeOrientation has been added

public DocumentResult ChangeOrientation(InputStream documentStream, OrientationOptions orientationOptions);

Operation ChangeOrientation let you change(set)  page orientation (portrait, landscape) for pages in document. In result you get a new stream that contains source document with original pages with specified orientation.

Change (set) page orientation for password-protected document of known format (fastest version)

//string sourceFile = "C:\testfiles\filename";
 
// Preparing.
string password = "SomePasswordString";
OrientationOptions pagesOptions = new OrientationOptions(OrientationMode.Landscape, fileFormat, password, new int[]{1,2});
InputStream documentExample = new FileInputStream(sourceFile);
 
 
// Main method.
DocumentResult result = new DocumentHandler().changeOrientation(documentExample, pagesOptions);
OutputStream documentStream = result.getStream();
Console.WriteLine(result.getFileFormat());

Change (set) page orientation for document of unknown format

//string sourceFile = "C:\testfiles\filename";
 
// Preparing.
InputStream documentExample = new FileInputStream(sourceFile);
 
// Main method.
DocumentResult result = new DocumentHandler().changeOrientation(documentExample, OrientationMode.Landscape, new int[]{1,6});
OutputStream documentStream = result.getStream();
Console.WriteLine(result.getFileFormat());

New method GetSupportedFormats

New method GetSupportedFormats has been added

public Map<String, Long> getSupportedFormats();

Java

Map<String, Long> documentFormatsContainer = new DocumentHandler().getSupportedFormats();
for (Map.Entry<String, Long>entry : documentFormatsContainer .entrySet()) {   
       System.out.print("Key: entry.getKey(), format: entry.getValue()");    
}

New method RotatePages

New method RotatePages has been added

public DocumentResult RotatePages(Stream documentStream, RotateOptions rotateOptions);

Operation RotatePages let you rotate pages in document. In result you get a new stream that contents source document without rotated pages.

You can rotate pages by specifying rotate mode which is 90,180,270 degrees.

Rotate pages on password-protected document of known format

string sourceFile = "C:\testfiles\filename";
 
// Preparing.
string password = "SomePasswordString";
List<Integer> pageNumbersForRotation = new List<Integer>();
pageNumbersForRotation.add(3);
pageNumbersForRotation.add(6);  
RotatePagesOptions pagesOptions = new RotatePagesOptions(fileFormat, password, RotateMode.Rotate180, pageNumbersForRotation );
InputStream documentExample = new FileInputStream(sourceFile);
 
// Main method.
DocumentResult result = new DocumentHandler().rotatePages(documentExample, pagesOptions);
OutputStream documentStream = result.getStream();
System.out.print(result.getFileFormat()); 

Rotate pages on document of unknown format

string sourceFile = "C:\testfiles\filename";
 
// Preparing.
InputStream documentExample = new FileInputStream(sourceFile);
 
// Main method.
DocumentResult result = new DocumentHandler()rotatePages(documentExample, RotateMode.Rotate270);
 OutputStream documentStream = result.getStream();
System.out.print(result.getFileFormat());

Obsolete class PagesOptions

Class PagesOptions is obsolete

@Deprecated
public class PagesOptions;

Methods where that class was used are obsolete as well

public DocumentResult removePages(InputStream documentStream, PagesOptions options);
public MultiDocumentResult split(InputStream documentStream, PagesOptions pagesOptions);
public DocumentResult trim(InputStream documentStream, PagesOptions pagesOptions);

New classes has been added

public class RemovePagesOptions;
public class SplitOptions;
public class TrimOptions; 

Method signatures has been added

public DocumentResult removePages(InputStream documentStream, RemovePagesOptions removePagesOptions);
public MultiDocumentResult split(InputStream documentStream, SplitOptions splitOptions);
public DocumentResult trim(InputStream documentStream, TrimOptions trimOptions);

Usage

You have to initiate one of new classes with list of page numbers and use it as option for appropriate method

java.util.List<Integer> pages = new ArrayList<Integer>();
pages.add(1);
pages.add(3);
RemovePagesOptions pagesOptions = new RemovePagesOptions(fileFormat, password, pages);
 
DocumentResult streamResult = new DocumentHandler().removePages(documentExample, pagesOptions);

Obsolete class RangeOptions

Class RangeOptions is obsolete

@Deprecated
public class RangeOptions;

Methods where that class was used are obsolete also

public DocumentResult removePages(InputStream documentStream, RangeOptions options);
public MultiDocumentResult split(InputStream documentStream, RangeOptions rangeOptions);
DocumentResult trim(InputStream documentStream, RangeOptions rangeOptions);

New classes has been added

public class RemovePagesOptions;
public class SplitOptions;
public class TrimOptions; 

Method signatures has been added

public DocumentResult removePages(InputStream documentStream, RemovePagesOptions removePagesOptions);
public MultiDocumentResult split(InputStream documentStream, SplitOptions splitOptions);
public DocumentResult trim(InputStream documentStream, TrimOptions trimOptions);

Usage

You have to initiate one of new classes with RangeMode enum and use it as option for appropriate method

RemovePagesOptions removePagesOptions = new RemovePagesOptions(fileFormat, password, 1, 5, RangeMode.AllPages);
DocumentResult streamResult = new DocumentHandler().removePages(documentExample, removePagesOptions);