3

手動またはサードパーティのコンポーネントによってPDFファイルにデータを送信する方法はありますか(フィールド/空白に入力)、PDFファイルには、ユーザーが番号を入力して変更できる特定のフィールドがあります。チェックボックスなど等

どうすればこの目標を達成できますか?それが最高のサードパーティコンポーネントを必要とする場合、そして価格はいくらですか?

私たちの開発IDEはdelphi2010/ Delphi2011XEです

ありがとう :)

4

1 に答える 1

2

アプリケーションでユーザーインターフェイスフィールドからPDFコンテンツを作成する必要があると思います。

これは、コードからレポートジェネレーターを使用し、次にPDFエンジンを使用して、コードから簡単に実行できます。

Delphi 6からXEまで、これを行うためのオープンソースソリューションを提案します。

これは、いくつかのユーザーインターフェイスフィールドをソースとして使用してレポートを作成する1つのデモからのコード抽出です(例:edt1.Textまたはmmo1.Text)。

procedure TForm1.btn1Click(Sender: TObject);
  (...)
    with TGDIPages.Create(self) do
    try
      // the name of the report is taken from main Window's caption
      Caption := self.Caption;
      // now we add some content to the report
      BeginDoc;
      (...)
      // main content (automaticaly split on next pages)
      NewHalfLine;
      TextAlign := taJustified;
      s := 'This is some big text which must be justified on multiple lines. ';
      DrawText(s+s+s+s);
      NewLine;
      TextAlign := taLeft;
      DrawTitle(edt1.Text,true);
      for i := 1 to 10 do
        DrawText('This is some text '+IntToStr(i));
      NewLine;
      DrawBMP(Bmp,maxInt,50,'Some bitmap in the report');
      AddBookMark('bookmarkname');
      WordWrapLeftCols := true;
      AddColumns([10,20,50]);
      AddColumnHeaders(['#','Two','Three'],true,true);
      for i := 1 to 100 do
        DrawTextAcrossCols([IntToStr(i),'Column '+IntToStr(i),'Some text here. '+s]);
      NewLine;
      DrawBMP(Bmp,maxInt,50,'Some bitmap in the report (twice)');
      DrawTitle('This is your text',false,0,'','bookmarkname');
      DrawText(mmo1.Text);
      EndDoc;
      // set optional PDF export options
      // ExportPDFForceJPEGCompression := 80;
      // ExportPDFEmbeddedTTF := true;
      // ExportPDFUseUniscribe := true;
      // ExportPDFA1 := true;
      // show a preview form, and allow basic actions via the right click menu
      // ShowPreviewForm;
      // export as PDF
      ExportPDF('test.pdf',false);
    finally
      Free;
    end;

他にも解決策はありますが、これはオープンソースであり、専用のレポートだけでなく、レポートに必要なものを描画することもできます(「標準」のTCanvasプロパティを使用して、PaintToメソッドを使用して任意のグラフィックコンポーネントを直接描画することもできます)。 DrawTitle()やDrawText()などの生成されたメソッド。

編集:

フォームを使用したPDFファイルの作成に関する質問の場合、このライブラリは機能しません。

VeryPdfQuickPdfなどのクローズドソースライブラリを使用する必要があります。Googleはあなたの友達です。

于 2011-01-31T14:42:53.753 に答える