TCPDFBarcode::getBarcodeSVG PHP Method

getBarcodeSVG() public method

Send barcode as SVG image object to the standard output.
public getBarcodeSVG ( $w = 2, $h = 30, $color = 'black' )
$w (int) Minimum width of a single bar in user units.
$h (int) Height of barcode in user units.
$color (string) Foreground color (in SVG format) for bar elements (background is transparent).
    public function getBarcodeSVG($w = 2, $h = 30, $color = 'black')
    {
        // send headers
        $code = $this->getBarcodeSVGcode($w, $h, $color);
        header('Content-Type: application/svg+xml');
        header('Cache-Control: public, must-revalidate, max-age=0');
        // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
        // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Disposition: inline; filename="' . md5($code) . '.svg";');
        //header('Content-Length: '.strlen($code));
        echo $code;
    }

Usage Example

コード例 #1
0
ファイル: example_1d_svg.php プロジェクト: ade24/vcorner
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF.  If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_1d.php class
//
//============================================================+
/**
 * @file
 * Example for tcpdf_barcodes_1d.php class
 * @package com.tecnick.tcpdf
 * @author Nicola Asuni
 * @version 1.0.000
 */
// include 1D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_1d.php';
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(2, 30, 'black');
//============================================================+
// END OF FILE
//============================================================+