/* CHAPTER 12. File Attachments */

/** Attaches a file to the PDF. It is attached at document level.
@param filename file name
@param pdf PDF document */
public void attachFile(String filename, Pdf pdf) throws CpdfError;

/** Attaches a file to a page of the PDF. Given its file name, pdf, and the
page number to which it should be attached.
@param filename file name
@param pdf PDF document
@param pagenumber page number to attach to */
public void attachFileToPage(String filename, Pdf pdf, int pagenumber)
    throws CpdfError;

/** Attaches data from memory to a document.
@param data attachment itself
@param filename file name to use to describe attachment
@param pdf PDF document */
public void attachFileFromMemory(byte[] data, String filename, Pdf pdf)
    throws CpdfError;

/** Attaches data to a page from memory.
@param data attachment itself
@param filename file name to use to describe attachment
@param pdf PDF document */
public void attachFileToPageFromMemory(byte[] data, String filename,
                                       Pdf pdf, int pagenumber)
    throws CpdfError;

/** Removes all page- and document-level attachments from a document. */
public native void removeAttachedFiles(Pdf pdf) throws CpdfError;

/** Lists information about attachments. Call
{@link #startGetAttachments(pdf) startGetAttachments} first, then {@link
#numberGetAttachments() numberGetAttachments} to find out how many there are.
Then {@link #getAttachmentName(int) getAttachmentName}, {@link
#getAttachmentPage(int) getAttachmentPage}, or {@link #getAttachmentData(int)
getAttachmentData}. to return each one <code>0...(n - 1)</code>. Finally, call
{@link #endGetAttachments() #endGetAttachments} to clean up. */
public native void startGetAttachments(Pdf pdf) throws CpdfError;

public native int numberGetAttachments() throws CpdfError;

/** Gets the name of an attachment, given a serial number. */
public native String getAttachmentName(int serial) throws CpdfError;

/** Gets the page number, given a serial number. 0 = document level. */
public native int getAttachmentPage(int serial) throws CpdfError;

/** Gets the attachment data itself, given a serial number. */
public native byte[] getAttachmentData(int serial) throws CpdfError;

public native void endGetAttachments() throws CpdfError; 
