diff --git a/Examples/pom.xml b/Examples/pom.xml index 78823a2..bd7d351 100644 --- a/Examples/pom.xml +++ b/Examples/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.aspose imaging-java-examples - 24.11 + 24.12 jar 1.8 @@ -15,14 +15,14 @@ com.aspose aspose-imaging - 24.11 + 24.12 jdk16 jar com.aspose aspose-imaging - 24.11 + 24.12 javadoc jar diff --git a/Examples/src/main/java/com/aspose/imaging/examples/ModifyingImages/UnifyUsageOfCommonOperations.java b/Examples/src/main/java/com/aspose/imaging/examples/ModifyingImages/UnifyUsageOfCommonOperations.java new file mode 100644 index 0000000..8bd38fe --- /dev/null +++ b/Examples/src/main/java/com/aspose/imaging/examples/ModifyingImages/UnifyUsageOfCommonOperations.java @@ -0,0 +1,46 @@ +package com.aspose.imaging.examples.ModifyingImages; + +import com.aspose.imaging.*; +import com.aspose.imaging.examples.Logger; +import com.aspose.imaging.examples.Utils; +import com.aspose.imaging.fileformats.opendocument.OdImage; +import com.aspose.imaging.imageoptions.PngOptions; +import com.aspose.imaging.imageoptions.VectorRasterizationOptions; + +public class UnifyUsageOfCommonOperations +{ + public static void main(String[] args) + { + Logger.startExample(); + // The path to the documents' directory. + String dataDir = Utils.getSharedDataDir() + "CDR/"; + String fileName = "test.cdr"; + String inputFileName = dataDir + fileName; + String outputFileNamePng = Utils.getOutDir() + "output.png"; + + try (Image image = Image.load(inputFileName)) + { + if (image instanceof OdImage) + { + image.crop(new Rectangle(92, 179, 260, 197)); + } + else + { + image.crop(new Rectangle(88, 171, 250, 190)); + } + + image.save(outputFileNamePng, new PngOptions() + {{ + setVectorRasterizationOptions(new VectorRasterizationOptions() + {{ + setPageSize(Size.to_SizeF(image.getSize())); + setTextRenderingHint(TextRenderingHint.SingleBitPerPixel); + setSmoothingMode(SmoothingMode.None); + + }}); + }}); + } + Utils.deleteFile(outputFileNamePng); + Logger.endExample(); + } +} diff --git a/Examples/src/main/java/com/aspose/imaging/examples/RunExamples.java b/Examples/src/main/java/com/aspose/imaging/examples/RunExamples.java index 59bf833..76be2dd 100644 --- a/Examples/src/main/java/com/aspose/imaging/examples/RunExamples.java +++ b/Examples/src/main/java/com/aspose/imaging/examples/RunExamples.java @@ -116,6 +116,7 @@ public static void main(String[] args) throws IOException, InterruptedException, //// ===================================================== Logger.println("Running modifying and converting images tests:"); + UnifyUsageOfCommonOperations.main(args); LoadAvif.main(args); SupportDicomYBR422.main(args); RemoveAndSaveWithMetadata.main(args);