PS, EPS, and XPS Conversion API
Convert PS, EPS, and XPS files to PDF and images directly within your JavaScript applications. Our powerful API unlocks new possibilities for document handling.
Discover the full potential of your JavaScript applications with our versatile native API solution! Convert PS, EPS, and XPS files into high-quality PDFs and stunning images quickly and easily. Whether you're in need of precise document transformation or perfect visual content, our API simplifies the process, providing you with the tools to effortlessly enhance your projects. Improve your document management and breathe new life into your visuals. Experience the magic of PostScript (PS) and Encapsulated PostScript (EPS) as well as XPS documents to PDF and images conversion with our JavaScript API. Ready to transform your documents? Try our free trial or purchase now and elevate your content today!
Programmers can easily use it for batch processing of PostScript and XPS documents, even manipulate canvases, paths, and glyphs elements, and handle vector graphics shapes and text strings.
Our native API solution for JavaScript lets you convert PS, EPS, and XPS files programmatically, but you may find it useful to see and try cross-platform development on these native APIs. Here are a few scenarios of conversion, such as EPS to Images, EPS to PDF, PostScript to PDF, PostScript to Images, XPS to Images, and XPS to PDF
Convert PostScript (PS, EPS) to Images via JavaScript.
JavaScript library allows converting PostScript (PS) and Encapsulated PostScript (EPS) files to images on Windows, Linux, and macOS platforms. The process is:
- Create file reader ‘const file_reader = new FileReader();’ and read file ‘file_reader.readAsArrayBuffer(e.target.files[0]);’
- On load event handler call AsposePSSaveAsImage and pass the file content and its name, image format Module.ImageFormat.Bmp and SuppressError boolean values to it.
- The result JSON contains the count of files in countFiles and the array of file names in filesNameResult. One file for one page of the input document.
- You can download files by using the DownloadFile function: ‘for (let fileIndex = 0; fileIndex < json.filesCount; fileIndex++) DownloadFile(json.filesNameResult[fileIndex], ‘image/png’);’
Save EPS as BMP
var fEPSAsBmp = function (e) {
const file_reader = new FileReader();
file_reader.onload = (event) => {
const json = AsposePSSaveAsImage(event.target.result, e.target.files[0].name, Module.ImageFormat.Bmp, true);
if (json.errorCode == 0) {
document.getElementById('output').textContent = 'Files(pages) count: ' + json.filesCount.toString();
for (let fileIndex = 0; fileIndex < json.filesCount; fileIndex++) DownloadFile(json.filesNameResult[fileIndex], 'image/png');
}
else
document.getElementById('output').textContent = json.errorText;
}
file_reader.readAsArrayBuffer(e.target.files[0]);
}
PostScript to PDF Conversion via JavaScript.
The process of converting PostScript to PDF is as simple as PostScript to Images:
- Create file reader ‘const file_reader = new FileReader();’ and read file ‘file_reader.readAsArrayBuffer(e.target.files[0]);’
- On load event handler call AsposePSSaveAsPdf and pass the file content and its name, and SuppressError boolean values to it.
- The result JSON contains the result file name in fileNameResult.
- You can download files by using the DownloadFile function: ‘for (let fileIndex = 0; fileIndex < json.filesCount; fileIndex++) DownloadFile(json.filesNameResult[fileIndex], ‘image/png’);’
Save PS as PDF
var fPSAsPdf = function (e) {
const file_reader = new FileReader();
file_reader.onload = (event) => {
const json = AsposePSSaveAsPdf(event.target.result, e.target.files[0].name, true);
if (json.errorCode == 0) {
document.getElementById('output').textContent = 'Files(pages) count: ' + json.filesCount.toString();
for (let fileIndex = 0; fileIndex < json.filesCount; fileIndex++) DownloadFile(json.filesNameResult[fileIndex], 'image/png');
}
else
document.getElementById('output').textContent = json.errorText;
}
file_reader.readAsArrayBuffer(e.target.files[0]);
}
Convert XPS to Images via JavaScript.
JavaScript XPS Processing API deals with the conversion of XPS to Images, including BMP, JPG, TIFF, PNG, and more, as well as XPS to PDF conversion on Windows and Linux-based systems. The process of converting XPS to images is:
- Create file reader ‘const file_reader = new FileReader();’ and read file ‘file_reader.readAsArrayBuffer(e.target.files[0]);’
- On load event handler call AsposeXPSSaveAsImage and pass the file content and its name, image format Module.ImageFormat.Bmp and SuppressError boolean values to it.
- The result JSON contains the count of files in countFiles and the array of file names in filesNameResult. One file for one page of the input document.
- You can download files by using the DownloadFile function: ‘for (let fileIndex = 0; fileIndex < json.filesCount; fileIndex++) DownloadFile(json.filesNameResult[fileIndex], ‘image/png’);’
Save XPS as PNG
var fXPSAsPng = function (e) {
const file_reader = new FileReader();
file_reader.onload = (event) => {
const json = AsposeXPSSaveAsImage(event.target.result, e.target.files[0].name, Module.ImageFormat.Png, true);
if (json.errorCode == 0) {
document.getElementById('output').textContent = 'Files(pages) count: ' + json.filesCount.toString();
for (let fileIndex = 0; fileIndex < json.filesCount; fileIndex++) DownloadFile(json.filesNameResult[fileIndex], 'image/png');
}
else
document.getElementById('output').textContent = json.errorText;
}
file_reader.readAsArrayBuffer(e.target.files[0]);
}
Convert XPS to PDF via JavaScript.
JavaScript XPS Processing API deals with the conversion of XPS to Images, including BMP, JPG, TIFF, PNG, and more, as well as XPS to PDF conversion on Windows and Linux-based systems. The process of converting XPS to PDF is:
- Create file reader ‘const file_reader = new FileReader();’ and read file ‘file_reader.readAsArrayBuffer(e.target.files[0]);’
- On load event handler call AsposeXPSSaveAsPdf and pass the file content and its name, and SuppressError boolean values to it.
- The result JSON contains the result file name in fileNameResult.
- You can download files by using the DownloadFile function: ‘DownloadFile(json.fileNameResult, ‘application/pdf’);’
- You can download files by using the DownloadFile function: ‘for (let fileIndex = 0; fileIndex < json.filesCount; fileIndex++) DownloadFile(json.filesNameResult[fileIndex], ‘image/png’);’
Save XPS as PDF
var fXPSAsPdf = function (e) {
const file_reader = new FileReader();
file_reader.onload = (event) => {
const json = AsposeXPSSaveAsPdf(event.target.result, e.target.files[0].name, true);
if (json.errorCode == 0) {
document.getElementById('output').textContent = 'Files(pages) count: ' + json.filesCount.toString();
for (let fileIndex = 0; fileIndex < json.filesCount; fileIndex++) DownloadFile(json.filesNameResult[fileIndex], 'image/png');
}
else
document.getElementById('output').textContent = json.errorText;
}
file_reader.readAsArrayBuffer(e.target.files[0]);
}
Support and Learning Resources
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Release Notes
- Why Aspose.Page for C++?
- Customers List
- Success Stories