vc制作条形码

这篇博客介绍了如何在VC++6.0的开发环境下,结合PDFlib-Lite-7.0.5开发包,进行条形码的制作。提供了具体的开发示例,并分享了VC工程的下载链接。
摘要由CSDN通过智能技术生成

开发环境:VC++6.0

PDF开发包:PDFlib-Lite-7.0.5

开发demo:

/* 
 * PDFlib client: hello example in C
 * pdflib-BarCode
 */

#include <stdio.h>
#include <stdlib.h>
#include <String.h>

#include "pdflib.h"
#include "Code39.h"

FILE *fp;

void drawTable(PDF *p, double x0, double y0, double height, double width);
void addText(PDF *p, double x0, double y0, char *barCode);

int main(void)
{
    PDF *p;
    int font;

	double startX,startY;
	double pageEdgeX,pageEdgeY;
	double tableEdgeX,tableEdgeY;
	double tableHeight, tableWidth;

    /* create a new PDFlib object */
    if ((p = PDF_new()) == (PDF *) 0)
    {
        printf("Couldn't create PDFlib object (out of memory)!\n");
        return(2);
    }

    PDF_TRY(p) {
		/* This means we must check return values of load_font() etc. */
		PDF_set_parameter(p, "errorpolicy", "return");
		PDF_set_parameter(p, "hypertextencoding", "host");		//--(增加位置)

		if (PDF_begin_document(p, "hello.pdf", 0, "") == -1) {
			printf("Error: %s\n", PDF_get_errmsg(p));
			return(2);
		}

		/* This line is required to avoid problems on Japanese systems */
		//PDF_set_parameter(p, "hypertextencoding", "host");	//--(注释位置)

		PDF_set_info(p, "Creator", "hello.c");
		PDF_set_info(p, "Author", "Thomas Merz");
		PDF_set_info(p, "Title", "Hello, world (C)!");

		PDF_begin_page_ext(p, a4_width, a4_height, "");

		/* Change "host" encoding to "winansi" or whatever you need! */
		font = PDF_load_font(p, "Helvetica-Bold", 0, "host", "");
		if (font == -1) {
			printf("Error: %s\n", PDF_get_err
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值