Removing font

Hello,

can Aspose PDF remove fonts from a document in order to reduce size? otherwise remove duplicate fonts?

Thanks

Hi Paolo,


Thanks for your interest in our products. I am afraid currently Aspose.Pdf for .NET does not support the feature to remove duplicate font entries from PDF document but for the sake of implementation, we already have logged this requirement as PDFNEWNET-28353 in our issue tracking system. Our development team is working hard to get this feature implemented and as soon we have made significant progress, we would be more than happy to update you with the status of correction. Please be patient and spare us little time. We apologize for this inconvenience.
paoloponzano:
can Aspose PDF remove fonts from a document in order to reduce size?

Hi Paolo,

I have separately logged this requirement to remove any fonts embedded inside the PDF document or if there are multiple fonts, all fonts can be replaced into a single font so that the size of the document can be reduced. I have logged it as PDFNEWNET-32021 in our issue tracking system. We will further look into the details of this requirement and will keep you updated on the status of correction. We are sorry for this inconvenience.

Hello,
excuse me …any news about this? I don’t know how to check on issue tracking system

Thanks

Hi Paolo,


Thanks for your patience.

Our development team is still working on implementing this feature but I am afraid its not yet completely resolved. However I have requested them to share the ETA regarding its resolution. Soon you will be updated with status of correction. We are sorry for this inconvenience.

Hi Paolo,


I have discussed this issue with development team and as per our current estimates, we expect to get this issue resolved in Aspose.Pdf for .NET 7.3 which will be available in August-2012. This requirement is little complex so we need ample amount of time to introduce this feature.

Please note that not all fonts can be removed/replaced with another, but a common functionality will be available in v7.3.

Hi Paolo,


Thanks for your patience.

I am pleased to share that your requirement to remove Font from PDF file has been implemented and its resolution will become available in upcoming release version of Aspose.Pdf for .NET 7.3.0.

Please note that in order to replace fonts please :

  • use TextFragmentAbsorber approach
  • use TextEditOptions.FontReplace.RemoveUnusedFonts parameter for TextFragmentAbsorber
The above parameter removes fonts that become unused during font replace.
  • set font individually for each text fragment
following code snippet replaces font for all text fragments of all document pages and removed unused fonts.

[C#]

Document doc = new
Document(inFile);<o:p></o:p>

TextFragmentAbsorber absorber = new TextFragmentAbsorber(new TextEditOptions(TextEditOptions.FontReplace.RemoveUnusedFonts));

doc.Pages.Accept(absorber);

foreach (TextFragment textFragment in absorber.TextFragments)

{

textFragment.TextState.Font = FontRepository.FindFont("Courier New");

}

doc.Save(outFile);

The issues you have found earlier (filed as PDFNEWNET-32021) have been fixed in Aspose.Pdf for .NET 7.3.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

hello,
does it remove duplicate fonts as well?
Thanks

excuse me…
maybe I’m doing wrong…this piece of code substutuites the font with one I define…but doesn’t remove unused font…is there a way of using it as I need?

Thanks

Hi Paolo,


Thanks for contacting support.

Please note that during PDF generation you set a font for text fragments - single font is set only. All other fonts (unused, or fonts that duplicate the newly added, or duplicate each-other but are all unused) are being removed.

However if you encounter any issue while removing duplicate fonts, please share the source PDF file. We will further test the scenario at our end.

Excuse me…maybe I’m expressing wrong myself…

I’m using this for concatinating file

PdfFileEditor editor = new PdfFileEditor();
             
editor.Concatenate(msArray, fileStream);
 
fileStream.Close();

Where should I put the TextFragment code?

Thanks

Hi Paolo,


Thanks for your patience.

I am working over this requirement and will get back to you soon. We are sorry for this delay and inconvenience.
paoloponzano:
Excuse me.....maybe I'm expressing wrong myself...

I'm using this for concatinating file

PdfFileEditor editor = new PdfFileEditor();
             
editor.Concatenate(msArray, fileStream);
 
fileStream.Close();

Where should I put the TextFragment code?
Hi Paolo,

Thanks for your patience.

Please note that the approach shared earlier in which I have described the usage of TextFragment to replace the font for all text segments with a single font and hence it will remove the unused fonts but as per your current requirement to remove the unused/duplicate fonts while concatenating the PDF files, we need to further look into this matter where we can eliminate/remove the duplicate/unused fonts from PDF file. Can you please share some sample PDF files containing unused fonts so that we can further investigate this requirement while using those sample files. 

We are sorry for your inconvenience.

Hello CodeWarrior,
just take a pdf that has a subset of font, concatenate it using aspose, the output will have the double of font…

Hi Paolo,

Thanks for the information.

I have tested the scenario where I have tired concatenating one of my sample PDF file with its own copy and as per my observations, the resultant file does not contain the double/duplicate font. I have tried concatenating PDF files using Aspose.Pdf for .NET 7.3.0.

Please note that I have tried using following two approaches to concatenate the PDF files but I am unable to find the font duplicate issue.

[C# - Aspose.Pdf.Document approach]

//open first document
Aspose.Pdf.Document pdfDocument1 = new Aspose.Pdf.Document(“TestKDL.pdf”);
//open second document
Aspose.Pdf.Document pdfDocument2 = new Aspose.Pdf.Document(“Copy of TestKDL.pdf”);
//add pages of second document to the first
pdfDocument1.Pages.Add(pdfDocument2.Pages);
//save concatenated output file
pdfDocument1.Save(“DoubleFont_output.pdf”);


[C# - Aspose.Pdf.Facades approach]

//create PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
//concatenate files
pdfEditor.Concatenate(“TestKDL.pdf”, “Copy of TestKDL.pdf”, “DoubleFont_output_Facades.pdf”);

I would again request you to please share the sample PDF file which can help us in replicating this issue.

We are sorry for your inconvenience.

The issues you have found earlier (filed as PDFNEWNET-28353) have been fixed in Aspose.Pdf for .NET 7.6.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.