Posted by a ceTe Software moderator
Hello Steve,
You can achieve your requirements by scaling to PageEdges. You can do this using the ScaleTo enumerator of our DynamicPDF PrintManager for .NET API. Below is the sample code for it.
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
PageDimensions dimensions = new PageDimensions(PageSize.A4, ceTe.DynamicPDF.PageOrientation.Portrait);
dimensions.BottomMargin = 0;
dimensions.TopMargin = 0;
dimensions.LeftMargin = 0;
dimensions.RightMargin = 0;
Page page = new Page(dimensions);
document.Pages.Add(page);
Table2 table = new Table2(12f, 46f, 600, 794);
table.Border.LineStyle = LineStyle.None;
table.CellDefault.Border.LineStyle = LineStyle.None;
table.CellDefault.Padding.Top = 0;
table.CellDefault.Padding.Left = 0;
// Add columns to the table
table.Columns.Add(176f);
table.Columns.Add(176f);
table.Columns.Add(176f);
for (int rowindex = 0; rowindex < 15; rowindex++)
table.Rows.Add(54f);
Table2 labeltable = new Table2(0, 0, 167f, 45f, Font.Helvetica, 8);
labeltable.Border.LineStyle = LineStyle.None;
labeltable.CellDefault.Border.LineStyle = LineStyle.None;
labeltable.CellDefault.Padding.Top = 0;
labeltable.CellDefault.Padding.Left = 0;
labeltable.Columns.Add(121f);
Row2 row = labeltable.Rows.Add(45f);
TextArea text = new TextArea("one\ntwo\nthree\nfour", 0, 0, 121f, 41f);
text.VAlign = VAlign.Center;
text.FontSize = 8;
text.Align = TextAlign.Left;
Cell2 cell = labeltable.Rows[0].Cells.Add(text);
cell.VAlign = VAlign.Center;
for (int rowIndex = 0; rowIndex < table.Rows.Count; rowIndex++)
for (int col = 0; col < table.Columns.Count; col++)
table.Rows[rowIndex].Cells.Add(labeltable);
// Add the table to the page
page.Elements.Add(table);
//Below is the code to send the generated PDF to printer by scaling it to PageEdges
ceTe.DynamicPDF.Printing.InputPdf pdf = new ceTe.DynamicPDF.Printing.InputPdf(document.Draw());
PrintJob printJob = new PrintJob(Printer.Default, pdf);
AutoPageScaling autoPageScaling = new AutoPageScaling(ScaleTo.PageEdges, false, false);
printJob.PrintOptions.Scaling = autoPageScaling;
printJob.Print();
printJob.Dispose();
Thanks,
ceTe Software Support Team.