PCL to PDF conversion - Font Helvetica is absent exception

I’m trying out your product. I use the sample code below on a windows 8.1 pro and received the “Font Helvetica is absent.” exception. Please let me know how to proceed.


void Main()
{
string dataDir =@“c:”;

// Instantiate Pdf object
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// Bind the source PCL file
pdf.BindPCL(dataDir + “test.pcl”);
// Save the resultant PDF document
pdf.Save(dataDir + “output.pdf”);
}

Stack Trace:
at Aspose.Pcl.Util.PDFFontHelper.ThrowFontAbsentException(String fontName, String subFontName)
at Aspose.Pcl.Util.PDFFontHelper.findFittedFontName(String fontName, Boolean canBeNull, Boolean fixedSpacing)
at Aspose.Pcl.Util.PDFFontHelper.changeCurrentFont(String name, Boolean bold, Boolean italic, Single size, Boolean primary)
at Aspose.Pcl.Command.Printer.Font.FontSelectionCommand.changeComposerSettings(Composer composer)
at Aspose.Pcl.Composer.PDFComposer.processCommand(PCLCommand pclCommand)
at Aspose.Pcl.Composer.PDFComposer.Run()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Installing the font on all upstream environments is not an option. How do i specify a default?

Hi Chandra,


Thanks for contacting support.

Please note that if you are using an input file which contains Intellifont or Universal Soft Fonts, an exception will be thrown because the file will try to reference the font during conversion. I am afraid that Intellifont and Universal fonts are not supported. You may check further details in “Convert a File to PDF” section of our API documentation.

Moreover I have observed that you are using Old Aspose.Pdf.Generator approach which is going to be obsolete soon and we are not resolving issues regarding old approach. We strongly recommend to use New DOM (Document Object Model) approach. You may check new DOM approach details in “Working with Aspose.Pdf” section of our API documentation.

If you face any further issue while converting PCL into PDF, please share your input file so that we can try to replicate issue in our environment and update you accordingly. We are sorry for the inconvenience.

Best Regards,

I tried converting a pcl file using both modes. see code below ( with the errors generated by each mode). I will send the sample file in a private email. Let me know how to proceed.


void Main()
{
string dataDir = @“some path”;
// Instantiate Pdf object
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// Bind the source PCL file
pdf.BindPCL(dataDir + “sample.pcl”);
// Save the resultant PDF document
pdf.Save(dataDir + “sample_Mode1.pdf”);
// Error
// Font Helvetica is absent.
// at Aspose.Pcl.Util.PDFFontHelper.ThrowFontAbsentException(String fontName, String subFontName)
// at Aspose.Pcl.Util.PDFFontHelper.findFittedFontName(String fontName, Boolean canBeNull, Boolean fixedSpacing)
// at Aspose.Pcl.Util.PDFFontHelper.changeCurrentFont(String name, Boolean bold, Boolean italic, Single size, Boolean primary)
// at Aspose.Pcl.Command.Printer.Font.FontSelectionCommand.changeComposerSettings(Composer composer)
// at Aspose.Pcl.Composer.PDFComposer.processCommand(PCLCommand pclCommand)
// at Aspose.Pcl.Composer.PDFComposer.Run()
// at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
// at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
// at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
// at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
// at System.Threading.ThreadHelper.ThreadStart()


// Instantiate LoadOption object using PCL load option
Aspose.Pdf.LoadOptions loadopt = new Aspose.Pdf.PclLoadOptions() {ConversionEngine=Aspose.Pdf.PclLoadOptions.ConversionEngines.NewEngine};

// Create Document object
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + “sample.pcl”, loadopt);

// Save the resultant PDF document
doc.Save(dataDir + “sample_Mode2.pdf”);
// Error
// Object reference not set to an instance of an object.
// at Aspose.Pcl.Composer.ApsPageComposer.ProcessCommand(PCLCommand pclCommand)
// at Aspose.Pcl.Composer.ApsPageComposer.Run()
// at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
// at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
// at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
// at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
// at System.Threading.ThreadHelper.ThreadStart()

}

i have sent You an email with sample. Please acknowledge receipt.

Hi Chandra,


Thanks for your patience and sharing details. I have received your input file and I am testing the scenario at my end. Please be patient I will get back to you shortly.

Best Regards,

Hi Chandra,


Thanks for your patience.

I tried converting your “Sample.pcl” into PDF and was able to notice the issue which you have reported. Therefore for further investigation I have generated a ticket as PDFNET-42263 in our issue tracking system. We will further look into the issue details and keep you posted within this thread about the status of its resolution. Please be patient and spare us a little time.

We are sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as PDFNET-42263) have been fixed in Aspose.PDF for .NET 19.11.