pypdflite/pdfobjects/pdfimage.py
def _output(self):
        """ Prompts the creating of image objects.

        """
        self.session._out('<</Type /XObject')
        self.session._out('/Subtype /Image')
        self.session._out('/Width %s' % self.width)
        self.session._out('/Height %s' % self.height)

        if self.colorspace is 'Indexed':
            self.session._out('/ColorSpace [/Indexed /DeviceRGB %s %s 0 R' %
                              (self.pal, self.number + 1))
        else:
            self.session._out('/ColorSpace /%s' % self.colorspace)
            if self.colorspace is 'DeviceCMYK':
                self.session._out('/Decode [1 0 1 0 1 0 1 0]')

        self.session._out('/BitsPerComponent %s' % self.bits_per_component)

        if self.filter:
            self.session._out('/Filter /%s' % self.filter)
        if self.decode:
            self.session._out('/DecodeParms << %s >>' % self.decode)
        if self.transparent:
            self.session._out('/Mask [%s]' % self.transparent_string)
        if self.soft_mask:
            self.session._out('/SMask %s 0 R' % (self.number + 1))
        self.session._out('/Length %s >>' % self.size)
        self.session._put_stream(self.image_data)
        self.session._out('endobj')

        if self.colorspace is 'Indexed':
            self.session._out('<<%s /Length %s >>' % (self.palette_filter, self.palette_length))
            self.session._put_stream(self.palette)
            self.session._out('endobj')

        if isinstance(self.soft_mask, PDFImage):
            obj = self.session._add_object()
            self.soft_mask._set_number(obj.id)
            self.soft_mask._output()
def _output(self):
        self.session._out('<</Type /XObject')
        self.session._out('/Subtype /Image')
        self.session._out('/Width %s' % self.width)
        self.session._out('/Height %s' % self.height)

        if self.colorspace is 'Indexed':
            self.session._out('/ColorSpace [/Indexed /DeviceRGB %s %s 0 R' %
                              (self.pal, self.number + 1))
        else:
            self.session._out('/ColorSpace /%s' % self.colorspace)
            if self.colorspace is 'DeviceCMYK':
                self.session._out('/Decode [1 0 1 0 1 0 1 0]')

        self.session._out('/BitsPerComponent %s' % self.bits_per_component)

        if self.filter:
            self.session._out('/Filter /%s' % self.filter)
        if self.decode:
            self.session._out('/DecodeParms << %s >>' % self.decode)
        if self.transparent:
            self.session._out('/Mask [%s]' % self.transparent_string)
        if self.soft_mask:
            self.session._out('/SMask %s 0 R' % (self.number + 1))
        self.session._out('/Length %s >>' % self.size)
        self.session._put_stream(self.image_data)
        self.session._out('endobj')

        if self.colorspace is 'Indexed':
            self.session._out('<<%s /Length %s >>' % (self.palette_filter, self.palette_length))
            self.session._put_stream(self.palette)
            self.session._out('endobj')

        if isinstance(self.soft_mask, PDFImage):
            obj = self.session._add_object()
            self.soft_mask._set_number(obj.id)
            self.soft_mask._output()
def _output ( self ) : self . session . _out ( '<</Type /XObject' ) self . session . _out ( '/Subtype /Image' ) self . session . _out ( '/Width %s' % self . width ) self . session . _out ( '/Height %s' % self . height ) if self . colorspace is 'Indexed' : self . session . _out ( '/ColorSpace [/Indexed /DeviceRGB %s %s 0 R' % ( self . pal , self . number + 1 ) ) else : self . session . _out ( '/ColorSpace /%s' % self . colorspace ) if self . colorspace is 'DeviceCMYK' : self . session . _out ( '/Decode [1 0 1 0 1 0 1 0]' ) self . session . _out ( '/BitsPerComponent %s' % self . bits_per_component ) if self . filter : self . session . _out ( '/Filter /%s' % self . filter ) if self . decode : self . session . _out ( '/DecodeParms << %s >>' % self . decode ) if self . transparent : self . session . _out ( '/Mask [%s]' % self . transparent_string ) if self . soft_mask : self . session . _out ( '/SMask %s 0 R' % ( self . number + 1 ) ) self . session . _out ( '/Length %s >>' % self . size ) self . session . _put_stream ( self . image_data ) self . session . _out ( 'endobj' ) if self . colorspace is 'Indexed' : self . session . _out ( '<<%s /Length %s >>' % ( self . palette_filter , self . palette_length ) ) self . session . _put_stream ( self . palette ) self . session . _out ( 'endobj' ) if isinstance ( self . soft_mask , PDFImage ) : obj = self . session . _add_object ( ) self . soft_mask . _set_number ( obj . id ) self . soft_mask . _output ( )
Prompts the creating of image objects.
Prompts the creating of image objects .