We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Text cutoff when using FoundationSans-Light.otf

There is a problem with text getting cutoff when using FoundationSans-Light.otf in combination with tab.ColumnAdjustment = ColumnAdjustment.AutoFitToContent; When using FreeSans.ttf everything is fine. If we take out AutoFitToContent everything works as expected.

In the reproducer I cannot add FoundationSans-Light.otf as this is a paid font.



With FoundationSans-ligth text is only "On 4-27-2015, CNBC and The Wall Street Journal reported that ISS recommended the shareholder of DuPont to vote in favor Trian’s two of four nominees, Nelson Peltz and John Mayers. Nelson Peltz then released a
statement to CNBC’s Scott Wapner acknowledging ISS’ support. Mr. Peltz further noted that ISS also believed that a change in DuPont’s board is necessary and said that aside from him and Mr. Mayers, ISS also said that
Bob Zatta and Art Winkleblack appeared to be well-qualified nominees. Same day, Reuters cited that sources to the matter said that DuPont was open to last minute settlement discussions with Trian regarding its proxy"

With FreeSans test is " On 4-27-2015, CNBC and The Wall Street Journal reported that ISS recommended the shareholder of DuPont to vote in favor Trian’s two of four nominees, Nelson Peltz and John Mayers. Nelson Peltz then
released a statement to CNBC’s Scott Wapner acknowledging ISS’ support. Mr. Peltz further noted that ISS also believed that a change in DuPont’s board is necessary and said that aside from him and Mr.
Mayers, ISS also said that Bob Zatta and Art Winkleblack appeared to be well-qualified nominees. Same day, Reuters cited that sources to the matter said that DuPont was open to last minute settlement
discussions with Trian regarding its proxy contest against the company."

using Aspose.Pdf;
using Aspose.Pdf.Text;


namespace Aspose
{
public class Program
{
public static void Main(string[] args)
{
// Added document
Document doc = new Document();

//Open font repository (.ttf file) from where it is stored.
Aspose.Pdf.Text.Font myFont = Aspose.Pdf.Text.FontRepository.OpenFont(“Fonts/FoundationSans-Light.otf”);

//Add a page object
Aspose.Pdf.Page page = doc.Pages.Add();

//get PageInfo
var pageInfo = page.PageInfo;

//set properties of page
page.SetPageSize(PageSize.PageLetter.Width, PageSize.PageLetter.Height);
pageInfo.Margin.Left = 27;
pageInfo.Margin.Bottom = 52;
pageInfo.Margin.Right = 27;
pageInfo.Margin.Top = 27;

//Instantiate a table object
Aspose.Pdf.Table tab = new Aspose.Pdf.Table();
//the breaking line
tab.ColumnAdjustment = ColumnAdjustment.AutoFitToContent;

//add row to table
Aspose.Pdf.Row row = tab.Rows.Add();

//add cell to table
Aspose.Pdf.Cell cell = row.Cells.Add();

//Set with column widths of the table
tab.ColumnWidths = “100%”;

TextFragment newText = new TextFragment(“On 4-27-2015, CNBC and The Wall Street Journal reported that ISS recommended the shareholder of DuPont to vote in favor Trian’s two of four nominees, Nelson Peltz and John Mayers. Nelson Peltz then released a statement to CNBC’s Scott Wapner acknowledging ISS’ support. Mr. Peltz further noted that ISS also believed that a change in DuPont’s board is necessary and said that aside from him and Mr. Mayers, ISS also said that Bob Zatta and Art Winkleblack appeared to be well-qualified nominees. Same day, Reuters cited that sources to the matter said that DuPont was open to last minute settlement discussions with Trian regarding its proxy contest against the company.\n”);

var textState = newText.TextState;
textState.Font = myFont;//freesans
textState.FontSize = 6;

Paragraphs pgraph = new Paragraphs();
pgraph.Add(newText);

cell.Paragraphs.Add(newText);

//add the table in paragraphs collection
page.Paragraphs.Add(tab);

doc.Save(“CutOffTextInTable.pdf”);
}
}
}

Hi Daniel,


Thanks for contacting support.

I have tested the scenario using one of my sample fonts and as per my observations, contest against the company is missing in resultant file. For the sake of correction, I have logged it as PDFNET-41401 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNET-41401) have been fixed in Aspose.PDF for .NET 19.5.