PdfSharp.Quality Static helper functions for fonts. Gets the assets folder or null, if no such folder exists. The path or null, if the function should use the current folder. Checks whether the assets folder exists and throws an exception if not. The path or null, if the function should use the current folder. Converts specified information about a required typeface into a specific font. Name of the font family. Set to true when a bold font face is required. Set to true when an italic font face is required. Information about the physical font, or null if the request cannot be satisfied. Gets the bytes of a physical font with specified face name. A face name previously retrieved by ResolveTypeface. Base class for features. Renders a code snippet to PDF. A code snippet. Renders a code snippet to PDF. Renders all code snippets to PDF. Creates a PDF test document. Saves a PDF document to stream or save to file. The document. The stream. The filename tag. if set to true [show]. Saves a PDF document and show it document. The document. The filename tag. Saves a PDF document into a file. The PDF document. The tag of the PDF file. Reads and writes a PDF document. The PDF file to read. The password provider if the file is protected. Base class with common code for both features and snippets. Initializes a new instance of the class. Specifies how to draw a box on the PDF page. Draw no box. Draw a box. Draw Draw Draw The width of the PDF page in point. The height of the PDF page in point. The width of the PDF page in millimeter. The height of the PDF page in millimeter. The width of the PDF page in presentation units. The width of the PDF page in presentation units. The width of the drawing box in presentation units. The height of the drawing box in presentation units. The center of the box. Gets the gray background brush for boxes. Gets a tag that specifies the PDFsharp build technology. It is either 'core', 'gdi', or 'wpf'. Creates a new PDF document. Ends access to the current PDF document and renders it to a memory stream. Creates a new page in the current PDF document. Creates a new page in the current PDF document. Ends the current PDF page. Generates a PDF document for parallel comparison of two render results. Generates the serial comparison document. DOCTODO Saves the bytes to PDF file and show file. The source bytes. The filepath. if set to true [start viewer]. sourceBytes Saves and optionally shows a PDF document. The filepath. if set to true [start viewer]. Saves and optionally shows a PNG image. The filepath. if set to true [start viewer]. Saves and shows a parallel comparison PDF document. The filepath. if set to true [start viewer]. Saves a stream to a file. The stream. The path. Prepares new bitmap image for drawing. Ends the current GDI+ image. Gets the current PDF document. Gets the current PDF page. Gets the current PDFsharp graphics object. Gets the bytes of a PDF document. Gets the bytes of a PNG image. Gets the bytes of a comparision document. Static helper functions for fonts. Returns the specified font from an embedded resource. Returns the specified font from an embedded resource. Static helper functions for file IO. Static helper functions for file IO. Static utility functions for file IO. These function are intended for unit test und sample in a solution code only. True if the given character is a directory separator. Replaces all back-slashes with forward slashes in the specified path. The resulting path works under Windows and Linux if no drive names are included. Gets the root path of the current solution, or null, if no parent directory with a solution file exists. Gets the root path of the current assets directory if no parameter is specified, or null, if no assets directory exists in the solution root directory. If a parameter is specified gets the assets root path combined with the specified relative path or file. If only the root path is returned it always ends with a directory separator. If a parameter is specified the return value ends literally with value of the parameter. Gets the root or sub path of the current temp directory. The directory is created if it does not exist. If a valid path is returned it always ends with the current directory separator. Gets the viewer watch directory. Which is currently just a hard-coded directory on drive C or /mnt/c Creates a temporary file name with the pattern '{namePrefix}-{WIN|WSL|LNX|...}-{...uuid...}_temp.{extension}'. The name ends with '_temp.' to make it easy to delete it using the pattern '*_temp.{extension}'. No file is created by this function. The name contains 10 hex characters to make it unique. It is not tested whether the file exists, because we have no path here. Creates a temporary file and returns the full name. The name pattern is '/.../temp/.../{namePrefix}-{WIN|WSL|LNX|...}-{...uuid...}_temp.{extension}'. The namePrefix may contain a sub-path relative to the temp directory. The name ends with '_temp.' to make it easy to delete it using the pattern '*_temp.{extension}'. The file is created and immediately closed. That ensures the returned full file name can be used. Finds the latest temporary file in a directory. The pattern of the file is expected to be '{namePrefix}*_temp.{extension}'. The prefix of the file name to search for. The path to search in. The file extension of the file. If set to true subdirectories are included in the search. Ensures the assets folder exists in the solution root and an optional specified file or directory exists. If relativeFileOrDirectory is specified, it is considered to be a path to a directory if it ends with a directory separator. Otherwise, it is considered to ba a path to a file. A relative path to a file or directory. The minimum of the required assets version. Ensures the assets directory exists in the solution root and its version is at least the specified version. The minimum of the required assets version. Helper class for file paths. Builds a path by the following strategy. Get the current directory and find the specified folderName in it. Then replace the path right of folderName with the specified subPath. Name of a parent folder in the path to the current directory. The sub path that substitutes the part right of folderName in the current directory path. The new path. Contains information of a PDF document created for testing purposes. Gets or sets the title of the document. The title. Static helper functions for file IO. Creates a PDF test document. Reads a PDF document, unpacks all its streams, and save it under a new name. Reads a PDF file, formats the content and saves the new document. The path. Static helper functions for file IO. These function are intended for unit test und sample in a solution code only. Creates a temporary name of a PDF file with the pattern '{namePrefix}-{WIN|WSL|LNX|...}-{...uuid...}_temp.pdf'. The name ends with '_temp.pdf' to make it easy to delete it using the pattern '*_temp.pdf'. No file is created by this function. The name contains 10 hex characters to make it unique. It is not tested whether the file exists, because we have no path here. Creates a temporary file and returns the full name. The name pattern is '.../temp/.../{namePrefix}-{WIN|WSL|LNX|...}-{...uuid...}_temp.pdf'. The namePrefix may contain a sub-path relative to the temp directory. The name ends with '_temp.pdf' to make it easy to delete it using the pattern '*_temp.pdf'. The file is created and immediately closed. That ensures the returned full file name can be used. Finds the latest PDF temporary file in the specified folder, including sub-folders, or null, if no such file exists. The name. The path. if set to true [recursive]. Save the specified document and returns the path. Save the specified document and shows it in a PDF viewer application. Save the specified document and shows it in a PDF viewer application only if the current program is debugged. Shows the specified document in a PDF viewer application. The PDF filename. Shows the specified document in a PDF viewer application only if the current program is debugged. The PDF filename. Base class of code snippets for testing. Initializes a new instance of the class. Gets or sets the title of the snipped Gets or sets the path or name where to store the PDF file. Gets or sets the box option. Gets or sets a value indicating how this is drawn. If it is true, all describing graphics like title and boxes are omitted. Use this option to produce a clean PDF for debugging purposes. If it is false, all describing graphics like title and boxes are drawn. This is the regular case. Gets or sets a value indicating whether all graphics output is omitted. Gets or sets a value indicating whether all text output is omitted. The standard font name used in snippet. Gets the standard font in snippets. Gets the header font in snippets. Draws a text that states that a feature is not supported in a particular build. Draws the header. Draws the header. Draws the header for a PDF document. Draws the header for a PNG image. When implemented in a derived class renders the snippet in the specified XGraphic object. The XGraphics where to render the snippet. When implemented in a derived class renders the snippet in an XGraphic object. Renders a snippet as PDF document. Renders a snippet as PDF document. Renders a snippet as PNG image. Creates a PDF page for the specified document. The document. Translates origin of coordinate space to a box of size 220pp x 140pp. Begins rendering the content of a box. The XGraphics object. The box number. Begins rendering the content of a box. The XGraphics object. The box number. The box options. Ends rendering of the current box. The XGraphics object. Draws a tiled box. The XGraphics object. The left position of the box. The top position of the box. The width of the box. The height of the box. The size of the grid square. Gets the rectangle of a box. Draws the center point of a box. The XGraphics object. Draws the alignment grid. The XGraphics object. if set to true [highlight horizontal]. if set to true [highlight vertical]. Draws a dotted line showing the art box. The XGraphics object. Gets the points of a pentagram in a unit circle. Gets the points of a pentagram relative to a center and scaled by a size factor. The scaling factor of the pentagram. The center of the pentagram. Creates a HelloWorld document, optionally with custom message. Gets a XGraphics object for the last page of the specified document. The PDF document. Extensions for the XGraphics class. Draws the measurement box for a specified text and a font. The XGraphics object The text to be measured. The font to be used for measuring. The start point of the box. Required to compile init-only setters in .NET Standard and .NET Framework 4.71. Slices the specified array using the specified range. Represent a type can be used to index a collection either from the start or the end. Index is used by the C# compiler to support the new index syntax int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ; int lastElement = someArray[^1]; // lastElement = 5 Construct an Index using a value and indicating if the index is from the start or from the end. The index value. it has to be zero or positive number. Indicating if the index is from the start or from the end. If the Index constructed from the end, index value 1 means pointing at the last element and index value 0 means pointing at beyond last element. Create an Index pointing at first element. Create an Index pointing at beyond last element. Create an Index from the start at the position indicated by the value. The index value from the start. Create an Index from the end at the position indicated by the value. The index value from the end. Returns the index value. Indicates whether the index is from the start or the end. Calculate the offset from the start using the giving collection length. The length of the collection that the Index will be used with. length has to be a positive value For performance reason, we don’t validate the input length parameter and the returned offset value against negative values. we don’t validate either the returned offset is greater than the input length. It is expected Index will be used with collections which always have non-negative length/count. If the returned offset is negative and then used to index a collection will get out of range exception which will be same affect as the validation. Indicates whether the current Index object is equal to another object of the same type. An object to compare with this object Indicates whether the current Index object is equal to another Index object. An object to compare with this object Returns the hash code for this instance. Converts integer number to an Index. Converts the value of the current Index object to its equivalent string representation. Represent a range has start and end indexes. Range is used by the C# compiler to support the range syntax. int[] someArray = new int[5] { 1, 2, 3, 4, 5 }; int[] subArray1 = someArray[0..2]; // { 1, 2 } int[] subArray2 = someArray[1..^0]; // { 2, 3, 4, 5 } Represent the inclusive start index of the Range. Represent the exclusive end index of the Range. Construct a Range object using the start and end indexes. Represent the inclusive start index of the range. Represent the exclusive end index of the range. Indicates whether the current Range object is equal to another object of the same type. An object to compare with this object Indicates whether the current Range object is equal to another Range object. An object to compare with this object Returns the hash code for this instance. Converts the value of the current Range object to its equivalent string representation. Create a Range object starting from start index to the end of the collection. Create a Range object starting from first element in the collection to the end Index. Create a Range object starting from first element to the end. Calculate the start offset and length of range object using a collection length. The length of the collection that the range will be used with. length has to be a positive value. For performance reason, we don’t validate the input length parameter against negative values. It is expected Range will be used with collections which always have non-negative length/count. We validate the range is inside the length scope though. String.Contains implementation for .NET Framework and .NET Standard as an extension method.