I am trying use Aspose Page to convert a PostScript file to PDF using the sample code provided. I get a “%%[Error: Undefined; Offending Command: ndefined” error when trying. I am wondering if there are certain options that I need to set to convert this file or if Aspose Page just can’t convert it.
I have attached the file below:
Sample.zip (1.2 MB)
@kmcbrearty,
The C# code that we used to test your scenario of PostScript (PS) to PDF file conversion with the latest (20.9) version of Aspose.Page for .NET API is as follows:
Aspose.Page.License lic = new Aspose.Page.License();
lic.SetLicense("Aspose.Total.Product.Family.lic");
System.IO.FileStream psStream = new System.IO.FileStream("Sample.ps", System.IO.FileMode.Open, System.IO.FileAccess.Read);
System.IO.FileStream pdfStream = new System.IO.FileStream("output.pdf", System.IO.FileMode.Create, System.IO.FileAccess.Write);
PsDocument document = new PsDocument(psStream);
bool suppressErrors = true;
PdfSaveOptions options = new PdfSaveOptions(suppressErrors);
Aspose.Page.EPS.Device.PdfDevice device = new Aspose.Page.EPS.Device.PdfDevice(pdfStream);
try
{
document.Save(device, options);
}
finally
{
psStream.Close();
pdfStream.Close();
}
//Review errors
if (suppressErrors)
{
foreach (PsConverterException ex in options.Exceptions)
{
Console.WriteLine(ex.Message);
}
}
Above code produces an empty PDF of 3 Kb file size. It also outputs the following error message to the Console window:
%%[Error: Undefined; Offending Command: ←]%%
Operand Stack (bottom..top)
[ ]
Execution Stack (bottom..top)
[ --file (pipe) -- ← //Undefined ]
Dictionary Stack (bottom..top)
[ --dictionary (357)-- --dictionary (0)-- --dictionary (0)-- ]
We will further look into the details of this problem and will keep you posted here on any further updates. We apologize for your inconvenience.
@kmcbrearty
We have logged above mentioned issue as PAGENET-198 in our issue management system for the sake of correction. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.
We are sorry for the inconvenience.