We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unused font / font subset optimizations

Hi: I’m trying to perform the same optimizations using your PDF lib as the following tool does: http://www.verypdf.com/app/pdf-compressor/pdf-font-subset-tool.html

How can I achieve this? (remove unused fonts, compress them, and subset them)

I already discovered how to remove unused fonts, per here:
https://blog.aspose.com/2012/09/14/remove-fonts-from-pdf-file-extract-form-fields-from-particular-pdf-region

Thank you,
Adam

Hi Adam,


Thanks for your interest in our products.

Aspose.Pdf for .NET provides the capability to optimize the PDF file by eliminating unused objects. Please try using the following code snippet to accomplish your requirement. In case you face any problem, please share the PDF documents so that we can test the scenario at our end.

[C#]

// load source PDF file<o:p></o:p>

Aspose.Pdf.Document doc = new Document("c:/pdftest/source.pdf");

// optimize the PDF file

doc.OptimizeResources(new Document.OptimizationOptions()

{

RemoveUnusedObjects=true,

RemoveUnusedStreams = true,

LinkDuplcateStreams=true

});

// save updated document

doc.Save(“c:/pdftest/OptimizedPDF.pdf”);

Thanks Nayyer:

I appreciate your response, but that doesn’t really answer my question. If it does, then I would appreciate if you would be more specific to the details of my question.

In particular, I’m asking if Aspose PDF can reduce fully embedded font sets to only those subsets that are used. If you open any PDF document in Acrobat, and then click on File > Properties. Then click on the “Fonts” tab, you’ll see fonts that have been embedded. Some may be fully embedded (“Embedded”) and others may be partially embedded (“Embedded Subset”). The tool that I mentioned previously, at http://www.verypdf.com/app/pdf-compressor/pdf-font-subset-tool.html, will take fully embedded font sets and trim them down to only the subsets used. Does your library also provide this feature?

Thank you much.

aeckels:
In particular, I’m asking if Aspose PDF can reduce fully embedded font sets to only those subsets that are used. If you open any PDF document in Acrobat, and then click on File > Properties. Then click on the “Fonts” tab, you’ll see fonts that have been embedded. Some may be fully embedded (“Embedded”) and others may be partially embedded (“Embedded Subset”). The tool that I mentioned previously, at http://www.verypdf.com/app/pdf-compressor/pdf-font-subset-tool.html, will take fully embedded font sets and trim them down to only the subsets used. Does your library also provide this feature?
Hi Adam,

I am afraid the requested feature is
currently not supported but for the sake of implementation, I have logged this
requirement in our issue tracking system under New Features list as PDFNEWNET-35936.
We will further investigate this requirement in details and will keep you
updated on the status of a correction. <o:p></o:p>

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNET-35936) have been fixed in Aspose.Pdf for .NET 17.5.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,


We were also interested in this feature and saw that it was recently released in 17.5. Is there a code sample of how this can be used?

Thanks

Hi Daniel,


In reference to the linked ticket ID PDFNET-35936, please try the following code snippet to reduce fully embedded font sets to only those subsets that are used:

[.NET, C#]
<span class=“rem” style=“color: rgb(0, 128, 0); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>// load PDF document<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
Document doc = <span class=“kwrd” style=“color: rgb(0, 0, 255); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>new<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”> Document(“doc.pdf”);<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
<span class=“rem” style=“color: rgb(0, 128, 0); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>// reduce embedded font sets<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>
doc.FontUtilities.SubsetFonts(Document.FontSubsetStrategy.SubsetEmbeddedFontsOnly);<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>
<span class=“rem” style=“color: rgb(0, 128, 0); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>// save document<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
doc.Save();
<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>