The common annotation properties are described in table "Entries common to all annotation dictionaries" of the Pdf specification.
Declined: Handling a partial annotation import-export could lead to exporting invalid PDF documents.
When exporting a document referencing PdfProcessing`s .NET Standard assemblies with PdfComplianceLevel set an exception is thrown.
A Link annotation must have an associated action, destination, or named destination specifying what should happen when the annotation is activated. When merging documents with invalid Link annotations, an ArgumentException is thrown with the message 'Value cannot be null. Parameter name: namedDestination'
Workaround: Remove the invalid annotations:
foreach (var annotation in document.Annotations.ToList())
{
var link = annotation as Link;
if (link != null && link.Action == null && link.Destination == null && link.NamedDestination == null)
{
(annotation.Parent as RadFixedPage).Annotations.Remove(annotation);
}
}
I have read that there limitations to PDF files being imported, however, the file being imported was generated with FixedContentEditor, so, should be able to import?
using (Stream stream = Stream)By specification, the last line of the file contains only the end-of-file marker, %%EOF. If the file contains many trailing bytes at its end, a NotSupportedException: 'StartXRef keyword cannot be found.', is thrown.
Workaround: Trim any content after the end-of-file marker (see FixInvalidEndOfFile).
When merging documents` pages using the PdfStreamWriter the Form Fields are not copied:
using (PdfStreamWriter fileWriter = new PdfStreamWriter(File.OpenWrite(document2Name)))
{
// Iterate through the files you would like to merge
for (int i = 0; i < 2; i++)
{
// Open each of the files
using (PdfFileSource fileToMerge = new PdfFileSource(File.OpenRead(document1Name)))
{
// Iterate through the pages of the current document
foreach (PdfPageSource pageToMerge in fileToMerge.Pages)
{
// Append the current page to the fileWriter, which holds the stream of the result file
fileWriter.WritePage(pageToMerge);
}
}
}
}
A possible workaround is to use the RadFixedDocument`s Merge() method:
document1.Merge(document2);