I am creating a barcode PDF file. I want the barcode to take up most of the space on the page, but I also want the product name in smaller font underneath.
My page dimensions are 4" x 1" (these dimensions fit a label size)
No matter what I do, setting the height to 1" always produces a line break between the 2 paragraphs of text. If I set the height to 2", then it works. The barcode is always on the first page, which is exactly what I want, but the product name never is displayed with it.
Here is my code:
Code:
Document document = new Document();
Section section = document.AddSection();
section.PageSetup.PageWidth = "4in";
section.PageSetup.PageHeight = "1in";
Paragraph paragraph = section.AddParagraph();
paragraph.Format.Font.Name = "CODE39_FONT";
paragraph.Format.Font.Size = 48;
paragraph.Format.SpaceBefore = -65;
paragraph.Format.LeftIndent = -45;
paragraph.AddText("0023516890992315");
paragraph = section.AddParagraph("Product Name Goes Here");
paragraph.Format.Font.Size = 10;
paragraph.Format.PageBreakBefore = false;
paragraph.Format.SpaceBefore = 5;
paragraph.Format.LeftIndent = -45;
PdfDocumentRenderer renderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);
renderer.Document = document;
renderer.RenderDocument();
renderer.PdfDocument.Save("barcode.pdf");
Process.Start("barcode.pdf");
Any help will be greatly appreciated. Thanks.