Example #1
0
    def test_zpl_to_zpl(self):
        zpl = GRF.replace_grfs_in_zpl(self._read_file('pdf-asciihex.zpl'))
        self._compare(zpl, 'asciihex-optimised-zb64.zpl')

        grf = GRF.from_zpl(self._read_file('pdf-asciihex.zpl'))[0]
        grf.optimise_barcodes()
        self._compare(grf.to_zpl(compression=1), 'pdf-optimised-b64.zpl')
        self._compare(grf.to_zpl(compression=2), 'pdf-optimised-asciihex.zpl')
        self._compare(grf.to_zpl(compression=3), 'pdf-optimised-zb64.zpl')
Example #2
0
    def test_zpl_to_zpl(self):
        zpl = GRF.replace_grfs_in_zpl(self._read_file('pdf-asciihex.zpl'))
        self._compare(zpl, 'asciihex-optimised-zb64.zpl')

        grf = GRF.from_zpl(self._read_file('pdf-asciihex.zpl'))[0]
        grf.optimise_barcodes()
        self._compare(grf.to_zpl(compression=1), 'pdf-optimised-b64.zpl')
        self._compare(grf.to_zpl(compression=2), 'pdf-optimised-asciihex.zpl')
        self._compare(grf.to_zpl(compression=3), 'pdf-optimised-zb64.zpl')
Example #3
0
    def test_zpl_to_image(self):
        grf = GRF.from_zpl(self._read_file('pdf-asciihex.zpl'))[0]
        output = BytesIO()
        grf.to_image().save(output, 'PNG')
        self._compare(output.getvalue(), 'pdf-image.png')

        output = BytesIO()
        grf.optimise_barcodes()
        grf.to_image().save(output, 'PNG')
        self._compare(output.getvalue(), 'pdf-optimised-image.png')
Example #4
0
    def test_zpl_to_image(self):
        grf = GRF.from_zpl(self._read_file('pdf-asciihex.zpl'))[0]
        output = BytesIO()
        grf.to_image().save(output, 'PNG')
        self._compare(output.getvalue(), 'pdf-image.png')

        output = BytesIO()
        grf.optimise_barcodes()
        grf.to_image().save(output, 'PNG')
        self._compare(output.getvalue(), 'pdf-optimised-image.png')
Example #5
0
 def test_from_b64_zpl(self):
     grf = GRF.from_zpl(self._read_file('pdf-optimised-zb64.zpl'))[0]
     self._compare(grf.to_zpl(compression=2), 'pdf-optimised-asciihex.zpl')
     output = BytesIO()
     grf.to_image().save(output, 'PNG')
     self._compare(output.getvalue(), 'pdf-optimised-image.png')
Example #6
0
 def test_from_b64_zpl(self):
     grf = GRF.from_zpl(self._read_file('pdf-optimised-zb64.zpl'))[0]
     self._compare(grf.to_zpl(compression=2), 'pdf-optimised-asciihex.zpl')
     output = BytesIO()
     grf.to_image().save(output, 'PNG')
     self._compare(output.getvalue(), 'pdf-optimised-image.png')