iOS Question PDF417

moore_it

Well-Known Member
Licensed User
Longtime User
Hello, i need to create a PDF417 barcode !
It's possible with B4I ?

Thanks
 

MarcoRome

Expert
Licensed User
Longtime User
Taking inspiration from:



B4X:
Private Sub Button1_Click
    
    Dim NativeMe As NativeObject = Me
    NativeMe.RunMethod("createQR417::", Array ("Your text",ImageView1))


End Sub


#If OBJC

- (void)createQR417:(NSString *)qrString :(UIImageView *)qrImageView
{
  // Need To convert the string To a UTF-8 encoded NSData object
  NSData *stringData = [qrString dataUsingEncoding: NSISOLatin1StringEncoding];

  // Create the filter
  CIFilter *qrFilter = [CIFilter filterWithName:@"CIPDF417BarcodeGenerator"];
  // Set the message content And error-correction level
  [qrFilter setValue:stringData forKey:@"inputMessage"];
  [qrFilter setValue:@"M" forKey:@"inputCorrectionLevel"];
 
   // Remove blur effect with scaling
   CGAffineTransform transform = CGAffineTransformMakeScale(100.0f,100.0f);
   CIImage *qrOutput = [qrFilter.outputImage imageByApplyingTransform: transform];

   //Convert CIImage to UIImage
   UIImage *qrImage = [[UIImage alloc] initWithCIImage:qrOutput];
 
   //Set Image to ImageView
   [qrImageView setImage:qrImage];
}

#End If
 
Last edited:
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
From the test carried out it works without problems

1703403239844.png
 
Upvote 0
Top