public class DocumentAttachment extends Paragraph
Represents a set of document level attachment Paragraph
in a Pdf document. Attachment can be file attachment,
stream attachment or note annotation.
[Java] Pdf pdf1 = new Pdf(); Section sec1 = pdf1.getSections().add(); InputStream fstream = new FileInputStream("c:/word.doc"); DocumentAttachment DocStreamAttachment = new DocumentAttachment(); pdf1.getDocumentAttachments().add(DocStreamAttachment); DocStreamAttachment.setDocumentAttachmentStream ( fstream); DocStreamAttachment.setDocumentAttachmentCotentType ( "doc"); DocumentAttachment DocFileAttachment = new DocumentAttachment(); pdf1.getDocumentAttachments().add(DocFileAttachment); DocFileAttachment.setDocumentAttachmentFile ( "c:/image.jpg"); DocFileAttachment.setDocumentAttachmentCotentType ( "jpeg"); Attachment PageFileAttachment = new Attachment(); sec1.getParagraphs().add(PageFileAttachment); PageFileAttachment.setAttachmentType ( AttachmentType.File); PageFileAttachment.setAttachedFileName ( "c:/text.txt"); PageFileAttachment.setAttachedFileType ( "txt"); PageFileAttachment.setFileIconType ( FileIconType.Graph); PageFileAttachment.setIconColor ( new aspose.pdf.generator.Color("Brown")); fstream = new FileInputStream("c:/readme.txt"); Attachment PageStreamAttachment = new Attachment(); sec1.getParagraphs().add(PageStreamAttachment); PageStreamAttachment.setAttachedStream ( fstream0; PageStreamAttachment.setAttachedFileType ( "txt"); PageStreamAttachment.setAttachmentType ( AttachmentType.File); PageStreamAttachment.setFileIconType ( FileIconType.PaperClip); Attachment PageNoteAttachment = new Attachment(); sec1.getParagraphs().add(PageNoteAttachment); PageNoteAttachment.setAttachmentType ( AttachmentType.Note); PageNoteAttachment.setNoteContent ( "This is a note."); PageNoteAttachment.setIsNoteOpen ( true); pdf1.save("test.pdf"); [XML] <?xml version="1.0" encoding="utf-8" ?> <Pdf xmlns="Aspose.Pdf"> <DocumentAttachment DocumentAttachmentFileName="c:/word.doc" DocumentAttachmentFileType="doc"> </DocumentAttachment> <DocumentAttachment DocumentAttachmentFileName="c:/image.jpg" DocumentAttachmentFileType="jpeg"> </DocumentAttachment> <Section> <Attachment AttachmentType="File" AttachedFileName="c:/text.txt" AttachedFileType="txt" FileIconType="Graph" IconColor="Brown"> </Attachment> <Attachment AttachmentType="File" AttachedFileName="c:/readme.txt" AttachedFileType="txt" FileIconType="PaperClip"> </Attachment> <Attachment AttachmentType="Note" IsNoteOpen="true" NoteContent="This is a note."> </Attachment> </Section> </Pdf>
Modifier and Type | Field and Description |
---|---|
String |
DocumentAttachmentContentType
Gets or sets a string that indicates the MIME type of the attached file.
|
String |
DocumentAttachmentFile
Gets or sets a string that indicates the DocumentAttachment file name.
|
com.aspose.ms.System.IO.Stream |
DocumentAttachmentStream
Gets or sets a stream attaches to the document.
|
_PositioningType, FixedHeight, FixedWidth, ID, IsDisabled, IsFirstParagraph, IsFirstParagraphInColumn, IsInList, IsKeptTogether, IsKeptWithNext, IsOnOddPage, Left, Margin, ReferenceParagraphID, Top
Constructor and Description |
---|
DocumentAttachment()
Initializes a new instance of the
DocumentAttachment class. |
Modifier and Type | Method and Description |
---|---|
Object |
completeClone() |
Object |
deepClone() |
copyTo, getBookmarked, setBookmarked
load
public String DocumentAttachmentFile
Gets or sets a string that indicates the DocumentAttachment file name.
public com.aspose.ms.System.IO.Stream DocumentAttachmentStream
Gets or sets a stream attaches to the document.
public String DocumentAttachmentContentType
Gets or sets a string that indicates the MIME type of the attached file. When
public DocumentAttachment()
Initializes a new instance of the DocumentAttachment
class.
public Object completeClone()
completeClone
in class Paragraph
public Object deepClone()
Copyright © 2014 Aspose. All Rights Reserved.