If the XImage has been
created with an XReadOptions with ReadModule
that uses an Operation, the
operation will be invoked and the result depends on the operation.
Otherwise, this method gets an image from the Image object and adds
it to the current page returning the ID of the newly added
object.
Adds the Selection of the
current Frame
returning the ID of the newly added object.
Ultimately each image which is imported goes through a ReadModule,
so see that property for the types of images that can be imported
and how they are handled.
If the Transparent parameter is set to true then any
transparency information will be preserved. This allows you to add
formats such as transparent GIF, PNG with alpha channel, or images
with masks set using the Image.SetMask method.
The image is scaled to fill the current Rect. It is transformed using the
current Transform.
Hyperlinks. Sometimes you may wish to insert annotations
such as links to an external web page specified using a URI or URL.
The AddTextStyled method allows you to specify links but only on
text. If, for example, you want to insert a link over content such
as an image you need to add it separately. You can do this using
code of the following form.
static int AddLinkToUri(Doc doc, XRect rect, string uri) {
int id = doc.AddObject("<< /Type /Annot /Subtype /Link /A << /Type /Action /S /URI /URI () >> /Border [0 0 0] >>");
doc.SetInfo(doc.Page, "/Annots*[]:Ref", id);
doc.SetInfo(id, "/Rect:Rect", doc.Rect.String);
doc.SetInfo(id, "/A/URI:Text", uri);
return id;
}
Private Shared Function AddLinkToUri(ByVal doc As Doc, ByVal rect As XRect, ByVal uri As String) As Integer
Dim id As Integer = doc.AddObject("<< /Type /Annot /Subtype /Link /A << /Type /Action /S /URI /URI () >> /Border [0 0 0] >>")
doc.SetInfo(doc.Page, "/Annots*[]:Ref", id)
doc.SetInfo(id, "/Rect:Rect", doc.Rect.String)
doc.SetInfo(id, "/A/URI:Text", uri)
Return id
End Function
If you wish to link to a particular page specified by page ID
you can use code of the following form.
static int AddLinkToPage(Doc doc, XRect rect, int pageID) {
int id = doc.AddObject("<< /Type /Annot /Subtype /Link /Border [0 0 0] /A << /Type /Action /S /GoTo /D [ /XYZ null null 0] >> >>");
doc.SetInfo(doc.Page, "/Annots*[]:Ref", id);
doc.SetInfo(id, "/Rect:Rect", doc.Rect.String);
doc.SetInfo(id, "/A/D[0]:Ref", pageID.ToString());
return id;
}
Private Shared Function AddLinkToPage(ByVal doc As Doc, ByVal rect As XRect, ByVal pageID As Integer) As Integer
Dim id As Integer = doc.AddObject("<< /Type /Annot /Subtype /Link /Border [0 0 0] /A << /Type /Action /S /GoTo /D [ /XYZ null null 0] >> >>")
doc.SetInfo(doc.Page, "/Annots*[]:Ref", id)
doc.SetInfo(id, "/Rect:Rect", doc.Rect.String)
doc.SetInfo(id, "/A/D[0]:Ref", pageID.ToString())
Return id
End Function
|
|
|
|