@czekaj/react-native-pdf417
v1.1.1
Published
Enhanced React-Native library for PDF417 barcode generation with custom row count and error correction support
Downloads
3
Maintainers
Readme
react-native-pdf417
React-Native library which allows you to generate a barcode in pdf417 format
🚀 Enhanced Fork: This is a fork of @reeq/react-native-pdf417 that adds advanced PDF417 customization features and comprehensive test coverage.
🆕 Additional Features
This fork adds support for:
- Custom row count (
rowsprop) - Control barcode height by specifying the number of rows - Error correction level (
errorCorrectionLevelprop) - Set error correction level (0-8) for improved barcode robustness - Comprehensive test suite - Unit tests for TypeScript interfaces and prop validation
- Enhanced example app - Visual test suite demonstrating all features
Android pdf417 writer is based on zxing library https://github.com/zxing/zxing
Screenshots
Installation
npm install @czekaj/react-native-pdf417or
yarn add @czekaj/react-native-pdf417and
cd ios/
pod installUsage
Basic Usage
import { Barcode } from '@czekaj/react-native-pdf417';
// ...
const { width: windowWidth } = useWindowDimensions();
<Barcode
text="hello pdf417"
style={{ height: windowWidth / 4, width: windowWidth }}
onPress={() => {
console.log('barcode pressed');
}}
/>;Advanced Usage with Custom Parameters
// Custom row count for specific barcode height
<Barcode
text="Custom height barcode"
rows={8}
style={{ height: windowWidth / 3, width: windowWidth }}
onPress={() => console.log('Custom rows barcode pressed')}
/>
// Enhanced error correction for better scanning reliability
<Barcode
text="High reliability barcode"
errorCorrectionLevel={6}
style={{ height: windowWidth / 4, width: windowWidth }}
onPress={() => console.log('High error correction barcode pressed')}
/>
// Combined custom parameters
<Barcode
text="Fully customized barcode"
rows={10}
errorCorrectionLevel={4}
style={{ height: windowWidth / 3, width: windowWidth }}
onPress={() => console.log('Custom barcode pressed')}
/>Props
Most of the default View props and:
text: text string you want to convert into barcode. RequiredonPress: on barcode press event. Optionalrows: number of rows in the barcode (controls height). Optional- When set to 0 or not provided, rows are auto-calculated
- Higher values create taller barcodes
errorCorrectionLevel: error correction level (0-8). Optional- Default: 2
- Higher values provide better error recovery but may increase barcode size
- Range: 0 (minimal) to 8 (maximum error correction)
Testing
This fork includes comprehensive test coverage:
# Run unit tests
npm test
# Run example app for visual testing
cd example
npm run ios
# or
npm run androidSee TESTING.md for detailed testing instructions and guidelines.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Original library: @reeq/react-native-pdf417
Enhanced by: This fork adds advanced PDF417 customization and testing capabilities
Made with create-react-native-library
