Giter VIP home page Giter VIP logo

templator's Introduction

templator

Simple templating engine for generating printouts (labels, invoices, etc) in PDF or SVG

.Net Core 2.2

You can turn this:

<?xml version="1.0" encoding="UTF-8"?>
<Template IsDebug="false">
    <PageSettings Format="A5" Orientation="Portrait" Margin="5" />
    <ReportBody>
        <Column>
            <Iterator ItemReferenceName="i" DataField="Rows">
                <Column>
                    <Image Src="logo.png" Width="90" Height="30" />
                    <Line />
                    <Field DataField="CustomerName" />
                    <Field DataField="CustomerStreet" />
                    <Row>
                        <Label Text = "City" Width="28" />
                        <Value DataField="CustomerZip" FontStyle="Bold" Width="16" />
                        <Value DataField="CustomerCity" FontStyle="Bold" />
                    </Row>
                    <Line />
                    <Field DataField="i.SsccNo" />
                    <Field DataField="i.ArticleId" />
                    <Field DataField="i.ArticleEan" />
                    <Field DataField="i.ArticleDescription" Lines="2" />
                    <Field DataField="i.Quantity" ValueAlign="Left" />
                    <Field DataField="CustomerReference" />
                    <Line />
                    <Barcode Type="GS1-128" DataField="i.Barcode1" Height="30" Scale="0.4" />
                    <Barcode Type="GS1-128" DataField="i.Barcode2" Height="30" Scale="0.4" />
                </Column>
                <NewPage />
            </Iterator>
        </Column>
    </ReportBody>
</Template>

into this: Example label using this code:

           var data = GetGs1Data();

            var cfg = new PdfConfig
            {
                FontPaths = new []{ "/Library/Fonts" } // this is configured for mac, on windows you have to change it
            };

            var bytes = Templator.Create("Template/label.xml")
                .UsePdfRenderer(cfg)
                .Render(data);
            
            File.WriteAllBytes("Result/label.pdf",bytes);

Example invoice: Example invoice

templator's People

Contributors

sbc77 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.