Pdf Processing - Adding barcode does not show anything

0 Answers 7 Views
PdfProcessing
BB
Top achievements
Rank 1
BB asked on 30 Jun 2025, 07:50 AM | edited on 30 Jun 2025, 07:52 AM

I am trying out the document processing library and the barcode formsource (https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/model/formsource/barcode).

When I add the barcode, I get a white pdf. If I leave barcode off it, everything else shows up. Any idea what i am doing wrong? 

Example file:


 internal class DocGenerator
 {
     public void CreateDocument()
     {
         var document = new RadFixedDocument();
         var page = document.Pages.AddPage();
         page.Size = new Size(595, 842); // A4 size

         var editor = new FixedContentEditor(page);

         //editor.Position.Translate(0, 0);
         //FormSource barcode = FormSource.FromBarcode(Symbology1DType.Code128, "1234567890", width: 100, height: 100);
         //editor.DrawForm(barcode, 100, 100);

         editor.Position.Translate(20, 20);

         // Title
         editor.DrawText("P 24-07-2024 12:03");
         editor.Position.Translate(300, 20);
         editor.DrawText("Person X");

         // Aisle and Pallet
         editor.Position.Translate(20, 60);
         editor.DrawText("AISLE");
         editor.Position.Translate(100, 60);
         editor.TextProperties.FontSize = 36;
         editor.DrawText("A101");

         editor.Position.Translate(20, 150);
         editor.TextProperties.FontSize = 12;
         editor.DrawText("P");
         editor.Position.Translate(100, 150);
         editor.TextProperties.FontSize = 36;
         editor.DrawText("0237");

         AddBarcode(editor);


         editor.TextProperties.FontSize = 10;
         var blackColor =  new RgbColor(0, 0, 0);
         Table table = new Table();
                     table.Borders = new TableBorders(
             new Border(1, blackColor), // Top
             new Border(1, blackColor), // Right
             new Border(1, blackColor), // Bottom
             new Border(1, blackColor) // Left
         );

         AddTableRows(table);
         editor.Position.Translate(20, 240);
         editor.DrawTable(table);

         using (Stream output = File.OpenWrite(@"c:\temp\Output.pdf"))
         {
             PdfFormatProvider flowPdfProvider = new();
             flowPdfProvider.Export(document, output, new TimeSpan(0,0,10));
         }
     }

     private void AddBarcode(FixedContentEditor editor)
     {
         editor.Position.Translate(150, 150);
         FormSource barcodeWithCenterCenterText = FormSource.FromBarcode(Symbology1DType.Code128, "1234567890", showText: true);
         editor.DrawForm(barcodeWithCenterCenterText, 100, 100);
     }

     private void AddTableRows(Table table)
     {
         string[][] rows = new[]
         {
   new[] { "P", "PNo", "Brut", "Net", "Quality", "Pattern", "Pr", "Co", "Ac"  },
   new[] { "1000", "1001", "119,50", "118,70", "P1", "", "C1", "U1" },
   new[] { "1000", "1002", "120,00", "119,40", "P1", "", "C1", "U1" },
   new[] { "1000", "1003", "112,80", "112,10", "P1", "", "C1", "U1" },
   new[] { "1000", "1004", "120,50", "120,00", "P1", "", "C1", "U1" },
   new[] { "1000", "1005", "114,40", "113,50", "P1", "", "C1", "U1" },
   new[] { "1000", "1006", "114,40", "113,70", "P1", "", "C1", "U1" },
   new[] { "1000", "1007", "104,00", "102,60", "P1", "", "C1", "U1" },
   new[] { "1002", "1008", "99,80", "99,40", "P2", "", "C2", "H1" },
   new[] { "1002", "1009", "100,40", "100,00", "P2", "", "C2", "H1" },
   new[] { "1002", "1010", "100,40", "99,40", "P2", "", "C2", "H1" },
   new[] { "1002", "1011", "73,30", "72,50", "P2", "", "C2", "H1" },
   new[] { "1002", "1012", "100,00", "99,80", "P2", "", "C2", "H1" },
   new[] { "1002", "1013", "74,30", "73,80", "P2", "", "C2", "H1" },
   new[] { "1002", "1014", "105,00", "104,30", "P2", "", "C2", "H1" }, }; foreach (var rowValues in rows) { var row = table.Rows.AddTableRow(); foreach (var value in rowValues) { var cell = row.Cells.AddTableCell(); cell.Blocks.AddBlock().InsertText(value); } } } }

 

Yoan
Telerik team
commented on 30 Jun 2025, 02:58 PM

Hello Bjorn,

Thank you for reaching out. I tested the provided code snippet on my end, however, even if the barcode is added to the page, all content appears to be present on my end (see attached "example.gif" and "test-barcode" project). My project is .NET8 and uses the latest official 2025.2.520 Document Processing version.

Would you please examine my project and let me know if there is something I am missing that is preventing me from reproducing the same results? 

If you don't mind, would you also share with me:

  • The project environment on your end (NET Framework, NET Core, etc.)
  • The used Document Processing version
  • A sample project that you are using to achieve the unusual results. This way, I can investigate the case and try to find a solution.

NOTE: While sharing resources, please keep in mind that this is a public Q&A Form thread, and anything attached here is accessible to anyone. As an alternative, if you can modify my project in a way that it outputs the wrong results, please send it back instead.

Thank you in advance for your cooperation.

Regards,

Yoan

No answers yet. Maybe you can help?

Tags
PdfProcessing
Asked by
BB
Top achievements
Rank 1
Share this question
or