PDFSharp とこのコードを使用して、作成した 2 つの PDF ファイルを新しい PDF に連結しようとしています (ここで見つけました)。
// Open the output document
PdfDocument outputDocument = new PdfDocument();
// Iterate files
foreach (string file in files)
{
// Open the document to import pages from it.
PdfDocument inputDocument = PdfReader.Open(file, PdfDocumentOpenMode.Import);
// Iterate pages
int count = inputDocument.PageCount;
for (int idx = 0; idx < count; idx++)
{
// Get the page from the external document...
PdfPage page = inputDocument.Pages[idx];
// ...and add it to the output document.
outputDocument.AddPage(page);
}
}
// Save the document...
string filename = Path.Combine(this.tempFolder, "MyPDF.pdf");
outputDocument.Save(filename);
2 番目の PDF には、同じく PDFSharp を使用して入力するフォーム フィールドがあります。私が直面している問題は、新しい PDF に結合すると、フォーム フィールドが空白になることです。
2 番目の PDF を作成して保存した後に開くと、フォーム フィールドにテキストが表示されます。
何か不足していますか、またはこの問題に関して PDFSharp に何らかのバグがありますか? PDFを開いて表示できれば、それらを結合しても問題はないように思えます。
よろしくお願いします。