Arrow Shape Gets Distorted when Converting the PowerPoint Presentation to PDF in C#

The arrow shapes when used in PPT document getArrows_Distort_Output.pdf (112.9 KB)
Arrow_Distort.zip (30.0 KB)
s distorted when PDF is generared. Attached files

Also attached word document when coverted to pdf adds an empty page to the generated PDF. Attached files for referenceAgenda_EmptyPage.pdf (126.0 KB)
EmptyPage.docx (30.7 KB)

Sorry I can’t reproduce your problem, I’m using the latest version of Aspose.Slides (23.3.1) and this code:

// Instantiates a Presentation class that represents a PowerPoint file, it could be PPT, PPTX, ODP etc.
Presentation presentation = new Presentation("C:\\Temp\\input.pptx");

// Saves the presentation as a PDF
presentation.Save("C:\\Temp\\output.pdf", Aspose.Slides.Export.SaveFormat.Pdf);

output.pdf (24.2 KB)

What API are you using to convert from MS Word document to PDF. MS Word documents are not supported by Aspose.Slides API in any of it available versions.

Hi

The issue does not reproduce to us locally. But in the server this issue happens. Can we know what could be the reason? Is something missing in the server? we are using IIS windows 2019

@mbandapallii probably a font or resource is missing in your environment, if that happen Aspose.Slides API will replace it for a similar resource. You can check for substitutions by implement the IWarningCallback interface:

LoadOptions opt = new LoadOptions()
{
    WarningCallback = new HandleWarnings()
};

Presentation presentation = new Presentation("C:\\Temp\\input.pptx", opt);
public class HandleWarnings : IWarningCallback
{
    public ReturnAction Warning(IWarningInfo warning)
    {
        Console.WriteLine($"{warning.WarningType} -> {warning.Description}");
        return ReturnAction.Continue;
    }
}

What API are you using to convert from MS Word document to PDF. MS Word documents are not supported by Aspose.Slides API in any of it available versions.


We are not using Aspose.Slides.Net API. We are using ASPOSE.Words 22.5.0 and ASPOSE.PDF 22.5.0 libraries.

@mbandapallii so you are using Aspose.Words to load the file and Aspose.Pdf to save it, can you please share a simplified version if the code that you are executing?

Below is the code snippet:

        Aspose.Words.Document doc = new Aspose.Words.Document(fileName);
        doc.Save(pdfFileName, Aspose.Words.SaveFormat.Pdf);
1 Like

@mbandapallii sorry I wasn’t able to reproduce your problem.
I’m sharing with you the code that I use, and the output that it generate:

Document doc = new Document("C:\\Temp\\input.docx", new LoadOptions
{
    LoadFormat = LoadFormat.Docx,
    WarningCallback = new ConversionIssueCallBack()
});

var opt = new PdfSaveOptions()
{
    SaveFormat = SaveFormat.Pdf,
};

doc.Save("C:\\Temp\\output.pdf", opt);
public class ConversionIssueCallBack : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        Console.WriteLine(info.Description);
    }
}

As you can see I don’t have installed the font Corbel, so it was replaced by the Corbel font, but even with that substitution the resultant PDF don’t have the extra page.
output.pdf (39.9 KB)

@mbandapallii sorry I wasn’t able to reproduce your problem.
I’m sharing with you the code that I use, and the output that it generate:

Document doc = new Document("C:\\Temp\\input.docx", new LoadOptions
{
    LoadFormat = LoadFormat.Docx,
    WarningCallback = new ConversionIssueCallBack()
});

var opt = new PdfSaveOptions()
{
    SaveFormat = SaveFormat.Pdf,
};

doc.Save("C:\\Temp\\output.pdf", opt);
public class ConversionIssueCallBack : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        Console.WriteLine(info.Description);
    }
}

As you can see I don’t have installed the font Corbel, so it was replaced by the Corbel font, but even with that substitution the resultant PDF don’t have the extra page.
output.pdf (39.9 KB)


Thanks for the info. We are able to get the missing font details through IWarningCallback for Words library.


We checked and tried (with latest PPT library version) with this code snippet but still facing the same issues on server where arrow is not being converted to its original form and we are not getting warning information through IWarningCallback for PPT.

@mbandapallii I was able to detect the source of your problem, it’s not caused by a missing font it’s related to how Windows render your special characters. PDF documents are fixed documents and that means the PDF don’t only store the content it store also information about ASCII version used, etc. For old versions of Windows (and some of the latest versions of Windows Server) the conflictive arrows are represented in the same way that appear in your output file; you can do a quick test, copy an arrow from the presentation to notepad and you will notice that the arrow have the same shape that the arrow in your output document. So basically is an issue related to the ASCII encoding tables available in your running environment.
Please try the following piece of code to solve your issue, but I highly recommend replace the arrows in the presentation by actual shapes:

...
var saveOpt = new Aspose.Slides.Export.PdfOptions() {
    EmbedFullFonts = true,
    EmbedTrueTypeFontsForASCII = true,
};

// Saves the presentation as a PDF
presentation.Save("C:\\Temp\\output.pdf", Aspose.Slides.Export.SaveFormat.Pdf, saveOpt);

Hi

This solution did not work. The shape was still distorted

Thanks
Lipin

@mbandapallii so bad to hear that, but as I said is an issue related to the ASCII encoding tables available in your running environment and not specifically related to Aspose.Slides API.
Therefore, I will open a Ticket to be reviewed in deep by the dev team, but I highly suggest replace that kind of shapes (generated from text) for real shapes.