public static void Run() { // ExStart:AppendFiles // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Append file pdfEditor.Append(dataDir + "input.pdf", dataDir + "input2.pdf", 1, 1, dataDir + "AppendFiles_out.pdf"); // ExEnd:AppendFiles }
public static void Run() { // ExStart:AppendFiles // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Append file pdfEditor.Append(dataDir + "input.pdf", dataDir + "input2.pdf", 1, 1, dataDir + "AppendFiles_out.pdf"); // ExEnd:AppendFiles }
public static void Run() { // ExStart:AppendFilesUsingStreams // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Create streams FileStream inputStream = new FileStream( dataDir + "input.pdf", FileMode.Open); FileStream portStream = new FileStream(dataDir + "input2.pdf", FileMode.Open); FileStream outputStream = new FileStream(dataDir + "AppendFilesUsingStreams_out.pdf", FileMode.Create); // Append file pdfEditor.Append(inputStream, portStream, 1, 1, outputStream); // ExEnd:AppendFilesUsingStreams }
public static void Run() { // ExStart:AppendArrayOfFiles // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Array of files string[] portFiles = new string[2]; portFiles[0] = dataDir + "input.pdf"; portFiles[1] = dataDir + "input2.pdf"; // Append file pdfEditor.Append(dataDir + "input3.pdf", portFiles, 1, 1, dataDir + "AppendArrayOfFiles_out.pdf"); // ExEnd:AppendArrayOfFiles }
public static void Run() { // ExStart:AppendArrayOfFiles // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Array of files string[] portFiles = new string[2]; portFiles[0] = dataDir + "input.pdf"; portFiles[1] = dataDir + "input2.pdf"; // Append file pdfEditor.Append(dataDir + "input3.pdf", portFiles, 1, 1, dataDir + "AppendArrayOfFiles_out.pdf"); // ExEnd:AppendArrayOfFiles }
public static void Run() { // ExStart:AppendFilesUsingStreams // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Create streams FileStream inputStream = new FileStream(dataDir + "input.pdf", FileMode.Open); FileStream portStream = new FileStream(dataDir + "input2.pdf", FileMode.Open); FileStream outputStream = new FileStream(dataDir + "AppendFilesUsingStreams_out.pdf", FileMode.Create); // Append file pdfEditor.Append(inputStream, portStream, 1, 1, outputStream); // ExEnd:AppendFilesUsingStreams }
public static void Run() { // ExStart:AppendArrayOfFilesUsingStream // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Input and output stream FileStream inputStream = new FileStream( dataDir + "input.pdf", FileMode.Open); FileStream outputStream = new FileStream(dataDir + "AppendArrayOfFilesUsingStream_out_.pdf", FileMode.Create); // Srray of streams FileStream[] portStreams = new FileStream[2]; portStreams[0] = new FileStream( dataDir + "input2.pdf", FileMode.Open); portStreams[1] = new FileStream(dataDir + "input3.pdf", FileMode.Open); //Append file pdfEditor.Append(inputStream, portStreams, 1, 1, outputStream); // ExEnd:AppendArrayOfFilesUsingStream }
public static void Run() { // ExStart:AppendArrayOfFilesUsingStream // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Create PdfFileEditor object PdfFileEditor pdfEditor = new PdfFileEditor(); // Input and output stream FileStream inputStream = new FileStream( dataDir + "input.pdf", FileMode.Open); FileStream outputStream = new FileStream(dataDir + "AppendArrayOfFilesUsingStream_out.pdf", FileMode.Create); // Srray of streams FileStream[] portStreams = new FileStream[2]; portStreams[0] = new FileStream( dataDir + "input2.pdf", FileMode.Open); portStreams[1] = new FileStream(dataDir + "input3.pdf", FileMode.Open); // Append file pdfEditor.Append(inputStream, portStreams, 1, 1, outputStream); // ExEnd:AppendArrayOfFilesUsingStream }
public static void Run() { // ExStart:PdfFileEditorFeatures // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); // Create instance of PdfFileEditor class PdfFileEditor pdfEditor = new PdfFileEditor(); // Append pages from input file to the port file and save in output file int start = 1; int end = 3; pdfEditor.Append(dataDir + "inFile.pdf", dataDir + "portFile.pdf", start, end, dataDir + "outFile.pdf"); // Concatenate two files and save in the third one pdfEditor.Concatenate(dataDir + "inFile1.pdf", dataDir + "inFile2.pdf", dataDir + "outFile.pdf"); // Delete specified number of pages from the file int[] pages = new int[] { 1, 2, 4, 10 }; pdfEditor.Delete(dataDir + "inFile.pdf", pages, dataDir + "outFile.pdf"); // Extract any pages from the file start = 0; end = 3; pdfEditor.OwnerPassword = "******"; pdfEditor.Extract(dataDir + "inFile.pdf", start, end, dataDir + "outFile.pdf"); // Insert pages from another file into the output file at a specified position start = 2; end = 5; pdfEditor.Insert(dataDir + "inFile.pdf", 4, dataDir + "portFile.pdf", start, end, dataDir + "outFile.pdf"); // Make booklet pdfEditor.MakeBooklet(dataDir + "inFile.Pdf", dataDir + "outFile.Pdf"); // Make N-Ups pdfEditor.MakeNUp(dataDir + "inFile.pdf", dataDir + "nupOutFile.pdf", 3, 2); // Split the front part of the file pdfEditor.SplitFromFirst(dataDir + "inFile.pdf", 3, dataDir + "outFile.pdf"); // Split the rear part of the file pdfEditor.SplitToEnd(dataDir + "inFile.pdf", 3, dataDir + "outFile.pdf"); // Split to individual pages int fileNum = 1; MemoryStream[] outBuffer = pdfEditor.SplitToPages(dataDir + "inFile.pdf"); foreach (MemoryStream aStream in outBuffer) { FileStream outStream = new FileStream("oneByone" + fileNum.ToString() + ".pdf", FileMode.Create); aStream.WriteTo(outStream); outStream.Close(); fileNum++; } // Split to several multi-page pdf documents fileNum = 1; int[][] numberofpage = new int[][] { new int[] { 1, 4 } }; MemoryStream[] outBuffer2 = pdfEditor.SplitToBulks(dataDir + "inFile.pdf", numberofpage); foreach (MemoryStream aStream in outBuffer2) { FileStream outStream = new FileStream("oneByone" + fileNum.ToString() + ".pdf", FileMode.Create); aStream.WriteTo(outStream); outStream.Close(); fileNum++; } // ExEnd:PdfFileEditorFeatures }
public static void Run() { // ExStart:PdfFileEditorFeatures // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); // Create instance of PdfFileEditor class PdfFileEditor pdfEditor = new PdfFileEditor(); // Append pages from input file to the port file and save in output file int start = 1; int end = 3; pdfEditor.Append(dataDir + "inFile.pdf", dataDir + "portFile.pdf", start, end, dataDir + "outFile.pdf"); // Concatenate two files and save in the third one pdfEditor.Concatenate(dataDir + "inFile1.pdf", dataDir + "inFile2.pdf", dataDir + "outFile.pdf"); // Delete specified number of pages from the file int[] pages = new int[] { 1, 2, 4, 10 }; pdfEditor.Delete(dataDir + "inFile.pdf", pages, dataDir + "outFile.pdf"); // Extract any pages from the file start = 0; end = 3; pdfEditor.OwnerPassword = "******"; pdfEditor.Extract(dataDir + "inFile.pdf", start, end, dataDir + "outFile.pdf"); // Insert pages from another file into the output file at a specified position start = 2; end = 5; pdfEditor.Insert(dataDir + "inFile.pdf", 4, dataDir + "portFile.pdf", start, end, dataDir + "outFile.pdf"); // Make booklet pdfEditor.MakeBooklet(dataDir + "inFile.Pdf", dataDir + "outFile.Pdf"); // Make N-Ups pdfEditor.MakeNUp(dataDir + "inFile.pdf", dataDir + "nupOutFile.pdf", 3, 2); // Split the front part of the file pdfEditor.SplitFromFirst(dataDir + "inFile.pdf", 3, dataDir + "outFile.pdf"); // Split the rear part of the file pdfEditor.SplitToEnd(dataDir + "inFile.pdf", 3, dataDir + "outFile.pdf"); // Split to individual pages int fileNum = 1; MemoryStream[] outBuffer = pdfEditor.SplitToPages(dataDir + "inFile.pdf"); foreach (MemoryStream aStream in outBuffer) { FileStream outStream = new FileStream("oneByone" + fileNum.ToString() + ".pdf", FileMode.Create); aStream.WriteTo(outStream); outStream.Close(); fileNum++; } // Split to several multi-page pdf documents fileNum = 1; int[][] numberofpage = new int[][] { new int[] { 1, 4 }}; MemoryStream[] outBuffer2 = pdfEditor.SplitToBulks(dataDir + "inFile.pdf", numberofpage); foreach (MemoryStream aStream in outBuffer2) { FileStream outStream = new FileStream("oneByone" + fileNum.ToString() + ".pdf", FileMode.Create); aStream.WriteTo(outStream); outStream.Close(); fileNum++; } // ExEnd:PdfFileEditorFeatures }