줄 바꿈 결정

다음 코드 스니펫은 Aspose.PDF.Drawing 라이브러리와 함께 작동합니다.

다중 행 TextFragment의 줄 바꿈 추적

Aspose.PDF for .NET는 텍스트 추가 시나리오에서 다중 행 텍스트 조각의 줄 바꿈을 로깅(추적)하는 백그라운드 처리를 제공합니다. 텍스트 조각의 줄 바꿈을 추적하기 위해 Page 클래스의 GetNotifications() 메서드를 다음과 같이 사용할 수 있습니다:

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void DetermineLineBreak()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_Text();

    // Create PDF document
    using (var document = new Aspose.Pdf.Document())
    {
        Aspose.Pdf.Page page = document.Pages.Add();

        for (int i = 0; i < 4; i++)
        {
            var text = new Aspose.Pdf.Text.TextFragment("Lorem ipsum \r\ndolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
            text.TextState.FontSize = 20;
            page.Paragraphs.Add(text);
        }

        // Save PDF document
        document.Save(dataDir + "DetermineLineBreak_out.pdf");

        string notifications = document.Pages[1].GetNotifications();
        File.WriteAllText(dataDir + "notifications_out.txt", notifications);
    }
}