アイコン 株式会社トラスト・ソフトウェア・システム ロゴ

開発者向けPDFライブラリ - Pdftools SDK(Toolbox add-on)

PDF生成

各種の開発言語(C/C++、.Net、Java、Pythonなど)を使用して新たにPDFファイルを作成できます。
PDFファイルを作成した後、Toolbox Add-onを使用してコンテンツの追加、フォーム フィールドの追加、メタデータの管理などができます。

 INFO:
この機能はToolbox add-onの機能ですが、「Pdftools SDK」ライブラリ用のライセンスキーで機能します。
Toolbox add-onの全機能は無償で試用できますが、試用版のライセンスキーが必要です。
試用ライセンスキー要求からご要望ください。

Pdftools SDK 見積もり

APIリファレンス (Toolbox Add-on)

Toolbox Add-onのAPIリファレンスはこちらです。(すべて英文)

サンプル

C#のサンプルプロジェクトではPdftools SDK(Toolbox Add-on)ライブラリ(DLL)をNuGetから自動でダウンロードします。
CのサンプルプロジェクトにはPdftools SDK(Toolbox Add-on)ライブラリ(DLL)が含まれています。

ライセンスキー無し(無償)で試用できます。ただし、結果に「透かし」が入ります。
「透かし」の削除をご希望の場合は問い合わせページまたはメールでお問い合わせください。

License Agreement(利用許諾契約書)が含まれていますので必ず確認してください。


新たなPDF文書の作成

新たなPDFを作成し、文字列を追加

全1ページの新しいPDFドキュメントを作成し、このページの指定された矩形領域内に両端揃えレイアウトのテキストブロックを追加します。


サンプル・プロジェクト(C#)をダウンロード
サンプル・プロジェクトをダウンロード
// Create output document
using (Stream outStream = new FileStream(outPath, FileMode.CreateNew, FileAccess.ReadWrite))
using (Document outDoc = Document.Create(outStream, null, null))
{
    Font font = Font.CreateFromSystem(outDoc, "Arial", "Italic", true);

    // Create page
    Page outPage = Page.Create(outDoc, PageSize);

    // Add text as justified text
    LayoutText(outDoc, outPage, textPath, font, 20);

    // Add page to document
    outDoc.Pages.Add(outPage);
}
private static void LayoutText(Document outputDoc, Page outPage, string textPath, Font font,
    double fontSize)
{
    // Create content generator 
    using ContentGenerator gen = new ContentGenerator(outPage.Content, false);

    // Create text object
    Text text = Text.Create(outputDoc);

    // Create text generator
    using TextGenerator textGenerator = new TextGenerator(text, font, fontSize, null);

    // Calculate position
    Point position = new Point
    {
        X = Border,
        Y = outPage.Size.Height - Border
    };

    // Move to position
    textGenerator.MoveTo(position);

    // Loop through all lines of the textinput
    string[] lines = File.ReadAllLines(textPath, Encoding.Default);
    foreach (string line in lines)
    {
        // Split string in substrings
        string[] substrings = line.Split(new char[] { ' ' }, StringSplitOptions.None);
        string currentLine = null;
        double maxWidth = outPage.Size.Width - Border * 2;
        int wordcount = 0;

        // Loop through all words of input strings
        foreach (string word in substrings)
        {
            string tempLine;

            // Concatenate substrings to line
            if (currentLine != null)
                tempLine = currentLine + " " + word;
            else
                tempLine = word;

            // Calculate the current width of line
            double width = textGenerator.GetWidth(currentLine);
            if (textGenerator.GetWidth(tempLine) > maxWidth)
            {
                // Calculate the word spacing
                textGenerator.WordSpacing = (maxWidth - width) / (wordcount - 1);
                // Paint on new line
                textGenerator.ShowLine(currentLine);
                textGenerator.WordSpacing = 0;
                currentLine = word;
                wordcount = 1;
            }
            else
            {
                currentLine = tempLine;
                wordcount++;
            }
        }
        textGenerator.WordSpacing = 0;
        // Add given stamp string
        textGenerator.ShowLine(currentLine);
    }
    // Paint the positioned text
    gen.PaintText(text);
}

お問い合わせ、ご質問、技術サポート

質問のページからお送りいただくようお願いします。
または、メールでsupport@trustss.co.jpあてにお送りください。


ご購入前の技術的質問も無償で対応します。サポート受付ページからお願いします。

> PDF Structure (PDF構成)

> PDF Imager-LP (画像化)

> PDF Stamper (電子印鑑)

> Pdftools SDK

- Pdftools SDKサンプルの利用手順
- Toolbox Add-on
> Pdftools SDK APIリファレンス