Vertical Layout
01010100010100100100100101000111 opened this issue · comments
TŔÏGGÈR commented
Using latest version against .Net 4.8
I am trying to get a layout like;
However when I try to use Rotate, the text does not follow, I have tried using AlignMiddle / all other methods but it won't have it, all I get is;
Code I have at the min is;
using QuestPDF.Fluent;
using QuestPDF.Infrastructure;
using System.Collections.Generic;
using QuestPDF.Helpers;
namespace Proj.Infrastructure.Pdf
{
public class ItemLabelDocument : IDocument
{
private List<ItemDetail> _model { get; set; } =
[
new()
{
Code = "123456",
IsLotControlled = true,
LotNumber = "321654",
BestBeforeEnd = "01-01-2024",
Description = "Test Item",
Barcode = "540896704598"
},
new()
{
Code = "123456",
IsLotControlled = true,
LotNumber = "321654",
BestBeforeEnd = "01-01-2024",
Description = "Test Item",
Barcode = "540896704598"
}
];
public DocumentMetadata GetMetadata() => DocumentMetadata.Default;
public DocumentSettings GetSettings() => DocumentSettings.Default;
public void Compose(IDocumentContainer container)
{
foreach (var item in _model)
{
container
.Page(page =>
{
page.Size(new PageSize(10.5f, 15.3f, Unit.Centimetre));
page.Margin(0.2f, Unit.Centimetre);
page.Content().Element(c => ComposeContent(c, item));
});
}
}
private void ComposeContent(IContainer container, ItemDetail item)
{
container.Extend().Table(table =>
{
table.ColumnsDefinition(columns =>
{
columns.RelativeColumn();
columns.RelativeColumn();
columns.RelativeColumn();
columns.RelativeColumn();
});
table.Cell().Row(1).Column(1).Element(c => Block(c, 1)).Element(e =>
{
e.DebugArea().Extend().Rotate(270).Text("sdfhlkjsdhjfklsd");
});
table.Cell().Row(1).Column(2).Element(c => Block(c, 0)).Rotate(270).Text("dflkjghlskdfjhg");
table.Cell().Row(1).Column(3).Element(c => Block(c, 1)).Rotate(270).Text("dflkjghlskdfjhg");
table.Cell().Row(1).Column(4).Element(c => Block(c, 0)).Rotate(270).Text("dflkjghlskdfjhg");
});
static IContainer Block(IContainer container, int border)
{
return container
.Padding(4)
.Extend()
.Border(border);
}
}
public class ItemDetail
{
public string Code { get; set; }
public string Barcode { get; set; }
public string Description { get; set; }
public bool IsLotControlled { get; set; }
public string LotNumber { get; set; }
public string BestBeforeEnd { get; set; }
}
}
}
Am I missing something here?
TŔÏGGÈR commented
Just messed some more, seems I should be using RotateLeft() instead - working fine now.