I am trying to convert PDF document to PPTX presentation, The document contains a mix of Adobe Type 1 fonts and TTF fonts. Some of the TTF fonts are embedded, some are partially embedded:
Fonts in PDF.png (16.8 KB)
I am using sample conversion code from the documentation:
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
// Load PDF document
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "input.pdf");
// Instantiate PptxSaveOptions instance
Aspose.Pdf.PptxSaveOptions pptx_save = new Aspose.Pdf.PptxSaveOptions();
// Save the output in PPTX format
doc.Save(dataDir + "PDFToPPT_out.pptx", pptx_save);
but when I open the result PPTX, there is an error message for missing fonts:
MissingFonts.png (6.3 KB)
and the slide is poorly formatted.
Slide.png (327.9 KB)
What is the recommend way to convert PDF to PPTX in this scenario: mixed type fonts, some of them entirely embedded, some partially?
@ncholakov
Please attach the file with which this problem occurs.
I have send you a sample file with the issue
@ncholakov
I received the file and reproduced the problem. When I opened the resulting file, I got a message only about the ArialNarrow font and the result was better than the one you gave.
PDFToPPT_out.zip (160.4 KB) - So the result also depends on the environment.
However, when converting with another product, I got the correct result in the same environment. Accordingly, I regard this as a bug and set the task for the development team.
@ncholakov
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-54929
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@sergei.shibanov thank you. I have a following question:
Is there a way to workaround this bug?
E.g. extract the fonts from the PDF and embed them in the PPTX
I am actually able to extract the fonts embedded in the PDF to a files but I am not sure how to embed them in the PPTX. Is there a way to load font from file and embed it in the PPTX?
@ncholakov
I began to try possible transformations in the source file. However, I did not manage to get a completely correct document. It turned out to make sure that the text does not spoil the rest.
var doc = new Aspose.Pdf.Document(myDir + "sample.pdf");
foreach (Aspose.Pdf.Text.Font font in doc.FontUtilities.GetAllFonts())
{
if(font.FontName.Contains("Arial"))
{
font.IsEmbedded = false;
//f.IsSubset = false;
}
}
var pptx_save = new Aspose.Pdf.PptxSaveOptions();
doc.Save(myDir + "PDFToPPT_out.pptx", pptx_save);
Maybe try the sequence pdf->pdf/A->pptx
Option pdf -> picture -> insert to pptx I will not offer.