Skip to content

Commit 044fb37

Browse files
author
Evgeniy Sidenko
committed
Updated upto the version 23.10
1 parent 96b0d11 commit 044fb37

File tree

6 files changed

+42
-148
lines changed

6 files changed

+42
-148
lines changed

Examples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.aspose</groupId>
55
<artifactId>imaging-java-examples</artifactId>
6-
<version>23.9</version>
6+
<version>23.10</version>
77
<packaging>jar</packaging>
88
<properties>
99
<maven.compiler.source>1.8</maven.compiler.source>
@@ -15,14 +15,14 @@
1515
<dependency>
1616
<groupId>com.aspose</groupId>
1717
<artifactId>aspose-imaging</artifactId>
18-
<version>23.9</version>
18+
<version>23.10</version>
1919
<classifier>jdk16</classifier>
2020
<type>jar</type>
2121
</dependency>
2222
<dependency>
2323
<groupId>com.aspose</groupId>
2424
<artifactId>aspose-imaging</artifactId>
25-
<version>23.9</version>
25+
<version>23.10</version>
2626
<classifier>javadoc</classifier>
2727
<type>jar</type>
2828
</dependency>
Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,40 @@
11
package com.aspose.imaging.examples.EPS;
22

3+
import com.aspose.imaging.FileFormat;
34
import com.aspose.imaging.Image;
45
import com.aspose.imaging.examples.Logger;
56
import com.aspose.imaging.examples.Utils;
6-
import com.aspose.imaging.fileformats.eps.EpsBinaryImage;
77
import com.aspose.imaging.fileformats.eps.EpsImage;
8-
import com.aspose.imaging.fileformats.eps.EpsInterchangeImage;
9-
import com.aspose.imaging.fileformats.eps.consts.EpsType;
10-
import com.aspose.imaging.imageoptions.PngOptions;
8+
9+
import java.util.ArrayList;
10+
import java.util.List;
1111

1212
public class SupportForEPS
1313
{
1414
public static void main(String... args)
1515
{
1616
Logger.startExample("SupportForEPS");
1717

18-
String dataDir = Utils.getSharedDataDir() + "EPS/";
19-
try (EpsImage epsImage = (EpsImage) Image.load(dataDir + "anyEpsFile.eps"))
18+
String dataDir = Utils.getSharedDataDir() + "Eps/";
19+
String outDir = Utils.getOutDir("Eps");
20+
List<String> epsPreviewFiles = new ArrayList<>();
21+
try (EpsImage image = (EpsImage) Image.load(dataDir + "Sample.eps"))
2022
{
21-
// check if EPS image has any raster preview to proceed (for now only raster preview is supported)
22-
if (epsImage.hasRasterPreview())
23+
for (Image preview : image.getPreviewImages())
2324
{
24-
if (epsImage.getPhotoshopThumbnail() != null)
25-
{
26-
// process Photoshop thumbnail if it's present
27-
Logger.println("process Photoshop thumbnail if it's present");
28-
}
29-
30-
if (epsImage.getEpsType() == EpsType.Interchange)
31-
{
32-
// Get EPS Interchange subformat instance
33-
EpsInterchangeImage epsInterchangeImage = (EpsInterchangeImage) epsImage;
34-
35-
if (epsInterchangeImage.getRasterPreview() != null)
36-
{
37-
Logger.println("process black-and-white Interchange raster preview if it's present");
38-
// process black-and-white Interchange raster preview if it's present
39-
}
40-
}
41-
else
42-
{
43-
// Get EPS Binary subformat instance
44-
EpsBinaryImage epsBinaryImage = (EpsBinaryImage) epsImage;
45-
46-
if (epsBinaryImage.getTiffPreview() != null)
47-
{
48-
// process TIFF preview if it's present
49-
Logger.println("process TIFF preview if it's present");
50-
}
51-
52-
if (epsBinaryImage.getWmfPreview() != null)
53-
{
54-
// process WMF preview if it's present
55-
Logger.println("process WMF preview if it's present");
56-
}
57-
}
58-
59-
// export EPS image to PNG (by default, best available quality preview is used for export)
60-
epsImage.save(Utils.getOutDir() + "anyEpsFile.png", new PngOptions());
25+
String previewPath = outDir + "output." + FileFormat.toString(FileFormat.class, preview.getFileFormat()).toLowerCase();
26+
preview.save(previewPath);
27+
epsPreviewFiles.add(previewPath);
6128
}
6229
}
30+
// do something with the preview files
31+
32+
// finally delete them
33+
for (String file : epsPreviewFiles)
34+
{
35+
Utils.deleteFile(file);
36+
}
37+
6338
Logger.endExample();
6439
}
6540
}

Examples/src/main/java/com/aspose/imaging/examples/ModifyingImages/SupportForEPSFormat.java

Lines changed: 0 additions & 66 deletions
This file was deleted.

Examples/src/main/java/com/aspose/imaging/examples/ModifyingImages/eps/ExportEps.java

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,40 @@
11
package com.aspose.imaging.examples.ModifyingImages.eps;
22

33
import com.aspose.imaging.Image;
4-
import com.aspose.imaging.PdfComplianceVersion;
54
import com.aspose.imaging.examples.Logger;
65
import com.aspose.imaging.examples.Utils;
7-
import com.aspose.imaging.fileformats.eps.EpsBinaryImage;
86
import com.aspose.imaging.fileformats.eps.EpsImage;
97
import com.aspose.imaging.fileformats.eps.EpsPreviewFormat;
10-
import com.aspose.imaging.fileformats.pdf.PdfCoreOptions;
11-
import com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat;
12-
import com.aspose.imaging.imageoptions.PdfOptions;
13-
import com.aspose.imaging.imageoptions.TiffOptions;
148

