File Size after PDFStamp

After pdf stamping the size of the output file is almost double as the original file. When I see the file properties, the stamp text are embedded as Type 1 fonts. How do i add them as True Type? Here is what i am using

com.aspose.pdf.kit.Stamp logoStamp = new com.aspose.pdf.kit.Stamp();
FormattedText ft = new FormattedText(“Hello World!”,
new Color(180, 0, 0), FontStyle.TimesRoman, EncodingType.Winansi, true, 30);
logoStamp.bindLogo(ft);



Hello Geethanandh,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

When you specify EncodingType as Winansi, than the font is embedded as True Type. The reason why you are seeing TimeRoman as Type1 font is, that it’s among the 14 built-in fonts. I have used a custom font and have added a text as logo and the font is embedded as True Type.

I have attached a sample Pdf file that I have generated, you can see in document properties, the font is embedded as True Type. In case of any further query, feel free to contact.

[JAVA]

PdfFileStamp fileStamp = new PdfFileStamp("c:/pdftest/ListExample.pdf","c:/pdftest/ListExample_withLogo.pdf");

FormattedText ft = new FormattedText("Hello World!",( new FontColor(180, 0, 0)), "D:/ASPOSE/Font files/betenoir/Bete Noir NF.ttf", EncodingType.Winansi, true, 30);

fileStamp.addLogomark(ft, 20, 300);

fileStamp.close();

Make sure, when using custom font, you specify the font name or the full ttf file name with the absolute path.

I still see one Type 1 “Time Roman” font. Is it because of the evaluation text. Is that what making my file size to double?

Thanks for the reply.

Hello Geethanandh,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

As I already mentioned that your original Pdf contained text in Time Roman font, and its among the 14 built in fonts supported by Aspose.Pdf.Kit. I don’t think the evaluation text would be making the file size, double. Please share the resource Pdf so that we can test the issue at our end.

That is even after trying your suggestion of including the custom font like you have said. Anyways i am attaching the input(lecture3) and output file(stamp2).

com.aspose.pdf.kit.Stamp logoStamp = new com.aspose.pdf.kit.Stamp();
FormattedText ft = new FormattedText(“Hello World!!”,
new Color(180, 0, 0), “C:\WINDOWS\Fonts\biondi light.ttf”, EncodingType.Winansi, true, 15);
logoStamp.bindLogo(ft);
logoStamp.setPages(new int[]{1});

Thanks for looking at this.

Hello Geethanandh,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

It’s not necessary that you always add the custom font. However you can add the font from Built-in 14 fonts available. I have added a sample text as watermark over your Pdf, and its size is greater than the input. In fact, the size increased because the subset of custom font is added, which increased the file size. The benefit of doing this is, the Pdf will look same, any where it is opened, even the font is not installed.

Open the Pdf file and you would see that the custom font is being displayed properly even you don’t have the font installed over your system. The file is in attachment.

Thanks again for responding.

I do understand that PDF embed’s the font to maintain the look. So you took a 60 kb input file and created a 125kb output file. So i agree the font could take 60kb to get embedded.

I have tried with a 5 MB input file and got a 7MB file. That is big difference in size.

Is this usual or am i missing something?

Hello Geethanandh,

I have tested the issue and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFKITJAVA-6065. We will investigate this issue in detail and will keep you updated on the status of a correction. We apologize for your inconvenience.

The issues you have found earlier (filed as 6065) have been fixed in this update.

Hi There,

I have the problem stated above, doubling of file sizes. I have clicked on the link to the fix, but there doesn’t seem to be an updated apose.pdf.kit.dll :s

Please could you direct me in the correct location?

Thanks

Hi Mike,


Thanks for contacting support.

Please note that since July-2011, Aspose.Pdf.Kit for .NET has been discontinued as a separate product and its been merged into Aspose.Pdf for .NET. All its classes and enumerations have been merged under Aspose.Pdf.Facades namespace. I would recommend you to please try using the latest release version of Aspose.Pdf for .NET and in case you still face the same issue or you have any further query, please feel free to contact.

I would also recommend you to please visit the following links for further information on