Error during text replacement in 19.6, but not in 18.3 and 7.7

Hello,

We have an issue with one of our templates when some text is replaced in text boxes. We tried two different ways of replacing text.

With Aspose.Pdf 7.7, the result was what we expected. The font was embedded correctly.

With Aspose.Pdf 18.3, the result is not correct. The font is not embedded correctly and then another substitute font is used to display the PDF file.

With Aspose.Pdf 19.6, there is no result because an exception occurs:
Aspose.Pdf.FontEmbeddingException: ‘Font embedding is prohibited because of font license restrictions’

Here is our template.
CARD_LABEL_ARTWORK_PDF_5.pdf (62.5 KB)

Here are the outputs generated.Outputs2.zip (196.4 KB)

Here is the code that has been used.AsposeSample2.zip (92.1 KB)

The font used is included in the source archive.

Is this a regression?

How can we generate a correct output with the font correctly embedded?

Thanks for your help.

Hello,

First small corrections:

  • the result with 7.7 has two subsets of the font embedded
  • the result with 18.2 has one subset embedded and one “reference” to the actual font, which is being used by the PDF reader because it is installed on our machines.

New result with 18.3: CARD_LABEL_ARTWORK_PDF_5_18.3_out.pdf (48.6 KB)

So I think the question becomes:

How can we generate a correct output with the font correctly embedded or how can we generate a file not embedding the font, which will be found on our machines?

Thanks for your help.

@pjcagnard

Thank you for contacting support.

Please note that support is provided based on latest available version of the API and we are unable to notice the exception with Aspose.PDF for .NET 19.6. Generated documents have been attached for your kind reference. Would you please share your feedback and comments based on these documents.

Result-19-out.pdf
Result-19-as-out.pdf

You may also visit Embedding Fonts in an existing PDF file for your kind reference.

Hello,

Thanks for you answer.

Sorry, I wrote 19.5 but I made the tests with 19.6 also (I updated the title but not the content, which I’ll try to do right after writing this post).

Unfortunately, the attached documents do not correspond to the expected output. The text “My label title” and “Line 1 contents” should be in the same font as the original text (HelveticaNeue-BoldCond), and not in TimesNewRoman, which seems to have been chosen as a default font.

I think the exception does not occur since in your case Aspose.Pdf does not try to embed the HelveticaNeue-BoldCond font but replaces it with TimesNewRoman. I think that if the font is installed in your environment, Aspose.Pdf will try to embed it, and then the exception should be raised.

Thanks for your help.

@pjcagnard

Thank you for elaborating further.

We have installed the font using the OTF file shared by you but the exception is not reproduced. However, we have logged an investigation ticket with ID PDFNET-46593 in our issue management system for further investigations. We will let you know as soon as some significant information will be available in this regard.

Hello,

Could you provide the output PDF file generated?

Thanks.

@pjcagnard

Below are two PDF documents which are generated after installing the OTF font shared by you.

Result-19-as-out_19.6.pdf
Result-19-out.pdf

Hello,

For some strange reason, the font is not embedded in your output documents. It is still replaced by TimeNewRoman for the fields Title and Line1, as before. That’s probably why you don’t get an exception.

On my side the exception is raised on the line:

        pdfEditor.ReplaceText("Line1", "Line 1 contents");

which is also a bit strange since it could/should also have been raised on the first replacement line:

        pdfEditor.ReplaceText("Title", "My label title");

Thanks.

@pjcagnard

Thank you for your kind feedback.

We have recorded your comments and will update you as soon as any significant update will be available after further investigations.