Free Support Forum -

PPTX to PDF: Automatic wrapped text exported with line breaks in exported PDF (C# .NET)

The following code will create a new PowerPoint with a text field, which contains text which will be wrapped.

If this PowerPoint is saved as PDF and you select the text in the resulting PDF and copy it to the clipboard, the text contains line breaks.

Here the code example:

        using (var presentation = new Presentation())
            var shape = presentation.Slides[0].AddAutoShape(new RectangleF(10, 10, 150, 100));
            shape.LineFormat.FillFormat.FillType = FillType.NoFill;
            shape.FillFormat.FillType = FillType.Solid;
            shape.FillFormat.SolidFillColor.Color = Color.Aquamarine;

            shape.TextFrame.Text = "This is some longer text which should wrap lines, but doesn't contain line breaks.";
            shape.TextFrame.TextFrameFormat.AutofitType = TextAutofitType.None;
            shape.TextFrame.TextFrameFormat.WrapText = NullableBool.True;
            shape.TextFrame.TextFrameFormat.CenterText = NullableBool.False;
            shape.TextFrame.TextFrameFormat.AnchoringType = TextAnchorType.Top;

            shape.TextFrame.TextFrameFormat.MarginTop = 3;
            shape.TextFrame.TextFrameFormat.MarginBottom = 3;
            shape.TextFrame.TextFrameFormat.MarginLeft = 3;
            shape.TextFrame.TextFrameFormat.MarginRight = 3;

            // set text properties
            foreach (IParagraph paragraph in shape.TextFrame.Paragraphs)
                paragraph.ParagraphFormat.Alignment = TextAlignment.Left;

                foreach (IPortion p in paragraph.Portions)
                    p.PortionFormat.FontHeight = 16;
                    p.PortionFormat.FillFormat.FillType = FillType.Solid;
                    p.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;

            presentation.Save("WrappedTextIssueWhenCopiedFromPdf.pdf", SaveFormat.Pdf);


I have worked with sample code provided by you and have been able to generate the identical PPTX and PDF files as attached for your reference. The code has generated the output as it should have. Can you please share the expected output that you feel Aspose.Slides should generate. (32.4 KB)


the problem isn’t the visual output in PDF, that’s fine. But, if a user tries to copy the text from the generated PDF to another application, the copied text contains line breaks which were not present in the original text.


Can you please explain following in more details so that we may investigate issue in detail. Also please share complete working sample project reproducing issue.

Okay, take the PDF generated from the sample code.

  1. Open it in a PDF viewer (I’ve used Adobe Reader).
  2. Select the text in the PDF with your mouse.
  3. Press Ctrl-C or use context menu to copy the text into the clipboard.
  4. Open Notepad or any other text editor
  5. Paste the text from the clipboard into the text editor

You will see, the text consists of multiple lines. Expected result would be all text in one line (like in the source code).


I have copied the text from generated PDF and paste that to text editor in MAC. There seems to be no issue and all data appears to be in single line. For your kind reference, I have attached the image as well.

TextEditorView.png (201.0 KB)

On Windows there are line breaks. I’ve also attached a screenshot.
It’s for Adobe Reader as well as for Google Chrome PDF viewer.

2019-12-02 181502.png (18.0 KB)

We are using Aspose.Slides 19.10.0.


I have observed the image shared by you. An issue with ID SLIDESNET-41591 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESNET-41591) have been fixed in this update.