com.aspose.barcode.generation.BarcodeGenerator flatten tiff layers

Hello,

We have a customer that we’re sending PDFs to and their system is complaining that the barcode that we are embedding hasn’t been flattened. Is there a way to tell BarcodeGenerator.save() to flatten a generated tiff?

Here’s a sample the code we’re using.

private CreateBarCodeResults saveBarCodeImageInRgb(final BarcodeGenerator barcodeGenerator) {

   CreateBarCodeResults results;

   try {
                    barcodeGenerator.save(rgbFileName, this.getBarCodeImageFormat()); //this.getBarCodeImageFormat is set to BarCodeImageFormat.TIFF
                    barcodeGenerator.dispose();

                    results = new CreateBarCodeResults(Optional.of(rgbFileName), Optional.empty());
                } catch (final Exception e) {
                    logger.catching(e);

                    results = new CreateBarCodeResults(Optional.empty(), Optional.of(e.getMessage()));
           }

   .......
   .......
    ......

   return results;
}
1 Like

@dmauler1,

Could you please share the output barcode TIFF image generated by the Aspose.BarCode API and also provide your expected flattened TIFF image? We will check it soon.

It is possible with combination of Aspose.Barcode and Aspose.Imaging:

  • generate barcode and save it to MemoryStream
  • insert MemoryStream to multipage tiff

Afternoon all,

Sorry for the delayed response, I’m going to attach a couple of tiffs that I had the code generate. I spoke with one of our graphics folks and he was able to show me that Photoshop thinks the file has a transparency layer. He also demonstrated that when resaving the tiff via Photoshop it removed metadata such as “extra sample: unassociated alpha”. I’m not entirely sure what “extra sample: unassociated alpha” is but I assume it’s related to the transparency layer.

Archive.zip (7.9 MB)

@dmauler1,

Thanks for the sample TIFF files.

As we told you that you may use Aspose.BarCode and Aspose.Imaging APIs to accomplish your task. Please see the reply by @alexander.gavriluk for your reference.