9+
import java.io.ByteArrayOutputStream;
1510
import java.io.File;
11+
import java.io.IOException;
1612

1713
public class ExportEps
1814
{
19-
public static void main(String[] args)
15+
public static void main(String[] args) throws IOException
2016
{
2117
Logger.startExample("ExportEps");
2218

23-
// The path to the documents directory.
19+
// The path to the documents' directory.
2420
String dataDir = Utils.getSharedDataDir() + "/eps/";
2521
final String outDir = Utils.getOutDir("eps");
2622

23+
byte[] tiffPreviewBytes = null;
2724
try (EpsImage image = (EpsImage) Image.load(dataDir + "Sample.eps"))
2825
{
29-
PdfOptions options = new PdfOptions();
30-
final PdfCoreOptions coreOptions = new PdfCoreOptions();
31-
coreOptions.setPdfCompliance(PdfComplianceVersion.PdfA1b); // Set required PDF compliance
32-
options.setPdfCoreOptions(coreOptions);
33-
34-
image.setPreviewToExport(EpsPreviewFormat.PostScriptRendering);
35-
image.save(outDir + "Sample.pdf", options);
36-
}
37-
38-
try (EpsBinaryImage image = (EpsBinaryImage)Image.load(dataDir + "Sample.eps"))
39-
{
40-
// Tiff image export options
41-
TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffJpegRgb);
42-
43-
// The first way:
44-
image.getTiffPreview().save(outDir + "Sample1.tiff", options);
45-
46-
// The second way:
47-
image.setPreviewToExport(EpsPreviewFormat.TIFF);
48-
image.save(outDir + "Sample2.tiff", options);
26+
Image tiffPreview = image.getPreviewImage(EpsPreviewFormat.TIFF);
27+
if (tiffPreview != null)
28+
{
29+
try (ByteArrayOutputStream tiffPreviewStream = new ByteArrayOutputStream())
30+
{
31+
tiffPreview.save(tiffPreviewStream);
32+
tiffPreviewBytes = tiffPreviewStream.toByteArray();
33+
}
34+
}
4935
}
5036

51-
deleteFile(outDir + "Sample.pdf");
52-
deleteFile(outDir + "Sample1.tiff");
53-
deleteFile(outDir + "Sample2.tiff");
37+
// do something with tiffPreviewBytes
5438

5539
Logger.endExample();
5640
}

Examples/src/main/java/com/aspose/imaging/examples/RunExamples.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.aspose.imaging.examples.ConvertingImages.otg.SupportOfFODG;
1010
import com.aspose.imaging.examples.ConvertingImages.svg.SvgNativeResize;
1111
import com.aspose.imaging.examples.EMF.CropEMFImage;
12+
import com.aspose.imaging.examples.EPS.SupportForEPS;
1213
import com.aspose.imaging.examples.Html5Canvas.ExportToHtml5Canvas;
1314
import com.aspose.imaging.examples.InterruptMonitor.InterruptMonitorSupport;
1415
import com.aspose.imaging.examples.ManipulatingJPEGImages.*;
@@ -155,7 +156,7 @@ public static void main(String[] args) throws IOException, InterruptedException,
155156
SupportForJPEG.main(args);
156157
ReadingPixelValues.main(args);
157158
RasterImageToPDF.main(args);
158-
SupportForEPSFormat.main(args);
159+
SupportForEPS.main(args);
159160
ConvertEMFToWMF.main(args);
160161
AlignHorizontalAndVeticalResolutionsOfImage.main(args);
161162
ApplyGaussWienerFilter.main(args);

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Aspose.Imaging works for both x86 and x64 versions of the above listed operating
6666

6767
## Get Started with Aspose.Imaging for Java
6868

69-
Aspose hosts all Java APIs at the [Aspose Repository](https://repository.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-imaging). You can easily use Aspose.BarCode for Java API directly in your Maven projects with simple configurations. For the detailed instructions please visit [Installing Aspose.Imaging for Java from Maven Repository](https://docs.aspose.com/imaging/java/installation/) documentation page.
69+
Aspose hosts all Java APIs at the [Aspose Repository](https://releases.aspose.com/#/artifacts/browse/tree/General/repo/com/aspose/aspose-imaging). You can easily use Aspose.BarCode for Java API directly in your Maven projects with simple configurations. For the detailed instructions please visit [Installing Aspose.Imaging for Java from Maven Repository](https://docs.aspose.com/imaging/java/installation/) documentation page.
7070

7171
## Resize a JPG Image
7272

@@ -113,4 +113,4 @@ try (PngOptions options = new PngOptions())
113113
}
114114
```
115115

116-
[Home](https://www.aspose.com/) | [Product Page](https://products.aspose.com/imaging/java) | [Docs](https://docs.aspose.com/imaging/java/) | [Demos](https://products.aspose.app/imaging/family) | [API Reference](https://apireference.aspose.com/imaging/java) | [Examples](https://github.com/aspose-imaging/Aspose.Imaging-for-Java) | [Blog](https://blog.aspose.com/category/imaging/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/imaging) | [Temporary License](https://purchase.aspose.com/temporary-license)
116+
[Home](https://www.aspose.com/) | [Product Page](https://products.aspose.com/imaging/java) | [Docs](https://docs.aspose.com/imaging/java/) | [Demos](https://products.aspose.app/imaging/family) | [API Reference](https://reference.aspose.com/imaging/java) | [Examples](https://github.com/aspose-imaging/Aspose.Imaging-for-Java) | [Blog](https://blog.aspose.com/category/imaging/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/imaging) | [Temporary License](https://purchase.aspose.com/temporary-license)

0 commit comments

Comments
 (0)