Foxit SDK 中的 DeletePage 功能允许从 PDF 中删除页面。删除页面并保存文档时,输出文档的文件大小(页数较少)大于原始文档。
这可以通过 SDK 附带的 PDF 示例应用程序看到:
$ ./simple_sample/bin/rel_gcc/pdfpage_organization
...
Success: Use <rb> mode to open the file InsertPages.pdf and associate it with a stream.
Success: Create the file object.
Success: Open file successfully .
Success: Load PDF document successfully.
Success: Get page with index 1.
Success: Delete page with index 1.
Using extension implementation to open the file.
Success: Use <wb> mode to open the file SourcePage_delete.pdf and associate it with a stream.
Success: Create the file object.
Success: The PDF document save to SourcePage_delete.pdf.
检查输出:
ll simple_sample/input_files/SourcePage.pdf -rw-r--r--@ 1 理查员工 92K 2013 年 12 月 17 日 simple_sample/input_files/SourcePage.pdf
ll simple_sample/output_files/pdfpage_organization/SourcePage_delete.pdf -rw-r--r--@ 1 理查员工 96K Jun 23 10:22 simple_sample/output_files/pdfpage_organization/SourcePage_delete.pdf
SourcePage_delete.pdf 确实像预期的那样少了一页,但大了 4k。我可以从 100 页文档中删除 99 页得到相同的结果,即文件大小不反映页数。