End users are getting PDF�s with strange fonts

We are using the aspose pdf.kit to stamp information on existing PDF files. We are running version 3.3.0.0 .NET 2.0<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I am using the PdfFileStamp class to stamp a formattedtext object on the file.

Here is a sample of how my formatted text object looks.

New FormattedText("text goes here.:", New FontColor(0, 0, 0), Aspose.Pdf.Kit.FontStyle.HelveticaBold, EncodingType.Winansi, True, "8")

Intermittently we have end users that are getting PDF documents with a strange font being used for the text that is stamped on the PDF’s. Almost a hieroglyphics type of font with symbols rather than words. Can you help resolve this? So that they will get the PDF with the Helvetica font being used?

The end users with the problem are running OS is XP, Internet Explorer 7 Version 7.0.5730.13. Adobe version is 7.

Hi,

We're looking into the matter and will inform you about the resolution the earliest possible.

We appreciate your patience.

Regards,

Hi,

We have tested this issue and found no inconsistency. We used following for testing:

Aspose.Pdf.Kit 3.3.0.0

Windows XP

Adobe Reader 7, Acrobat Reader 9

We're not quite sure why this is happening at your end. Could you please share some more information about the target machines having this problem? This will help us to resolve your issue.

Regards,

Hello Matthew,

Thanks for considering Aspose.

I’ve also tested the issue using Aspose.Pdf.Kit 3.3.0.0 and I am unable to reproduce the problem. I’ve tested the issue using the following code snippet. The resource input file and the resultant Pdf document containing Text stamp are in attachment, please take a look.

[C#]<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

string inFile = @"d:\pdftest\new_chkBox.pdf";

string outFile = @"d:\pdftest\new_chkBox_stamped.pdf";

Stamp aStamp = new Stamp();

aStamp.BindLogo(new FormattedText("Hello Aspose.Pdf.Kit!",new FontColor(0,0,0),Aspose.Pdf.Kit.FontStyle.HelveticaBold,EncodingType.Winansi,true,8f));

aStamp.Pages = new int[] { 1 };

aStamp.SetOrigin(100, 650);

PdfFileStamp stamper = new PdfFileStamp(inFile, outFile);

stamper.AddStamp(aStamp);

stamper.Close();

I’ve tried opening the Pdf file over Windows XP Professional SP3, using Adobe Reader 5.0.0, 7.0.8 & 9.0.0 and Couldn’t notice the problem on either of them. Can you please share the resource Pdf files that you are using, so that we can test the issue at our end.

We apologize for your inconvenience

Sure. I can share the file with you and a sample PDF that was scanned that has the problem. How can I get this files to you and make it so only you get a copy of them?

Hi,

You can attach files with this thread. As you reply you can add attachments, and in order to make it private, so it'll be accessible by Aspose staff only, mark the post as private on the post reply page.

Regards,

The “keep this post private” checkbox is disabled. Please advise.

Hi,

You may send the confidential files directly to Shahzad by emailing him using forums. In the above post made by Shahzad, you can see Contact button. Click it and select Send shahzad.latif an email. It will allow you to send him email right from forums and you can attach files to it too. This way, only Shahzad will receive your files.

I hope, it would help.

Shahzad did you get thefiles I sent last week?

Thanks,

Matthew

Hi Matthew,

I got those files. We're working on the issue; I have also forwarded the request along with the files to our development team for further investigation. We'll let you know as we find the resolution.

We appreciate your patience.

Regards,

Hi Matthew,

We have investigated the issue for some time but could not figure out what was happened at the end users' side. Please have a try of the following line of code instead, and make sure the font file had been installed to your machine.

FormattedText theText = new FormattedText(<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

"some text",

System.Drawing.Color.Blue,

@"C:\WINDOWS\Fonts\Helvetica Bold.ttf", //make sure the font file is installed, or you need to change Helvetica Bold.ttf to an existing one in C:\WINDOWS\Fonts\ .

EncodingType.Winansi,

true,

8);

Hope it helps.(And you may need to copy the TrueType File(xxxx.ttf) to the end users' C:\WINDOWS\Fonts\ directory)

Thanks,

I will give it a try. The font file needs to be on the web server. Does the font file need be on the end users computer that will access the web site? Or does it get embedded in the PDF file?

Thanks

Hi,

You can embed the font in the pdf file. For that matter, you can set IsFontEmbedded property to true. Please find the details in the following technical article:

Fonts embedding while creating Pdf

I hope this helps. If you have any further questions, please do let us know.

Regards,

Hello Matthew,

The font file needs to be installed over the system where the Watermark is being added to the Pdf file, and make sure you have set the Boolean value to true in FormattedText constructor so that the font gets embedded.

Let me correct the post made by Shahzad. Aspose.Pdf is a component which is used to generate the Pdf file from scratch, and the article link shared, explains the steps that you need to perform in order to embed the font information during the Pdf generation process.

Interesting How do I do this with aspose.pdf.kit?

Hi Matthew,

Please don’t worry about it, and the font will be embedded to the pdf when the parameter 'bool embedded’ is set to be ‘true’ (as we did) in the FommatedText Constructor.

For more details, please refer to our online documentation about FommatedText Constructors.

Thanks,