C++でPDFを処理する
利点
- 統合、分割、回転、削除、抽出、最適化のような、PDF ページ操作機能。
.
- 既存のPDFへブックマークを付加したりや既存のPDFから削除するような、PDF ブックマーク機能。
- ノート、テキスト、ハイパーリンク、ファイル添付、カスタム注釈など、既存のPDF内へのエレメントの埋め込み。
- メタデータ、ページサイズ、回転、ページ数、バージョンのような、PDFの情報を取得。
- 署名情報を入手したり、暗号化をチェック、パスワードを変更するなど、PDFのセキュリティ設定を変更。
- PDFからテキストを抽出。
サンプルプロジェクト
コードの抜粋
- PDFProcessorオブジェクトの仕様を読む
このオブジェクトは既存のPDFファイルのポスト-プロセス(つまり、複数のPDFファイルを1つに統合、1つのPDFファイルを2つに分割、そしてPDFファイルを暗号化/暗号解除をする等)を実行させます。
PDFファイルの統合
EasyPDFProcessor::IPDFProcessorPtr oProcessor;
oProcessor.CreateInstance("easyPDF.PDFProcessor.6");
// Merge を使って2つのファイルを統合します。
oProcessor->Merge("C:\\input1.pdf", "C:\\input2.pdf", "C:\\merged.pdf");
// MergeBatch を使い、2つ以上のファイルを統合します。
SAFEARRAYBOUND bound;
bound.lLbound = 0;
bound.cElements = 3;
SAFEARRAY *inputFiles = SafeArrayCreate(VT_VARIANT, 1, &bound);
std::string filesToMerge[] = { "C:\\input1.pdf", "C:\\input2.pdf", "C:\\input3.pdf" };
int numFiles = sizeof(filesToMerge) / sizeof(std::string);
_variant_t var;
_variant_t inputArray;
char *file;
_bstr_t str;
long ix;
var.vt = VT_BSTR;
for (int i = 0; i < numFiles; i++)
{
ix = i;
file = const_cast<char *>(filesToMerge[i].c_str());
str = file;
var.bstrVal = str;
SafeArrayPutElement(inputFiles, &ix, &var);
}
inputArray.vt = VT_ARRAY|VT_VARIANT;
inputArray.parray = inputFiles;
oProcessor->MergeBatch(inputArray, "C:\\merged.pdf");
PDFの分割
EasyPDFProcessor::IPDFProcessorPtr oProcessor;
oProcessor.CreateInstance("easyPDF.PDFProcessor.6");
// 3ページ目でドキュメントを分割します。
oProcessor->Split("C:\\input.pdf", "C:\\part1.pdf", "C:\\part2.pdf", 3);
PDFからテキストを抽出
EasyPDFProcessor::IPDFProcessorPtr oProcessor;
oProcessor.CreateInstance("easyPDF.PDFProcessor.6");
// ExtractText を使って、1~4ページからテキストを物理的ファイルへ抽出します。
oProcessor->ExtractText("C:\\input.pdf", "C:\\extracted.txt", NULL, 0, 3, NULL, NULL);
// ExtractText2 を使って、1ページ目のBounding box からストリング変数へ抽出します。
std::string text = oProcessor->ExtractText2("C:\\input.pdf", 0, 0, 0, 300, 300, NULL);
|
Download Free Trial
The Free Trial is a fully functional
software, with 30-day
expiration.
Comprehensive PDF Features
C++ Sample Projects
Download C++ Sample Projects

Documentation
Testimonials from Our Customers
- We use easyPDF SDK technology for PDF conversion and it works very well. We knew BCL is a solid company. We have also looked at several competitors and tried to use their products, but we like easy PDF SDK the best. When we talked to BCL Technologies’ design engineering team, we knew they had the knowledge and confidence to solve our problems.” Read the case study
- We evaluated many PDF tools and drivers. We even wrote our own. Except for BCL’s easyPDF SDK, all had limitations we couldn’t live with. Some only converted from MS Office and not very well. Others could not do annotation or text stamping on PDF documents. None were as easy to use and as easy to integrate.” Read the case study
|