This example shows how to create and embed thumbnails in a PDF document.
[C#]
using (Doc doc = new Doc(), srcDoc = new Doc()) {
doc.Read("spaceshuttle.pdf");
doc.Rendering.DotsPerInch = 18;
Page[] pages = doc.ObjectSoup.Catalog.Pages.GetPageArrayAll();
foreach (Page page in pages) {
doc.Page = page.ID;
using (XImage xi = XImage.FromData(doc.Rendering.GetData(".jpg"), null))
page.Thumbnail = PixMap.FromXImage(doc.ObjectSoup, xi);
}
doc.Save("embedthumbnails.pdf");
}
[Visual Basic]
Sub ...
Using doc As New Doc(), srcDoc As New Doc()
doc.Read("spaceshuttle.pdf")
doc.Rendering.DotsPerInch = 18
Dim pages As Page() = doc.ObjectSoup.Catalog.Pages.GetPageArrayAll()
For Each page As Page In pages
doc.Page = page.ID
Using xi As XImage = XImage.FromData(doc.Rendering.GetData(".jpg"), Nothing)
page.Thumbnail = PixMap.FromXImage(doc.ObjectSoup, xi)
End Using
Next
doc.Save("embedthumbnails.pdf")
End Using
End Sub
|
|
|