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

Free Support Forum - aspose.com

Ellipse.Bottom not being respected

I am working on a PDF that will have a table of letters or words, and some of those items will be circled. To do this I am trying to add an ellipse into a cell and position that ellipse so that it encompasses whatever word or letter is in the cell.


My first attempt at this used Aspose.Pdf.Drawing.Circles, and it works great for single letters. When I tried to change the shape from a circle to an ellipse, the positioning changed drastically different and I cannot alter the vertical position at all.

I have included some basic code to illustrate this problem.


Aspose.Pdf.Document pdf = new Aspose.Pdf.Document();

Aspose.Pdf.Page curPage = pdf.Pages.Add();
Aspose.Pdf.Table table = new Aspose.Pdf.Table();
table.Margin = new Aspose.Pdf.MarginInfo(100f, 20f, 20f, 100f);
curPage.Paragraphs.Add(table);

Aspose.Pdf.Cell cell = table.Rows.Add().Cells.Add();
Aspose.Pdf.Text.TextFragment txtFrag = new Aspose.Pdf.Text.TextFragment(“Hello”);
Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(0, 0);

Aspose.Pdf.Drawing.Ellipse ellipse = new Aspose.Pdf.Drawing.Ellipse(0, 0, 30f, 10f);
ellipse.GraphInfo.Color = Aspose.Pdf.Color.Green;
ellipse.Bottom = 20f; //this value is not respected, changing it appears to have no effect on
graph.Shapes.Add(ellipse);

Aspose.Pdf.Drawing.Circle circle = new Aspose.Pdf.Drawing.Circle(0, 0, 15f);
circle.GraphInfo.Color = Aspose.Pdf.Color.Red;
graph.Shapes.Add(circle);

cell.Paragraphs.Add(txtFrag);
cell.Paragraphs.Add(graph);

Hi Mohammed,


Thanks for you inquiry. We will appreciate it if you please share a sample PDF to describe exactly your requirement. So we will look into it and guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

I have attached a PDF with some samples of how it works well with Circles, but not with Ellipses. My issue is that we are making a report card where instructors can mark items the student has accomplished. Visually we want the item to be circled (or in the case of wider items ellipsed).


The red circle is working perfectly to circle the Z.

The orange circle is too tall when circling the word Orange, so we need an ellipse instead.

The blue ellipse would fit nicely if I could tweak the position to align it correctly. This is where I believe there is a bug in the Aspose engine.

I have also included the code to create the pdf so you can see the objects I’m using.



Aspose.Pdf.Document pdf = new Aspose.Pdf.Document();

Aspose.Pdf.Page curPage = pdf.Pages.Add();
Aspose.Pdf.Table table = new Aspose.Pdf.Table();
table.Margin = new Aspose.Pdf.MarginInfo(100f, 20f, 20f, 100f);
curPage.Paragraphs.Add(table);

Aspose.Pdf.Row row = table.Rows.Add();
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“A”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“B”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“C”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“D”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“E”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“F”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“G”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“H”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“I”));

row = table.Rows.Add();
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“J”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“K”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“L”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“M”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“N”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“O”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“P”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“Q”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“R”));

row = table.Rows.Add();
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“S”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“T”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“U”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“V”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“W”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“X”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“Y”));

Aspose.Pdf.Cell cell = row.Cells.Add();

Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(0, 0);
Aspose.Pdf.Drawing.Circle circle = new Aspose.Pdf.Drawing.Circle(0, 0, 6f);
circle.GraphInfo.Color = Aspose.Pdf.Color.Red;
circle.PosX = 3f;
circle.PosY = -5f;
graph.Shapes.Add(circle);
cell.Paragraphs.Add(graph);
cell.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“Z”));


table = new Aspose.Pdf.Table();
table.Margin = new Aspose.Pdf.MarginInfo(100f, 20f, 20f, 100f);
table.DefaultCellPadding = new Aspose.Pdf.MarginInfo(10, 10, 10, 10);
curPage.Paragraphs.Add(table);

row = table.Rows.Add();
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“GREEN”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“YELLOW”));

cell = row.Cells.Add();
graph = new Aspose.Pdf.Drawing.Graph(0, 0);
Aspose.Pdf.Drawing.Ellipse ellipse = new Aspose.Pdf.Drawing.Ellipse(0, 0, 40f, 20f);
ellipse.GraphInfo.Color = Aspose.Pdf.Color.Blue;
ellipse.Bottom = -40f; //THIS VALUE IS IGNORED
graph.Shapes.Add(ellipse);
cell.Paragraphs.Add(graph);
cell.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“BLUE”));


row = table.Rows.Add();
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“PURPLE”));
row.Cells.Add().Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“RED”));

cell = row.Cells.Add();
graph = new Aspose.Pdf.Drawing.Graph(0, 0);
circle = new Aspose.Pdf.Drawing.Circle(0, 0, 30f);
circle.GraphInfo.Color = Aspose.Pdf.Color.Orange;
circle.PosX = 20f;
circle.PosY = -5f;
graph.Shapes.Add(circle);
cell.Paragraphs.Add(graph);
cell.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“ORANGE”));

Hi Mohammed,


Thanks
for sharing the code snippet.
<o:p></o:p>

I
have tested the scenario and I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWNET-37930 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated 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 PDFNEWNET-37930) have been fixed in Aspose.Pdf for .NET 10.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.