0

Livecycle Designer ES3 で作成された PDF フォームがあります。

私の仕事は、送信ボタンでpdf全体をサーバー上の特定のフォルダーに保存することです。

ボタンは、Web サーバー上の php ファイルを指しています。ボタンのタイプは「送信」で、「URL エンコードされた日付 (HTTP) として送信します。

私が試してみました:

$file = $GLOBALS['HTTP_RAW_POST_DATA'];
$newfile = "/var/watchfolder/" . microtime(true) . ".pdf";
file_put_contents($newfile, $file);

私も試しました:

$file = file_get_contents("php://input");
$newfile = "/var/watchfolder/" . microtime(true) . ".pdf";
file_put_contents($newfile, $file);

どちらの場合もファイルを書き込みますが、ファイルの内容は次のようになります。

OrderDate=&DocumentNo=&Concat_BuyfromVendorNo_BuyfromVendorName=&JobNo=&TicketNo=&Concat_SellToCustomerNo_SellToCustomerName=&LineNo_1=&No_1=&OutstandingQuantity_1=&Quantity_1=123&...

Reader も Acrobat も有効な PDF として開きません。

PDF形式のファイルとして書き込むにはどうすればよいですか?


アップデート:

わかった。Livecycle で [Submit As: PDF] を選択し、php ファイルを指定します。

私は次のようになります:

<?php
ob_start();
$file = file_get_contents("php://input"); //Gets binary PDF Data
$time = microtime(true);
$newfile = "/var/watchfolder/" . $time . ".pdf"; //Names xml file based on the time to the microsecond so nothing gets overwritten.
$worked = file_put_contents($newfile, $file); //Creates File
ob_end_clean();

$file = "/var/www/forms/Submission_Confirmation.pdf";
$filename = 'Submission_Confirmation.pdf'; /* Note: Always use .pdf at the end. */

header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');

@readfile($file);

?>

最後の部分では、確認としてリーダーに PDF を読み込みます。送信したばかりの PDF を含め、任意の PDF にすることができます。

Reader Acrobat で PDF を拡張

記入して提出する

出来上がり!

4

1 に答える 1