本文整理汇总了C++中PDFDoc::saveAs方法的典型用法代码示例。如果您正苦于以下问题:C++ PDFDoc::saveAs方法的具体用法?C++ PDFDoc::saveAs怎么用?C++ PDFDoc::saveAs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDFDoc
的用法示例。
在下文中一共展示了PDFDoc::saveAs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int opt;
PDFRectangle rect;
while ((opt = getopt(argc, argv, "dop:m:")) != -1) {
switch (opt) {
case 'd':
opt_debug++;
break;
case 'o':
opt_oreilly = 1;
break;
case 'p':
opt_page = atoi(optarg);
break;
case 'm':
sscanf(optarg, "%lf %lf %lf %lf",
&rect.x1, &rect.y1, &rect.x2, &rect.y2);
opt_margin = ▭
break;
}
}
if (optind + 2 > argc) {
fprintf(stderr, "Usage: %s [infile] [outfile]\n", argv[0]);
fprintf(stderr, "\n");
return EXIT_FAILURE;
}
globalParams = new GlobalParams();
GooString *in_file = new GooString(argv[optind]);
GooString *out_file = new GooString(argv[optind+1]);
if(opt_debug){
printf("Input File: %s\n", in_file->getCString());
printf("Output File: %s\n", out_file->getCString());
}
//GooString *owner_pw = new GooString("");
PDFDoc *doc = new PDFDoc(in_file, NULL, NULL);
if (!doc->isOk()) {
perror("pdf open error");
return EXIT_FAILURE;
}
int ret;
ret = pdfcrop(doc);
if (ret) {
printf("crop failed: %d\n", ret);
return EXIT_FAILURE;
}
//ret = doc->saveAs(out_file, writeStandard);
ret = doc->saveAs(out_file, writeForceRewrite);
if (ret) {
printf("save failed: %d\n", ret);
return EXIT_FAILURE;
}
delete doc;
// double free?
//delete in_file;
//delete out_file;
// some times blocked.
//delete globalParams;
return EXIT_SUCCESS;
}