/// <summary> /// Get the URI path of |action|. /// </summary> /// <param name="document">Handle to the document.</param> /// <param name="action">Handle to the action. Must be a |PDFACTION_URI|.</param> /// <param name="buffer">A buffer for the path string. May be NULL.</param> /// <param name="buflen">The length of the buffer, in bytes. May be 0.</param> /// <returns>Returns the number of bytes in the URI path, including the trailing NUL character, or 0 on error, /// typically because the arguments were bad or the action was of the wrong type.</returns> /// <remarks> /// The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the returned length, /// or |buffer| is NULL, |buffer| will not be modified. /// FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action, void* buffer, unsigned long buflen);. /// </remarks> public int FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action, IntPtr buffer, ulong buflen) { lock (_syncObject) { return(FPDFAction_GetURIPathStatic(document, action, buffer, buflen)); } }
/// <summary> /// Get the file path of |action|. /// </summary> /// <param name="action">Handle to the action. |action| must be a |PDFACTION_LAUNCH| or |PDFACTION_REMOTEGOTO|.</param> /// <param name="buffer">A buffer for output the path string. May be NULL.</param> /// <param name="buflen">The length of the buffer, in bytes. May be 0.</param> /// <returns>Returns the number of bytes in the file path, including the trailing NUL character, or 0 on error, /// typically because the arguments were bad or the action was of the wrong type.</returns> /// <remarks> /// Regardless of the platform, the |buffer| is always in UTF-8 encoding. /// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer| will not be modified. /// FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen);. /// </remarks> public int FPDFAction_GetFilePath(FPDF_ACTION action, IntPtr buffer, ulong buflen) { lock (_syncObject) { return(FPDFAction_GetFilePathStatic(action, buffer, buflen)); } }
/// <summary> /// Get the destination of |action|. /// </summary> /// <param name="document">Handle to the document.</param> /// <param name="action">Handle to the action. |action| must be a |PDFACTION_GOTO| or |PDFACTION_REMOTEGOTO|.</param> /// <returns>Returns a handle to the destination data, or NULL on error, /// typically because the arguments were bad or the action was of the wrong type.</returns> /// <remarks> /// In the case of |PDFACTION_REMOTEGOTO|, you must first call FPDFAction_GetFilePath(), then load the document at that path, /// then pass the document handle from that document as |document| to FPDFAction_GetDest(). /// FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action);. /// </remarks> public FPDF_DEST FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action) { lock (_syncObject) { return(FPDFAction_GetDestStatic(document, action)); } }
/// <summary> /// Get the type of |action|. /// </summary> /// <param name="action">Handle to the action.</param> /// <returns>Returns one of: PDFACTION_UNSUPPORTED, PDFACTION_GOTO, PDFACTION_REMOTEGOTO, PDFACTION_URI, PDFACTION_LAUNCH.</returns> /// <remarks> /// FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action);. /// </remarks> public uint FPDFAction_GetType(FPDF_ACTION action) { lock (_syncObject) { return(FPDFAction_GetTypeStatic(action)); } }
/// <summary> /// Gets URI path of a <see cref="FPDF_ACTION" /> of type <see cref="ActionTypes.Uri" />. /// </summary> /// <param name="document">Handle to the document.</param> /// <param name="action">Handle to the action. Must be of type <see cref="ActionTypes.Uri" />.</param> /// <returns>The URI path of <paramref name="action" />.</returns> /// <seealso cref="PdfAction.Uri" /> public static string FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action) => GetAsciiString((ref byte buffer, int length) => (int)FPDFAction_GetURIPath(document, action, ref buffer, (uint)length));
/// <summary> /// Gets the file path of a <see cref="FPDF_ACTION" /> of type <see cref="ActionTypes.RemoteGoTo" /> or /// <see cref="ActionTypes.Launch" />. /// </summary> /// <param name="action"> /// Handle to the action. Must be of type <see cref="ActionTypes.RemoteGoTo" /> or /// <see cref="ActionTypes.Launch" />. /// </param> /// <returns>The file path of <paramref name="action" />.</returns> /// <seealso cref="PdfAction.FilePath" /> public static string FPDFAction_GetFilePath(FPDF_ACTION action) => GetUtf16String((ref byte buffer, int length) => (int)FPDFAction_GetFilePath(action, ref buffer, (uint)length), sizeof(byte), true);
public void FPDF_ACTION_Constructor_Call2_Success() { var h = new FPDF_ACTION(new IntPtr(1)); Assert.IsTrue(h.IsValid); }
public void FPDF_ACTION_Constructor_Call1_Success() { var h = new FPDF_ACTION(); Assert.IsFalse(h.IsValid); }
/// <summary> /// Initializes a new instance of the <see cref="PDFAction"/> class. /// </summary> /// <param name="mainComponent">Main component where this destination belongs.</param> /// <param name="actionHandle">Handle of associated action.</param> public PDFAction(PDFComponent mainComponent, FPDF_ACTION actionHandle) { _mainComponent = mainComponent ?? throw new ArgumentNullException(nameof(mainComponent)); _actionHandle = actionHandle; }