Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.
Fri Jan 26, 2018 6:24 pm
Hy,
we have to merge documents with annotation and bookmark, but each page must we analise for processing (some page must be removed).
Exists function or a way to copy annotation/books from on page to a new page? (destination page number can we different).
Spire.pdf version 3.10
Thanks,
JD
-
aibizcore
-
- Posts: 12
- Joined: Fri Dec 29, 2017 12:12 pm
Mon Jan 29, 2018 7:38 am
Hello,
Thanks for your inquiry. I am sorry Spire.Pdf doesn't support to copy annotation/bookmarks from one page to a new page at present. However we will investigate it and see if it's reachable, if there is any update, we will inform you.
Best regards,
Simon
E-iceblue support team
-
Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am
Sun Feb 11, 2018 7:10 am
Hello,
Please refer to the below code snippet to copy bookmarks. As for copying annotation, I get some feedback from our DEV team that it's not reachable at present.
- Code: Select all
PdfDocument pdf = new PdfDocument(@"BookmarkTemplate.pdf");
var bms= pdf.Bookmarks;
PdfDocument doc = new PdfDocument();
PdfPageBase page;
for (int i = 0; i < pdf.Pages.Count; i++)
{
page = doc.Pages.Add(pdf.Pages[i].Size, new Spire.Pdf.Graphics.PdfMargins(0));
pdf.Pages[i].CreateTemplate().Draw(page, new System.Drawing.PointF(0, 0));
}
for (int i = 0; i < bms.Count; i++)
{
//add vendor bookmark
PdfDestination vendorBookmarkDest = new PdfDestination(bms[i].Destination.Page, bms[i].Destination.Location);
PdfBookmark vendorBookmark = doc.Bookmarks.Add(bms[i].Title);
vendorBookmark.Color = bms[i].Color;
vendorBookmark.DisplayStyle = bms[i].DisplayStyle;
vendorBookmark.Action = new PdfGoToAction(vendorBookmarkDest);
for (int j = 0; j < bms[i].Count; j++)
{
//add part bookmark
PdfDestination partBookmarkDest = new PdfDestination(bms[i][j].Destination.Page, bms[i][j].Destination.Location);
PdfBookmark partBookmark = vendorBookmark.Add(bms[i][j].Title);
partBookmark.Color = bms[i][j].Color;
partBookmark.DisplayStyle = bms[i][j].DisplayStyle;
partBookmark.Action = new PdfGoToAction(partBookmarkDest);
}
}
doc.SaveToFile("unlockedBookmark.pdf");
Best regards,
Simon
E-icelbue support team
-
Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am
Thu Feb 22, 2018 9:02 am
Hello,
Greeting from E-iceblue.
Is the code snippet I provided helpful to you?
Your feedback will be greatly appreciated.
Best regards,
Simon
E-iceblue support team
-
Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am
Tue Feb 27, 2018 6:35 am
Hello,
Glad to inform you that copying annotation has been implemented. Please download
Spire.PDF Pack(Hot Fix) Version:4.2.8 and refer to the below code snippet to have a try.
- Code: Select all
var doc= new PdfDocment("1388.pdf");
doc.Pages.Add();
PdfAnnotationCollection annotationsWidget = doc.Pages[0].AnnotationsWidget;
for(int i = 0; i < annotationsWidget.Count; i++)
{
PdfAnnotation annotation = annotationsWidget[i];
if(annotation is PdfLineAnnotationWidget)
{ PdfLineAnnotationWidget line = annotation as PdfLineAnnotationWidget; doc.Pages[1].AnnotationsWidget.Add(Line); }
}
doc.SaveToFile("1388result.pdf");
Best regards,
Simon
E-iceblue support team
-
Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am
Mon Mar 05, 2018 7:43 am
Hello,
Greeting from E-iceblue.
Did you try the hotfix?
Your feedback will be greatly appreciated.
Best regards,
Simon
E-iceblue support team
-
Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am