/// <summary> /// Load an image from a JPEG image file and then set it into <paramref name="image_object" />. /// </summary> /// <param name="loadedPages">All loaded pages, may be <c>null</c>.</param> /// <param name="image_object">Handle to an image object.</param> /// <param name="stream">Stream which provides access to an JPEG image.</param> /// <param name="count">The number of bytes to read from <paramref name="stream" /> or 0 to read to the end.</param> /// <param name="inline"> /// If <c>true</c>, this function loads the JPEG image inline, so the image /// content is copied to the file. This allows <paramref name="stream" /> /// to be closed after this function returns. /// </param> /// <returns><c>true</c> on success.</returns> /// <remarks> /// The image object might already have an associated image, which is shared and /// cached by the loaded pages. In that case, we need to clear the cached image /// for all the loaded pages. Pass <paramref name="loadedPages" /> to this API /// to clear the image cache. If the image is not previously shared, <c>null</c> is a /// valid <paramref name="loadedPages" /> value. /// </remarks> public static bool FPDFImageObj_LoadJpegFile(FPDF_PAGE[] loadedPages, FPDF_PAGEOBJECT image_object, Stream stream, int count = 0, bool inline = true) => inline ? FPDFImageObj_LoadJpegFileInline(ref loadedPages[0], loadedPages.Length, image_object, FPDF_FILEREAD.FromStream(stream, count)) : FPDFImageObj_LoadJpegFile(ref loadedPages[0], loadedPages.Length, image_object, FPDF_FILEREAD.FromStream(stream, count));
/// <summary> /// Loads a <see cref="PdfDocument"/> from '<paramref name="count"/>' bytes read from a <paramref name="stream"/>. /// <see cref="Close"/> must be called in order to free unmanaged resources. /// </summary> /// <param name="stream"></param> /// <param name="fileRead"></param> /// <param name="count"> /// The number of bytes to read from the <paramref name="stream"/>. /// If the value is equal to or smaller than 0, the stream is read to the end. /// </param> /// <param name="password"></param> public PdfDocument(Stream stream, FPDF_FILEREAD fileRead, int count = 0, string password = null) : this(Pdfium.FPDF_LoadDocument(stream, fileRead, count, password)) { }
/// <summary> /// Loads a PDF document from '<paramref name="count" />' bytes read from a stream. /// </summary> /// <param name="fileRead"></param> /// <param name="count"> /// The number of bytes to read from the <paramref name="stream" />. /// If the value is equal to or smaller than 0, the stream is read to the end. /// </param> /// <param name="stream"></param> /// <param name="password">Pdf password</param> public static FPDF_DOCUMENT FPDF_LoadDocument(Stream stream, FPDF_FILEREAD fileRead, int count = 0, string password = null) => FPDF_LoadCustomDocument(fileRead, password);
/// <summary> /// Loads a PDF document from '<paramref name="count"/>' bytes read from a stream. /// </summary> /// <param name="count"> /// The number of bytes to read from the <paramref name="stream"/>. /// If the value is equal to or smaller than 0, the stream is read to the end. /// </param> public static FPDF_DOCUMENT FPDF_LoadDocument(Stream stream, int count = 0, string password = null) { return(FPDF_LoadCustomDocument(FPDF_FILEREAD.FromStream(stream, count), password)); }