windows下PDF文档的开发包

源代码在线查看: image.cpp

软件大小: 3295 K
上传用户: a1a1J0
关键词: windows 文档 开发包
下载地址: 免注册下载 普通下载 VIP

相关代码

				// $Id: image.cpp,v 1.12.2.5 2003/12/17 15:45:37 tm Exp $
				// PDFlib client: image example in C++
				//
				//
				
				#include 
				
				#include "pdflib.hpp"
				
				int
				main(void)
				{
				    try {
					PDFlib *p;			// pointer to the PDFlib class
					int image;
					char *imagefile = (char *) "nesrin.jpg";
					// This is where font/image/PDF input files live. Adjust as necessary. 
					char *searchpath = (char *) "../data";
				
					p = new PDFlib();
				
					// Open new PDF file
					if (p->open_file("image.pdf") == -1) {
					    cerr 					    return 2;
					}
				
					p->set_parameter("SearchPath", searchpath);
				
					// This line is required to avoid problems on Japanese systems
					p->set_parameter("hypertextencoding", "host");
				
					p->set_info("Creator", "image.cpp");
					p->set_info("Author", "Thomas Merz");
					p->set_info("Title", "image sample (C++)!");
				
					image = p->load_image("auto", imagefile, "");
				
					if (image == -1) {
					    cerr 					    exit(3);
					}
				
					// dummy page size, will be adjusted by PDF_fit_image()
					p->begin_page(10, 10);
					p->fit_image(image, (float) 0.0,(float) 0.0, "adjustpage");
					p->close_image(image);
					p->end_page();				// close page
				
					p->close();				// close PDF document
				    }
				    catch (PDFlib::Exception &ex) {
					cerr 					cerr 					    					return 2;
				    }
				
				    return 0;
				}
							

相关资源