Code Monkey home page Code Monkey logo

printableqrgenerator's Introduction

New features

Please let me know via an issue if you want a new feature ! You can even make it yourself and make a pull request ! :)

Simple use

public class ExampleQRGenerator extends QRSerialGenerator<UUID> {

	@Override
	protected UUID nextValue(UUID previous) {
		return UUID.randomUUID();
	}

	@Override
	protected String toLabel(UUID current) {
		return "UUID v" + current.version();
	}

}
// This example works with the Avery template #5167
QRSerialGenerator<UUID> generator = new ExampleQRGenerator();

generator.setPageSize(new RectangleReadOnly(8.5f, 11f));
generator.setOutsetMargin(new RectangleReadOnly(5f / 16f, 0.5f));
generator.setInsetMargin(new RectangleReadOnly(5f / 16f, 0));
generator.setStickerSize(new RectangleReadOnly(1.75f, 0.5f));

generator.setLineSize(4);
generator.setBatchSize(800);
generator.setEcc(QrCode.Ecc.LOW);

generator.generate("simple-generator.pdf");

Click on the image to test scan it.

Result

From a collection

public class ExampleQRGeneratorCollection extends QRSerialCollectionGenerator<SimplePojo> {

	public ExampleQRGeneratorCollection(List<SimplePojo> items) {
		super(items);
	}

	@Override
	protected String toValue(SimplePojo current) {
		return "SIMPLE-" + current.getId().toString();
	}

	@Override
	protected String toLabel(SimplePojo current) {
		return current.getName() + " " + current.getLastName().charAt(0) + ".";
	}

}
// This example works with the Avery template #5167
List<SimplePojo> items = Arrays.asList(
		new SimplePojo(UUID.randomUUID(), "Charles", "Smith"),
		new SimplePojo(UUID.randomUUID(), "Louis-Philippe", "Potvin"),
		new SimplePojo(UUID.randomUUID(), "Jonathan", "Métras"),
		new SimplePojo(UUID.randomUUID(), "Alexandre", "Marchand"),
		new SimplePojo(UUID.randomUUID(), "Frédéric", "Deschênes")
);
QRSerialCollectionGenerator<SimplePojo> collectionGenerator = new ExampleQRGeneratorCollection(items);

collectionGenerator.setPageSize(new RectangleReadOnly(8.5f, 11f));
collectionGenerator.setOutsetMargin(new RectangleReadOnly(5f / 16f, 0.5f));
collectionGenerator.setInsetMargin(new RectangleReadOnly(5f / 16f, 0));
collectionGenerator.setStickerSize(new RectangleReadOnly(1.75f, 0.5f));

collectionGenerator.setLineSize(4);
collectionGenerator.setLabelFontSize(10);
collectionGenerator.generate("simple-collection-generator.pdf");

Click on the image to test scan it.

Result Collection

printableqrgenerator's People

Contributors

binarskugga avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cryptobuks

printableqrgenerator's Issues

Clueless!

Hi! This seems like it does exactly what I'm looking for but I have no idea how to use it. How would I go about getting started with this? I know nothing about Java. I've downloaded the files but have no clue what to do with them.

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.