Rank: Newbie
Groups: Registered
Joined: 6/29/2016(UTC) Posts: 3
Thanks: 1 times
|
Hi there,
I am currently merging two files using the ImportPages() method. The first file contains an interactive form, the second doesn't. After applying ImportPages() the resulting file doesn't contain a form any more. The files get merged but the interactive form is not useable in the merged file. Why does the form get lost when merging the files?
Thanks!
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Hi, Could you please show your code? the code below works fine. Maybe you are calling FlattenPage somewhere? Code:
//Initialize the SDK library
//You have to call this function before you can call any PDF processing functions.
PdfCommon.Initialize();
//Open and load a PDF document with forms
using (var mainDoc = PdfDocument.Load(@"d:\00\otpt4.pdf"))
{
//Open another PDF document.
using (var doc = PdfDocument.Load(@"d:\00\facture.pdf"))
{
//Import all pages from second document into first one
mainDoc.Pages.ImportPages(
doc,
string.Format("1-{0}", doc.Pages.Count),
mainDoc.Pages.Count
);
}
//Save a copy of a merged document
mainDoc.Save(@"d:\00\result.pdf", SaveFlags.NoIncremental);
}
Edited by user Wednesday, June 29, 2016 7:18:55 PM(UTC)
| Reason: Not specified
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 6/29/2016(UTC) Posts: 3
Thanks: 1 times
|
Hi,
thanks. The code works.
However, why isn't it possible to create a new document and import another one containing a form?
Thank you.
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Well... it is possible. I have checked the following code. It's works fine. Code:
PdfCommon.Initialize();
//Create a new document
using (var newDoc = PdfDocument.CreateNew())
{
//Open PDF document with forms
using (var doc1 = PdfDocument.Load(@"d:\00\otpt4.pdf"))
{
//Open another PDF document.
using (var doc2 = PdfDocument.Load(@"d:\00\facture.pdf"))
{
//Import all pages from first document into newly created document
newDoc.Pages.ImportPages(
doc1,
string.Format("1-{0}", doc1.Pages.Count),
newDoc.Pages.Count
);
//Import all pages from second document into newly created document
newDoc.Pages.ImportPages(
doc2,
string.Format("1-{0}", doc2.Pages.Count),
newDoc.Pages.Count
);
}
//Save a copy of a document
newDoc.Save(@"d:\00\result.pdf", SaveFlags.NoIncremental);
}
}
Edited by user Sunday, July 10, 2016 9:00:48 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close