Merging PDFs isn’t just about stitching files together—often, you need to control which pages are included, maintain original bookmarks, and preserve critical document metadata. The Aspose.PDF.Merger Plugin for .NET gives you full programmatic control for even the most demanding legal, e-book, or technical documentation scenarios.
Introduction
Merging PDFs isn’t just about stitching files together—often, you need to control which pages are included, maintain original bookmarks, and preserve critical document metadata. The Aspose.PDF.Merger Plugin for .NET gives you full programmatic control for even the most demanding legal, e-book, or technical documentation scenarios.
Page Selection: Merge Only What You Need
Specify the exact pages to merge from each source file:
Bookmark and Metadata Retention
Aspose.PDF.Plugin can preserve original bookmarks and document metadata, ensuring a seamless reading experience and compliance:
- Bookmarks: MergeOptions supports bookmark retention, so navigation aids and TOCs are not lost during merging.
- Metadata: By default, document-level metadata (author, title, keywords, etc.) is preserved from the first file, or you can specify custom metadata in your merge options.
**Example:"
// Optionally set or override metadata
mergeOptions.Metadata = new PdfMetadata
{
Author = "Merged by Aspose",
Title = "Complete Documentation Set",
Subject = "Advanced Merge"
};
// Retain all bookmarks
mergeOptions.KeepBookmarks = true;
Output Options and Best Practices
- Custom Output Naming: Name outputs based on use-case, e.g.,
LegalBundle_Merged.pdf
orEbook_Complete.pdf
. - Validation: Open the merged file in Adobe or any PDF reader to check that page selection, bookmarks, and metadata are correct.
- Large Batches: For hundreds of PDFs, use a batching script and keep a log of input/output files for audit trails.
Use Cases
- Legal: Merge exhibits, filings, or correspondence, preserving original navigation.
- E-Books: Combine chapters, maintain TOC bookmarks and author metadata.
- Technical Docs: Create comprehensive guides from modular PDFs with all reference links intact.
Frequently Asked Questions
Q: Can I exclude specific pages when merging? A: Yes, use the pages array for each input to include/exclude as needed.
Q: Will bookmarks and links be lost during merge?
A: Set KeepBookmarks = true
to preserve all bookmarks and internal links.
Q: What happens to metadata? A: Metadata from the first PDF is preserved by default, but you can override or set new metadata for the merged document.
Conclusion
For ultimate control, preprocess PDFs with the Table Generator (for dynamic TOCs or summaries) before merging.