Free Support Forum - aspose.com

Arrow Size issue

We are creating arrows in pdf using the below code snippet. Some times arrow thickness changes and get the difference between arrows. Can you please let us know what we are missing and how to resolve this issue.

//code snippet

Cell cellArrow = rowYesContent.Cells.Add();
cellArrow.Alignment = AlignmentType.Left;
cellArrow.VerticalAlignment = VerticalAlignmentType.Center;
Sections sections = request.Pdf.Sections;
Section sec1 = request.Pdf.Sections[sections.Count - 1];
Graph endGraph1 = new Graph(sec1, 30, 2);
cellArrow.Paragraphs.Add(endGraph1);
float[] linePosArr1 = new float[] { 0, 0, 30, 0 };
Line endLine1 = new Line(endGraph1, linePosArr1);
endLine1.GraphInfo.LineCapMode = 0;
endLine1.GraphInfo.IsAddedArrowAtEnd = true;
endGraph1.Shapes.Add(endLine1);


Cell cellArrow1 = rowNA.Cells.Add();
cellArrow1.Alignment = AlignmentType.Left;
cellArrow1.VerticalAlignment = VerticalAlignmentType.Center;
Sections sections1 = request.Pdf.Sections;
Section sec2= request.Pdf.Sections[sections.Count - 1];
Graph endGraph2 = new Graph(sec1, 30, 2);
cellArrow1.Paragraphs.Add(endGraph2);
float[] linePosAr2 = new float[] { 0, 0, 30, 0 };
Line endLine2 = new Line(endGraph2, linePosAr2);
endLine2.GraphInfo.LineCapMode = 0;
endLine2.GraphInfo.IsAddedArrowAtEnd = true;
endGraph2.Shapes.Add(endLine2);

Hi Saikat,


Thanks for contacting support.

I have tested the scenario using following code snippet (based on the code which you have shared) and I am unable to notice the difference in width of both arrows. I have used latest release version of Aspose.Pdf for .NET 7.9.0. For your reference, I have also attached the resultant PDF file which is generated over my end.

[C#]

//Instntiate the Pdf object by calling
its empty constructor
<o:p></o:p>

Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

//Create the section in the Pdf object

Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

//Instantiate a table object

Aspose.Pdf.Generator.Table tab1 = new Aspose.Pdf.Generator.Table();

//Add the table in paragraphs collection of the desired section

sec1.Paragraphs.Add(tab1);

//Set with column widths of the table

tab1.ColumnWidths = "100 100 100";

//Set default cell border using BorderInfo object

tab1.DefaultCellBorder = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 0.1F);

//Set table border using another customized BorderInfo object

tab1.Border = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 1F);

//Create MarginInfo object and set its left, bottom, right and top margins

Aspose.Pdf.Generator.MarginInfo margin = new Aspose.Pdf.Generator.MarginInfo();

margin.Top = 5f;

margin.Left = 5f;

margin.Right = 5f;

margin.Bottom = 5f;

//Set the default cell padding to the MarginInfo object

tab1.DefaultCellPadding = margin;

//Create rows in the table and then cells in the rows

Aspose.Pdf.Generator.Row row1 = tab1.Rows.Add();

row1.Cells.Add("col1");

Aspose.Pdf.Generator.Cell cellArrow = row1.Cells.Add();

cellArrow.Alignment = Aspose.Pdf.Generator.AlignmentType.Left;

cellArrow.VerticalAlignment = Aspose.Pdf.Generator.VerticalAlignmentType.Center;

Graph endGraph1 = new Graph(sec1, 30, 2);

cellArrow.Paragraphs.Add(endGraph1);

float[] linePosArr1 = new float[] { 0, 0, 30, 0 };

Line endLine1 = new Line(endGraph1, linePosArr1);

endLine1.GraphInfo.LineCapMode = 0;

endLine1.GraphInfo.IsAddedArrowAtEnd = true;

endGraph1.Shapes.Add(endLine1);

Aspose.Pdf.Generator.Cell cellArrow1 = row1.Cells.Add();

cellArrow1.Alignment = Aspose.Pdf.Generator.AlignmentType.Left;

cellArrow1.VerticalAlignment = Aspose.Pdf.Generator.VerticalAlignmentType.Center;

Graph endGraph2 = new Graph(sec1, 30, 2);

cellArrow1.Paragraphs.Add(endGraph2);

float[] linePosAr2 = new float[] { 0, 0, 30, 0 };

Line endLine2 = new Line(endGraph2, linePosAr2);

endLine2.GraphInfo.LineCapMode = 0;

endLine2.GraphInfo.IsAddedArrowAtEnd = true;

endGraph2.Shapes.Add(endLine2);

//Save the Pdf

pdf1.Save(“c:/pdftest/TableResult.pdf”);