Word to PDF Converter. Excel to PDF Converter. PDF to Text Converter. PDF to Image Converter. PDF Print. PDF Merge. PDF Split. PDF Security. PDF Images Extractor. Excel Library. Chart Control for ASP. Then select the iTextSharp Nuget and click on Install. FileStream outputPdfPath, System. GetImportedPage reader, i ; pdfCopyProvider. Matches sr.
ReadToEnd ; return matches. Now we need to call the "MergePDF" function. There are two parameters in MergePDF function; one is File 1 and the second is File 2, this is the source path of both pdfs. Install the Syncfusion. WinForms NuGet package as reference to your.
Include the following namespaces in the Program. C using Syncfusion. Pdf; using System. Imports Syncfusion. Pdf Imports System. Merge finalDoc, source ;. Save "Sample. Close true ;. Merge finalDoc, source 'Save the document finalDoc. Close True. Note: Starting with v Free Trial.
Did you find this information helpful? This method avoids the extensive memory usage and increases the performance. Note: The parent PDF document has all the contents in run time memory.
It releases the memory once the final PDF document instance is disposed. The following code snippet explains this. You can optimize the resources by enabling the OptimizeResources property available in the PdfMergeOptions instance. Optimization will be effective only with merge, append and import functions.
Enabling this property will optimize the memory but a difference in time occurs based on the document size. For example, if the PDF document has pages and each page has an image in common. If we import those document pages with the EnableMemoryOptimization disabled by default it is disabled. We will clone the image resource for each page separately.
That leads to the imported document having a huge size when compared to the source PDF. That does not cause any PDF file size issue. Moreover, it does not cause any memory leak issues. So, without any hassle, you can enable the EnableMemoryOptimization property whenever you need this behavior. Refer to the following code snippet to reduce the PDF file size while importing pages from multiple documents.
Take a look at our next generation Bold Reporting Tools. Learn more. File Formats.
0コメント