Hi,
Thanks for sharing your feedback.
Please take a look over the following code snippet in which I have created a simple PDF document containing a simple text paragraph. Later on, the pages from this newly generated PDF document are inserted into already existing PDF file. I have also attached the already existent PDF document and the resultant PDF that I have generated after Insert(...) method.
In case still it does not resolve your problem or you have any further query, please feel free to contact. We apologize for your inconvenience.
[C#]
// create MemoryStream object
MemoryStream memorystream = new MemoryStream();
// Instantiate an object PDF class
Pdf pdf = new Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Section section = pdf.Sections.Add();
// create a simple text paragraph
Text text1 = new Text("Hello world in document generated with Aspose.Pdf");
// add text paragraph to the paragraphs collection of section object
section.Paragraphs.Add(text1);
//Save the pdf document
pdf.Save(memorystream);
//Initialize the string variables storing paths of PDF files
string inFile1 = @"D:/pdftest/TIFFtoPDFConversion_test.pdf";
//Creating stream objects holding the PDF files in Open Mode
FileStream inStream1 = new FileStream(inFile1, FileMode.Open);
//Creating output stream object that will store the extracted pages as a PDF file
FileStream outputStream = new FileStream(@"D:/pdftest/ResultantPDF_Document.pdf", FileMode.Create);
//Instantiating PdfFileEditor object
PdfFileEditor editor = new PdfFileEditor();
//Setting the page number of the inStream1 as location where pages will be inserted
int location = 1;
//Creating an array of Page Numbers to be inserted
int[] pages = new int[] { 1};
//Calling Insert method
editor.Insert(memorystream, location, inStream1, pages, outputStream);
//Closing output stream
outputStream.Close();