Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barcode not working #36

Open
jakobschonberg opened this issue Oct 8, 2021 · 2 comments
Open

Barcode not working #36

jakobschonberg opened this issue Oct 8, 2021 · 2 comments
Labels

Comments

@jakobschonberg
Copy link

jakobschonberg commented Oct 8, 2021

Expected Behavior

Produce a visible barcode (works in 1.31.3066.0)

Actual Behavior

Compiles and runs, but shows no barcode.

Steps to Reproduce the Behavior

Add this code to IssueSubmission/Program.cs

            MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();
            table.AddColumn();
            table.AddRow();
            Barcode b = table[0, 0].Elements.AddBarcode();
            b.Type = BarcodeType.Barcode39;
            b.Code = "79834278";
            b.Width = 200;
            b.Height = 50;
            b.BearerBars = true;
            b.LineHeight = 50;
            b.LineRatio = 2;

Further information

This function does not handle the case where documentObject is a Barcode, so the object is never rendered:
https://github.com/empira/MigraDoc/blob/cb9690cd2ee96ae3609508f551c2765f609e7a5a/MigraDoc/src/MigraDoc.Rendering/Rendering/Renderer.cs#L149-L169

@TH-Soft TH-Soft added the bug label Oct 8, 2021
@mnbob70
Copy link

mnbob70 commented Oct 19, 2021

Today I took the code that was originally provided in https://forum.pdfsharp.net/viewtopic.php?f=3&t=1215 (in 2010!) and modified it to render barcodes. The original patch needed very little modification to work with the current codebase and I made one additional change to add a default minimum font size for the readable text printed below a barcode. I'll see if I can create a pull request. I've only ever done that once before on Github so I'll have to try to remind myself how it is done.

@mnbob70
Copy link

mnbob70 commented Oct 20, 2021

Pull request has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants