Free Support Forum - aspose.com

Convert PDF to PPTX in .NET using Aspose.PDF | documents are all black

Hi, we generate an Excel document. This document we want to save in various formats as a PowerPoint document by converting Excel -> Pdf -> PowerPoint.
Unfortunately for graphic chart the labels below (chart.CategoryAxis.TickLabels) in PowerPoint documents are all black.
Converting in Word works with the same procedure.

What could be the problem?

The program code (convert pdf to pptx):

            Workbook wb = new Workbook(currentTemplate);
            wb.Settings.LanguageCode = CountryCode.Germany;
            wb.Settings.Region = CountryCode.Germany;

            Style style = wb.CreateStyle();
            style.Font.Name = "Ubuntu";
            wb.DefaultStyle = style;

            Aspose.Pdf.Document pdfDoc = null;
            if (FindInputPlaces(wb))
            {
                FillData2Worksheet(famState);
                MemoryStream ms = new MemoryStream();
                switch (storeTo)
                {
                    case OUTPUT_TYPE.EXCEL:
                        wb.Save(ms, SaveFormat.Xlsx);
                        break;
                    case OUTPUT_TYPE.PDF:
                        wb.Save(ms, SaveFormat.Pdf);
                        break;
                    case OUTPUT_TYPE.WORD:
                        wb.Save(ms, SaveFormat.Pdf);
                        pdfDoc = new Aspose.Pdf.Document(ms);
                        pdfDoc.Save(ms, Aspose.Pdf.SaveFormat.DocX);
                        break;
                    case OUTPUT_TYPE.POWERPOINT:
                        wb.Save(ms, SaveFormat.Pdf);
                        pdfDoc = new Aspose.Pdf.Document(ms);
                        pdfDoc.Save(ms, Aspose.Pdf.SaveFormat.Pptx);
                        break;
                    case OUTPUT_TYPE.HTML:
                        wb.Save(ms, SaveFormat.Html);
                        break;
                }
                byte[] bytesArr = ms.ToArray();
                return bytesArr;
            }

The program code to generate the chart in Excel:

                Series aSerie = null;
                StringBuilder strB = null;
                int chartIndex = currentWS.Charts.Add(Aspose.Cells.Charts.ChartType.Line, chartBeginRow, 0, chartEndRow, jahrTemplateColId + colCounter - 1);
                Aspose.Cells.Charts.Chart chart = currentWS.Charts[chartIndex];
                //not show not defined values                
                chart.PlotEmptyCellsType = PlotEmptyCellsType.NotPlotted;
                chart.PlotVisibleCells = true;

                //If the chart is line chart and CategoryAxis is not date axis, please do not set max and min value of axis. - Aspose support, 18.06.2020
                chart.CategoryAxis.TickLabels.Font.Size = 10;
                chart.CategoryAxis.TickLabels.Font.Color = System.Drawing.Color.Black;
                chart.CategoryAxis.TickLabels.Font.Name = "Ubuntu";

                chart.CategoryAxis.Title.Text = "Jahr";

                //settings for Y-Axis    
                chart.ValueAxis.Title.Text = "Beitrag in €";
                chart.ValueAxis.TickLabelPosition = TickLabelPositionType.Low;
                chart.ValueAxis.TickLabels.Font.Size = 10;
                chart.ValueAxis.TickLabels.Font.Color = System.Drawing.Color.Black;
                chart.ValueAxis.TickLabels.Font.Name = "Ubuntu";

                chart.Legend.Position = LegendPositionType.Bottom;

                chart.PlotArea.Area.ForegroundColor = System.Drawing.Color.White;

                StringBuilder xValues = new StringBuilder();
                int iMinYear = histState.AbJahrHistory;
                int iMaxYear = histState.BisJahrHistory;
                xValues.Append("{");
                for (int i = iMinYear; i <= iMaxYear; i++)
                {
                    xValues.Append(i.ToString());
                    if (i < iMaxYear) xValues.Append(",");
                }
                xValues.Append("}");
                int tarifCounter = 0;
                int mainTarifCounter = 0;
                foreach (PKVTarif pT in currentPKVTarifs)
                {
                    if (histState.States.ContainsKey(pT))
                    {
                        TarifBeitragHistoryState tarifHistory = histState.States[pT];

                        strB = new StringBuilder();
                        strB.Append("{");
                        for (int i = histState.AbJahrHistory; i <= histState.BisJahrHistory; i++)
                        {
                            //copy+past Jahr-Column for every year in history
                            var btgEl = tarifHistory.GetBtgHistory4Year(i);
                            strB.Append(btgEl?.HistBeitrag.ToString("#0.00").Replace(",", ".") ?? "#N/A");
                            if (i < histState.BisJahrHistory) strB.Append(",");
                        }
                        strB.Append("}");
                        aSerie = chart.NSeries[chart.NSeries.Add(strB.ToString(), true)];
                        aSerie.Name = tarifHistory.GrpHeader4History();
                        aSerie.XValues = xValues.ToString();
                        //aSerie.Area.Formatting = FormattingType.Custom;
                        if (pT.CompanyId == MAINCOMPANY_ID)
                        {
                            aSerie.Border.Color = GenerateMainCompanyColor(mainTarifCounter++);
                            aSerie.Border.WeightPt = 4.5;
                        }
                        else
                        {
                            aSerie.Border.Color = GenerateRandomColor(currentPKVTarifs.Count, tarifCounter++);
                            aSerie.Border.Transparency = 0.5;
                        }
                    }
                }

@GEWA-COMP_GmbH

Could you please share the generated Excel Workbook at your end in .zip format. We will convert it into PDF and PPTX in our environment and address the issue accordingly.

Here is the generated Excel Workbook
Beitragsentwicklung.zip (29.3 KB)

@GEWA-COMP_GmbH

I have been able to reproduce the issue on our end. A ticket with ID PDFNET-49871 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.