Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Rotate pdf table

Set location for table


What I have tried:

PdfPTable pdfTable = new PdfPTable(9);
            BaseFont bfCalibri = BaseFont.CreateFont("c:\\windows\\fonts\\calibri.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
            iTextSharp.text.Font calibri = new iTextSharp.text.Font(bfCalibri, 8);
            iTextSharp.text.Font calibri2 = new iTextSharp.text.Font(bfCalibri, 9);
            PdfPCell cell = new PdfPCell(new Phrase("EVIDENICIJA UTROŠKA GORIVA I MAZIVA"));
            cell.Colspan = 9;
            cell.HorizontalAlignment = 1;


            pdfTable.AddCell(cell);
            cell.VerticalAlignment = 1;
            cell.HorizontalAlignment = 1;
            cell.VerticalAlignment = 1;
Posted
Comments
Graeme_Grant 17-May-23 7:16am    
what is the issue?
Stylus STYLUS 17-May-23 7:18am    
Rotate pdf table

Set location for table
Graeme_Grant 17-May-23 7:22am    
What's the issue? You want us to write the code for you?
Stylus STYLUS 17-May-23 7:24am    
Me i Have complete code, need simple solution in one row to rotate table

Complete code

//Exporting to PDF

string folderPath = "C:\\PDFs\\";
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
using (FileStream stream = new FileStream(folderPath + "Putni nalog PN3.pdf", FileMode.Create))
{
iTextSharp.text.Font calibriTitle = new iTextSharp.text.Font(bfCalibri, 12);
iTextSharp.text.Font calibriSubTitle = new iTextSharp.text.Font(bfCalibri, 10);
iTextSharp.text.Font calibriPN1 = new iTextSharp.text.Font(bfCalibri, 18);
Document pdfDoc = new Document(PageSize.A4.Rotate(), 10f, 10f, 10f, 0f);
//Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream);
pdfDoc.Open();
//pdfDoc.Add(new ListItem(korisnik_programa, calibriTitle));
// pdfDoc.Add(new ListItem(adresa, calibriSubTitle));
pdfDoc.Add(new ListItem(mesto, calibriSubTitle));
// pdfDoc.Add(new ListItem("JIB:" + " " + jib2, calibriSubTitle));
// pdfDoc.Add(new ListItem("PIB:" + " " + pib2, calibriSubTitle));
// pdfDoc.Add(new ListItem("Žiro-racun:" + " " + ziro_racun2, calibriSubTitle));
//pdfDoc.Add(new ListItem("E-mail:" + " " + e_mail, calibriSubTitle));
pdfDoc.Add(table);
pdfDoc.Add(new ListItem(" "));
pdfDoc.Add(new ListItem(" "));
//pdfDoc.Add(pdfTable);
// pdfDoc.Add(pdfTable2);
//pdfDoc.Add(pdvTable); ////tabela donja mesto i tip vozaca


PdfContentByte cb = writer.DirectContent;
PdfContentByte cb1 = writer.DirectContent;
//cb.SetColorStroke(new BaseColor(41, 128, 185));// boja linija


//iTextSharp.text.Rectangle fakturisao = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 120f, pdfDoc.PageSize.Width - 520f, 50f);
iTextSharp.text.Rectangle PN1 = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 50f, 594f, pdfDoc.PageSize.Width - 98f, 50f);
//iTextSharp.text.Rectangle glavnivozac1 = new iTextSharp.text.Rectangle(340f, 550f, 160f, 50f, 270);
iTextSharp.text.Rectangle glavnivozac1 = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 332f, pdfDoc.PageSize.Width - 401f, 50f); //1 vozac
iTextSharp.text.Rectangle glavnivozac2 = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 302f, pdfDoc.PageSize.Width - 401f, 50f); //2 vozac
iTextSharp.text.Rectangle glavnivozac3 = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 272f, pdfDoc.PageSize.Width - 401f, 50f); //3 vozac

iTextSharp.text.Rectangle pomocnivozac1 = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 332f, pdfDoc.PageSize.Width - 210f, 50f); //1 pomocni vozac
iTextSharp.text.Rectangle pomocnivozac2 = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 302f, pdfDoc.PageSize.Width - 210f, 50f); //2 pomocni vozac
iTextSharp.text.Rectangle pomocnivozac3 = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 272f, pdfDoc.PageSize.Width - 210f, 50f); //3 pomocni vozac

iTextSharp.text.Rectangle relacija = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 226f, pdfDoc.PageSize.Width - 401f, 50f); //relacija
iTextSharp.text.Rectangle serija = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 460f, pdfDoc.PageSize.Width - 401f, 50f); //serija
iTextSharp.text.Rectangle mjesto = new iTextSharp.text.Rectangle(pdfDoc.PageSize.Width - 140f, 509f, pdfDoc.PageSize.Width - 401f, 50f); //mjesto
Stylus STYLUS 17-May-23 7:26am    
Cant add complete code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900