Aspose pdf to pptx not working, giving repair error when opening pptx file

@bohoirup

We are afraid that we cannot offer any workaround at the moment as the ticket is not fully yet investigated. We need to determine first why this is happening. Your concerns have been recorded as well and we will consider them during investigation. We will let you know as soon as we have some update. Please be patient and spare us some time.

We apologize for the inconvenience.

@asad.ali

Hi, any updates on this?

Hard to keep finding excuses for this not working and no idea of when it will be fixed

Best regards

@bohoirup

Your concerns have already be taken into account and we are currently trying to investigate the reasons behind this issue. We will surely let you know as soon as our investigation is complete and we have some updates about ticket resolution. Please spare us some time.

We are sorry for the inconvenience.

@bohoirup

Please use the following code snippet
First save the new PDF file and then convert it to PPTX

Aspose.Pdf.Document pdf = new Aspose.Pdf.Document();
Aspose.Pdf.Page page1 = pdf.Pages.Add();
Aspose.Pdf.HtmlFragment htmlFragment = new Aspose.Pdf.HtmlFragment("<h1>HTML String</h1>");
/*
    You can set system font for htmlFragment like this
htmlFragment.TextState = new TextState();
htmlFragment.TextState.Font = FontRepository.FindFont("Courier New");
*/

page1.Paragraphs.Add(htmlFragment);
Aspose.Pdf.PptxSaveOptions pptx_savetest = new Aspose.Pdf.PptxSaveOptions();

using (MemoryStream ms = new MemoryStream())
{
    pdf.Save(ms);
    Document pdf2 = new Document(ms);
    pdf2.Save("..\\..\\..\\PDFToPPT_out.pptx", pptx_savetest);
}

@asad.ali

This gives me the exact same error as before when opening the PPTX file?

Do i need to upgrade to latest version of aspose.pdf?

@bohoirup

Please use 22.12 version of the API in order to test using the suggested code snippet and let us know if you still face any issues.

Still get the same error and now I also get a trial license error?

Do I need a new key or?

best regards

@bohoirup

We are sorry for the trouble. Can you kindly share a sample console application for our reference which is able to reproduce the same issue so that we can test the scenario in our environment and address it accordingly.

I am just using the exact code you sent me and have upgraded to 22.12, so you can just past this code into a console app

                Aspose.Pdf.Document testPdf = new Aspose.Pdf.Document();
            Aspose.Pdf.Page page1 = testPdf.Pages.Add();
            Aspose.Pdf.HtmlFragment htmlFragment = new Aspose.Pdf.HtmlFragment("<h1>HTML String</h1>");
            /*
                You can set system font for htmlFragment like this
            htmlFragment.TextState = new TextState();
            htmlFragment.TextState.Font = FontRepository.FindFont("Courier New");
            */

            page1.Paragraphs.Add(htmlFragment);
            Aspose.Pdf.PptxSaveOptions pptx_savetest = new Aspose.Pdf.PptxSaveOptions();

            using (MemoryStream ms = new MemoryStream())
            {
                testPdf.Save(ms);
                Aspose.Pdf.Document pdf2 = new Aspose.Pdf.Document(ms);
                pdf2.Save(OutputPath + "PDFToPPT_out.pptx", pptx_savetest);
            }

@asad.ali The license is not an issue, I just pasted the code in before setting the licenses … so sorry about that, just forget it.

The issue is still the error int the PPTX file (needs repair on opening)

@bohoirup

We tested the case again in our environment and did not notice any issue in the generated output PPTX. Please find the attached file and open it at your end and share the screenshot with us in case it still shows any warning. PDFToPPT_out.zip (8.7 KB)

Please send me the console app you have made, because I am still getting the same error.

Using the exact code pasted above on version 22.12PDFToPPT_out.zip (7.7 KB)

image.png (3.1 KB)

@asad.ali don’t know if I need to tag you but now i have

@bohoirup

Please download the sample console application from this link.

It seems to be in my .net core 6 application :-\ and I am sure this is the 1 millionth time you have heard this, so sorry about that.

Can you give me any suggestion on how to figure out why this is happening?

I have tried creating a new .net core 6 mvc app and the file generation works fine, but even if I make a new controller in my current project and use the exact code the file generation fails with the repair error.

I have checked many times that I am using version 22.12 of Aspose.PDF so I can’t figure out why I get different results.

Both Assembly and fileVersion is 22.12.0
image.png (26.4 KB)

And these are my Nuget packages
image.png (24.0 KB)

hope you can help me with some clue on how to fix this

@asad.ali think I have found part of the problem at least.

We are using this
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(LanguageCode);

To set the users language code, when this is set to LanguageCode = “da” then I get the repair error on the pptx file, but when I change it to LanguageCode = “en” it works

Problem is I cannot change it to “en” because our users is running “da” interface

@asad.ali It is not the
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(LanguageCode);

It is this culture setting that makes causes the error in the pptx file, for some odd reason I hope you can help me with.
We are setting the CultureProvider cookie in out application using this code, and it seems it does not work with Aspose

    _HttpContextAccessor.HttpContext.Response.Cookies.Append(
        CookieRequestCultureProvider.DefaultCookieName,
        CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(LanguageCode)),
        new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) }
    );

@bohoirup

Another ticket as PDFNET-53388 has been logged in our issue tracking system for further investigation on this case. We will surely look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We apologize for your inconvenience.

@asad.ali

Where are you on this? been 13 days without hearing from you?