开发环境: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

这篇博客介绍了如何在VC++6.0的开发环境下,结合PDFlib-Lite-7.0.5开发包,进行条形码的制作。提供了具体的开发示例,并分享了VC工程的下载链接。
最低0.47元/天 解锁文章
783

被折叠的 条评论
为什么被折叠?



