When you convert a PDF to PowerPoint, underlined and struck-through text should stay underlined and struck through, and it should still behave that way after you edit the slide. In this tutorial, you’ll convert a PDF to PPTX with Aspose.PDF for .NET, keep that formatting as regular PowerPoint text formatting, and learn how to switch back to drawn lines when you need them.

Why preserve underline and strikeout in PDF to PPTX conversion

A PDF doesn’t store underline or strikeout as part of the text. The line you see under or through a word is usually a separate line drawn on the page in the right position.

If a converter copies that line to the slide as-is, it becomes a graphic. The slide looks correct until you edit it. Change a word, and the line stays where it was, now too short, too long, or under the wrong text.

Aspose.PDF for .NET recognizes these lines during PDF-to-PPTX conversion and applies them to the text as underline and strikeout formatting. The formatting then moves with the words, and you can switch it on or off from PowerPoint’s font controls like any other style.

Using Aspose.PDF to Preserve Underline and Strikeout in PDF to PPTX Conversion

  • A .NET project. A console app is enough for this tutorial.
  • Aspose.PDF for .NET 26.9 or later, installed from NuGet.
  • A PDF with selectable text that includes some underlined or struck-through words.
  • PowerPoint, or another app that opens PPTX files, to check the result.

Install the package with the .NET CLI:

dotnet add package Aspose.PDF

Or, from the Package Manager Console in Visual Studio:

Install-Package Aspose.PDF

If the project already references Aspose.PDF, update the package to 26.9 or later.

Convert the PDF and keep underline and strikeout

The conversion takes three steps: load the PDF, create the PowerPoint save options, and save the result as a presentation.

using Aspose.Pdf;

// Load the PDF you want to convert
using var document = new Document("input.pdf");

// Keep underline and strikeout as editable text formatting
var options = new PptxSaveOptions
{
    RecognizeUnderlineAndStrikeout = true
};

// Save the PDF as a PowerPoint presentation
document.Save("output.pptx", options);

Here’s what each part does:

  1. Load the PDF. Replace input.pdf with the path to your file. The using declaration closes the file when the conversion finishes.
  2. Create the save options. The PowerPoint save options control how the PDF is rebuilt as slides. RecognizeUnderlineAndStrikeout is already true by default, so this line doesn’t change the behavior. It does make your intent visible to anyone who reads the code later.
  3. Save the presentation. Pass the output path and the options to Save. Aspose.PDF writes output.pptx in a single call.

Check the result in PowerPoint

Open output.pptx and find a slide that contains underlined text. Click inside the underlined word. The Underline button on the Home tab should appear selected. Struck-through text works the same way with the Strikethrough button.

To confirm that the formatting belongs to the text, type over an underlined word. The underline should follow the new text rather than stay behind as a separate line.

Render underline and strikeout as graphics instead

Sometimes you want the slide to match the PDF’s drawing exactly rather than convert the lines into text formatting. In that case, set the option to false, and Aspose.PDF renders the lines as graphics:

var options = new PptxSaveOptions
{
    RecognizeUnderlineAndStrikeout = false
};

This is also a quick way to compare the two approaches: convert the same PDF once with each setting and open both presentations side by side.

Convert a folder of PDFs

The same approach works for batch conversion. This example converts every PDF in a folder and saves each presentation next to its source file:

using Aspose.Pdf;

foreach (var pdfPath in Directory.GetFiles("pdfs", "*.pdf"))
{
    using var document = new Document(pdfPath);

    var options = new PptxSaveOptions
    {
        RecognizeUnderlineAndStrikeout = true
    };

    document.Save(Path.ChangeExtension(pdfPath, ".pptx"), options);
}

Get a Free License and Explore More

You can request a temporary free license to evaluate the functionality without cost. Visit the Aspose temporary license page to obtain one.

FAQs

Do I have to set the option to keep underline and strikeout? No. In Aspose.PDF for .NET 26.9 and later, recognition is on by default. Setting it explicitly makes the intent clear in your code, and you only need to change it if you want the lines drawn as graphics instead.

Does this work with scanned PDFs? No. A scanned page is an image, so there is no text for the converter to format. Run OCR on the PDF first to add a text layer, then convert it.

Can I convert only some pages? The save options apply to the whole document. To convert selected pages, create a new PDF that contains only those pages and convert that file instead.

Can I convert a PDF to PowerPoint without writing code? Yes. For one-off files, you can use the free Aspose PDF to PPTX online converter. Use the API when you want to automate conversions or control conversion options.

Do I need a license? You can try the library without a license, but it runs in evaluation mode and restricts the output. Request a free temporary license to test with full documents, and buy a license for production use.

Next steps

To tune other parts of the conversion, see the PDF to PowerPoint conversion guide and the PptxSaveOptions API reference. If a document doesn’t convert as expected, post a sample file on the Aspose.PDF support forum.

Before you test with your own documents, get a free temporary license so evaluation limits don’t affect the output.