using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Printing; using System.IO; using System.Text; namespace PdfiumViewer { /// /// Represents a PDF document. /// public interface IPdfDocument : IDisposable { /// /// Number of pages in the PDF document. /// int PageCount { get; } /// /// Bookmarks stored in this PdfFile /// PdfBookmarkCollection Bookmarks { get; } /// /// Size of each page in the PDF document. /// IList PageSizes { get; } /// /// Renders a page of the PDF document to the provided graphics instance. /// /// Number of the page to render. /// Graphics instance to render the page on. /// Horizontal DPI. /// Vertical DPI. /// Bounds to render the page in. /// Render the page for printing. void Render(int page, Graphics graphics, float dpiX, float dpiY, Rectangle bounds, bool forPrinting); /// /// Renders a page of the PDF document to the provided graphics instance. /// /// Number of the page to render. /// Graphics instance to render the page on. /// Horizontal DPI. /// Vertical DPI. /// Bounds to render the page in. /// Flags used to influence the rendering. void Render(int page, Graphics graphics, float dpiX, float dpiY, Rectangle bounds, PdfRenderFlags flags); /// /// Renders a page of the PDF document to an image. /// /// Number of the page to render. /// Horizontal DPI. /// Vertical DPI. /// Render the page for printing. /// The rendered image. Image Render(int page, float dpiX, float dpiY, bool forPrinting); /// /// Renders a page of the PDF document to an image. /// /// Number of the page to render. /// Horizontal DPI. /// Vertical DPI. /// Flags used to influence the rendering. /// The rendered image. Image Render(int page, float dpiX, float dpiY, PdfRenderFlags flags); /// /// Renders a page of the PDF document to an image. /// /// Number of the page to render. /// Width of the rendered image. /// Height of the rendered image. /// Horizontal DPI. /// Vertical DPI. /// Render the page for printing. /// The rendered image. Image Render(int page, int width, int height, float dpiX, float dpiY, bool forPrinting); /// /// Renders a page of the PDF document to an image. /// /// Number of the page to render. /// Width of the rendered image. /// Height of the rendered image. /// Horizontal DPI. /// Vertical DPI. /// Flags used to influence the rendering. /// The rendered image. Image Render(int page, int width, int height, float dpiX, float dpiY, PdfRenderFlags flags); /// /// Renders a page of the PDF document to an image. /// /// Number of the page to render. /// Width of the rendered image. /// Height of the rendered image. /// Horizontal DPI. /// Vertical DPI. /// Rotation. /// Flags used to influence the rendering. /// The rendered image. Image Render(int page, int width, int height, float dpiX, float dpiY, PdfRotation rotate, PdfRenderFlags flags); /// /// Save the PDF document to the specified location. /// /// Path to save the PDF document to. void Save(string path); /// /// Save the PDF document to the specified location. /// /// Stream to save the PDF document to. void Save(Stream stream); /// /// Finds all occurences of text. /// /// The text to search for. /// Whether to match case. /// Whether to match whole words only. /// All matches. PdfMatches Search(string text, bool matchCase, bool wholeWord); /// /// Finds all occurences of text. /// /// The text to search for. /// Whether to match case. /// Whether to match whole words only. /// The page to search on. /// All matches. PdfMatches Search(string text, bool matchCase, bool wholeWord, int page); /// /// Finds all occurences of text. /// /// The text to search for. /// Whether to match case. /// Whether to match whole words only. /// The page to start searching. /// The page to end searching. /// All matches. PdfMatches Search(string text, bool matchCase, bool wholeWord, int startPage, int endPage); /// /// Creates a for the PDF document. /// /// PrintDocument CreatePrintDocument(); /// /// Creates a for the PDF document. /// /// Specifies the mode for printing. The default /// value for this parameter is CutMargin. /// PrintDocument CreatePrintDocument(PdfPrintMode printMode); /// /// Creates a for the PDF document. /// /// The settings used to configure the print document. /// PrintDocument CreatePrintDocument(PdfPrintSettings settings); /// /// Returns all links on the PDF page. /// /// The page to get the links for. /// The size of the page. /// A collection with the links on the page. PdfPageLinks GetPageLinks(int page, Size size); /// /// Delete the page from the PDF document. /// /// The page to delete. void DeletePage(int page); /// /// Rotate the page. /// /// The page to rotate. /// How to rotate the page. void RotatePage(int page, PdfRotation rotation); /// /// Get metadata information from the PDF document. /// /// The PDF metadata. PdfInformation GetInformation(); /// /// Get all text on the page. /// /// The page to get the text for. /// The text on the page. string GetPdfText(int page); /// /// Get all text matching the text span. /// /// The span to get the text for. /// The text matching the span. string GetPdfText(PdfTextSpan textSpan); /// /// Get all bounding rectangles for the text span. /// /// /// The algorithm used to get the bounding rectangles tries to join /// adjacent character bounds into larger rectangles. /// /// The span to get the bounding rectangles for. /// The bounding rectangles. IList GetTextBounds(PdfTextSpan textSpan); /// /// Convert a point from device coordinates to page coordinates. /// /// The page number where the point is from. /// The point to convert. /// The converted point. PointF PointToPdf(int page, Point point); /// /// Convert a point from page coordinates to device coordinates. /// /// The page number where the point is from. /// The point to convert. /// The converted point. Point PointFromPdf(int page, PointF point); /// /// Convert a rectangle from device coordinates to page coordinates. /// /// The page where the rectangle is from. /// The rectangle to convert. /// The converted rectangle. RectangleF RectangleToPdf(int page, Rectangle rect); /// /// Convert a rectangle from page coordinates to device coordinates. /// /// The page where the rectangle is from. /// The rectangle to convert. /// The converted rectangle. Rectangle RectangleFromPdf(int page, RectangleF rect); } }