c++ pdflib 生成文本
wostringstream optlist;optlist.str(L"");
PDFlib p;
p.set_option(L"errorpolicy=return");
p.set_option(optlist.str());
if (p.begin_document(L"font.pdf", L"") == -1) {
return;
}
p.set_info(L"Creator", L"PDFlib starter sample");
p.set_info(L"Title", L"test");
int font = p.load_font(L"Helvetica-Bold", L"host", L"");
if (font == -1) {
wcerr << p.get_errmsg();
return;
}
p.begin_page_ext(a4_width, a4_height, L"");
p.setfont(font, 12);
p.set_text_pos(50, 700);
//写入文字方法1
p.show(L"Hello, world!");
//写入文字方法二
p.continue_text(L"C++");
p.end_page_ext(L"");
p.end_document(L"");
文档来源:51CTO技术博客https://blog.51cto.com/u_10486491/3215403
页:
[1]