aspose.pdf
Class DocumentAttachment

java.lang.Object
  extended by aspose.pdf.Paragraph
      extended by aspose.pdf.DocumentAttachment

public class DocumentAttachment
extends Paragraph

Represents a set of document level attachment in a Pdf document. Attachment can be file attachment, stream attachment or note annotation.

Typical usages are the following:

[Java] Pdf pdf1 = new Pdf(); Section sec1 = pdf1.getSections().add(); TextFileStream fstream; fstream = new TextFileStream("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.Color("Brown")); fstream = new TextFileStream("c:/readme.txt"); Attachment pageStreamAttachment = new Attachment(); sec1.getParagraphs().add(pageStreamAttachment); pageStreamAttachment.setAttachedStream(fstream); 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>


Nested Class Summary
 
Nested classes/interfaces inherited from class aspose.pdf.Paragraph
Paragraph.VerticalPositionInfo
 
Field Summary
 
Fields inherited from class aspose.pdf.Paragraph
isNeedAddToPage, isPositionProcessed, RealPageNumber, VerticalPosInfo
 
Constructor Summary
DocumentAttachment()
          Constructor - initializes a new instance of the DocumentAttachment class.
 
Method Summary
 java.lang.String getDocumentAttachmentCotentType()
          Gets a String that indicates the MIME type of the attached file.
 java.lang.String getDocumentAttachmentFile()
          Gets a String that indicates the DocumentAttachment file name.
 TextFileStream getDocumentAttachmentStream()
          Gets a stream attaches to the document.
 void setDocumentAttachmentCotentType(java.lang.String value)
          Sets a String that indicates the MIME type of the attached
 void setDocumentAttachmentFile(java.lang.String value)
          Sets a String that indicates the DocumentAttachment file name.
 void setDocumentAttachmentStream(TextFileStream value)
          Sets a stream attaches to the document.
 
Methods inherited from class aspose.pdf.Paragraph
getHeight, getID, getIsNeedAddToPage, getIsPositionGot, getIsPositionProcessed, getLeft, getMargin, getMayNeedReprocess, getNeedReprocess, getNextParagraphInHeading, getPageNumber, getParentCell, getPositioningType, getPosX, getPosY, getRealPageNumber, getReferenceParagraphID, getRefPara, getSection, getTop, getVerticalPosInfo, getWidth, isDisabled, isEndNote, isFirstParagraph, isFirstParagraphInColumn, isFootNote, isFootNoteProcessed, isInHeaderFooter, isInList, isKeptTogether, isKeptWithNext, isOnOddPage, setEndNote, setFootNoteProcessed, setHeight, setID, setIsDisabled, setIsFirstParagraph, setIsFirstParagraphInColumn, setIsFootNote, setIsInHeaderFooter, setIsInList, setIsKeptTogether, setIsKeptWithNext, setIsNeedAddToPage, setIsOnOddPage, setIsPositionGot, setIsPositionProcessed, setLeft, setMargin, setMayNeedReprocess, setNeedReprocess, setNextParagraphInHeading, setPageNumber, setParentCell, setParentIsTable, setPositioningType, setPosX, setPosY, setRealPageNumber, setReferenceParagraphID, setRefPara, setSection, setTop, setVerticalPosInfo, setWidth
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentAttachment

public DocumentAttachment()
Constructor - initializes a new instance of the DocumentAttachment class.

Method Detail

getDocumentAttachmentFile

public java.lang.String getDocumentAttachmentFile()
Gets a String that indicates the DocumentAttachment file name.

Returns:
A String value.

setDocumentAttachmentFile

public void setDocumentAttachmentFile(java.lang.String value)
Sets a String that indicates the DocumentAttachment file name.

Parameters:
value - Attachment file name.

getDocumentAttachmentStream

public TextFileStream getDocumentAttachmentStream()
Gets a stream attaches to the document.

Returns:
A TextFileStream object.

setDocumentAttachmentStream

public void setDocumentAttachmentStream(TextFileStream value)
Sets a stream attaches to the document.

Parameters:
value - Attachment stream.

getDocumentAttachmentCotentType

public java.lang.String getDocumentAttachmentCotentType()
Gets a String that indicates the MIME type of the attached file.

Returns:
A String value.

setDocumentAttachmentCotentType

public void setDocumentAttachmentCotentType(java.lang.String value)
Sets a String that indicates the MIME type of the attached

Parameters:
value - Attachment content type.