static bool Callback(ref CallbackStreamer _this, IntPtr data, uint size) { byte[] buffer = new byte[size]; Marshal.Copy(data, buffer, 0, (int)size); _this.ReceivingStream.Write(buffer, 0, (int)size); return(true); // Succeeded }
public void SaveCopy(string path) // TODO: must not match path of open document { using (var stream = new FileStream(path, FileMode.Create)) { var callbackStreamer = new CallbackStreamer(stream); PdfiumDLL.FPDF_SaveAsCopy(documentHandle, ref callbackStreamer, 0); } }
internal static extern int FPDF_SaveAsCopy(IntPtr documentHandle, ref CallbackStreamer cbStruct, int flags);