Note that there are some explanatory texts on larger screens.

plurals
  1. POCode isn't drawing a horizontal line in my PDF
    primarykey
    data
    text
    <p>I'm trying to add a horizontal line on top to divide the header text from the actual values in my pdf file: <img src="https://i.stack.imgur.com/CJixV.jpg" alt="enter image description here"></p> <p>Here's my code:</p> <pre><code>public class StudentList { public void PrintStudentList(int gradeParaleloID) { StudentRepository repo = new StudentRepository(); var students = repo.FindAllStudents() .Where(s =&gt; s.IDGradeParalelo == gradeParaleloID); try { Document document = new Document(PageSize.LETTER); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Alumnos.pdf", FileMode.Create)); document.Open(); PdfContentByte cb = writer.DirectContent; cb.SetLineWidth(2.0f); // Make a bit thicker than 1.0 default cb.SetGrayStroke(0.95f); // 1 = black, 0 = white cb.MoveTo(20, 30); cb.LineTo(400, 30); cb.Stroke(); PdfPTable table = new PdfPTable(3); float[] widths = new float[] { 0.6f, 0.75f, 2f }; table.SetWidths(widths); PdfPCell numeroCell = new PdfPCell(new Phrase("Nro.")); numeroCell.Border = 0; numeroCell.HorizontalAlignment = 0; table.AddCell(numeroCell); PdfPCell codigoCell = new PdfPCell(new Phrase("RUDE")); codigoCell.Border = 0; codigoCell.HorizontalAlignment = 0; table.AddCell(codigoCell); PdfPCell nombreCell = new PdfPCell(new Phrase("Apellidos y Nombres")); nombreCell.Border = 0; nombreCell.HorizontalAlignment = 0; table.AddCell(nombreCell); int c = 1; foreach (var student in students) { PdfPCell cell = new PdfPCell(new Phrase(c.ToString())); cell.Border = 0; cell.HorizontalAlignment = 0; table.AddCell(cell); cell = new PdfPCell(new Phrase(student.Rude.ToString())); cell.Border = 0; cell.HorizontalAlignment = 0; table.AddCell(cell); cell = new PdfPCell(new Phrase(student.LastNameFather + " " + student.LastNameMother + " " + student.Name)); cell.Border = 0; cell.HorizontalAlignment = 0; table.AddCell(cell); c++; } table.SpacingBefore = 20f; table.SpacingAfter = 30f; document.Add(table); document.Close(); } catch (DocumentException de) { Debug.WriteLine(de.Message); } catch (IOException ioe) { Debug.WriteLine(ioe.Message); } } } </code></pre> <p>I don't understand why the cb.Stroke() isn't working. Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload