Namespace PDFjet.NET
Classes
- A3
Used to specify PDF page with size A3. For more information about the page size classes - A3, A4, A5, B5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- A4
Used to specify PDF page with size A4. For more information about the page size classes - A3, A4, A5, B5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- A5
Used to specify PDF page with size A5. For more information about the page size classes - A3, A4, A5, B5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- Arc
Used to create arc objects.
- B5
Used to specify PDF page with size B5, the ISO 216 B5 of 176 by 250 mm. For more information about the page size classes - A3, A4, A5, B5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- BarChart
Bar chart renderer for PDF pages: one slot per category, the bars of the series grouped inside each slot. See Example_27, of horizontal and vertical bars.
- Barcode
Used to create one dimensional barcodes - EAN-13, UPC-A, Code 39 and Code 128.
The text of an ITF-14 barcode is the 13 digits of a GTIN without its check digit, which is added, as for UPC-A and EAN-13.
Please see Example_36.
- BaseAnnotation
The base class of the circle, square, polygon and text annotations.
- Bidi
Provides BIDI processing for Arabic, Persian, Urdu and Hebrew.
Please see Example_04.
- BigTable
A table for large amounts of data, read row by row from a delimited text file or from an IEnumerable. Each page is written as soon as it is full, so the memory stays flat however many rows there are. A PDF/UA document holds no more than that either: the table is tagged as a table, and the structure elements of a page are written with it. What is left is one cross-reference entry for each of them, which every object of a PDF has.
- Bookmark
Please see Example_41
- Border
Used to control the visibility of cell borders. See the Cell class for more information.
- CalendarMonth
Draws a calendar for one month: the names of the days in the header font, a line under them, and the dates in the body font, each in a blue circle, in up to six weeks. The week starts on Sunday unless SetFirstDayOfWeek sets another day.
- Cell
Used to create table cell objects. See the Table class for more information.
- Chart
XY chart renderer for PDF pages. See Example_26.
- CheckBox
Creates a CheckBox, which can be set checked or unchecked. By default the check box is unchecked. Portions provided by Shirley C. Christenson Shirley Christenson Consulting
- CircleAnnotation
A circle annotation.
- Color
Used to specify the pen and brush colors, as 0xRRGGBB values. The names are the CSS color keywords, in lower case as in CSS, and oldgloryred and oldgloryblue, the colors of the flag of the United States.
- CompositeTextLine
This class was designed and implemented by Jon T. Swanson, Ph.D.
Used to create composite text line objects.
- Container
A group of drawable elements that are moved, rotated and scaled together: shapes, text, images, annotations, stamps and nested containers.
What a container is good at: it takes anything that implements IDrawable, so a group can hold an Image, a Table, a chart, a barcode, a link or another annotation, and each element keeps everything it can do. Each element also tags itself in a PDF/UA document, so a TextLine in a container is a paragraph of its own and an Image is a figure with its alternate description. Laying a group out once and placing it, rotated or scaled, is what it is for; elements that have no rotation of their own get one this way.
What it costs: the elements are drawn into the page on every DrawOn, so a container on 100 pages writes its drawing 100 times over.
Use a Stamp instead for content that repeats on many pages -- a header, a footer, a logo, a watermark -- which is written once as a form XObject and placed with a few bytes. Of a 200 by 50 point box with two lines of text, a container writes 367 bytes into every page and a stamp 83, so the stamp is the smaller of the two from the fourth page on: over 100 pages it saves 12,855 bytes of a 104,530 byte file, and over 500 pages 66,052 of 275,553. On one page the stamp is the larger, since its XObject costs about 300 bytes of its own, and it draws only paths and text in an embedded font.
Please see Example_42 and Example_31.
- Content
Reads the contents of files and streams.
- CoreFont
The metrics of the 14 standard PDF fonts.
- DataMatrix
Used to create 2D Data Matrix barcodes: ECC 200 symbols as specified in ISO/IEC 16022. The text is encoded as UTF-8 in the smallest symbol that holds it. Please see Example_37.
- Destination
A destination on a page, made by Page.AddDestination.
- Dimension
Encapsulates the width and height of a component.
- DonutChart
A donut or pie chart: each slice is its value's share of the sum of the values, with a label next to it and its percentage inside it. A chart with an inner radius of 0 is a pie chart. See Example_28.
- Ellipse
An ellipse: an arc that sweeps 360 degrees.
- EmbeddedFile
Used to embed file objects. The file objects must added to the PDF before drawing on the first page.
- Encryption
Encrypts a PDF with 256-bit AES as defined in ISO 32000-2 (PDF 2.0). Pass the encryption object to PDF.SetEncryption. Please see Example_47.
- Executive
Used to specify PDF page with size Executive. For more information about the page size classes - A3, A4, A5, B5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- Field
Please see Example_44
- FileAttachment
Used to attach file objects.
- Font
Used to create font objects. The font objects must be added to the PDF before they can be used to draw text.
- Form
Please see Example_44
- GS1
Reads GS1 data as people write it, each Application Identifier in parentheses and its data after it, for the barcodes that carry it: GS1 DataMatrix and GS1-128, and makes its GS1 Digital Link.
- GraphicsState
Holds the alpha values of stroking and non-stroking operations.
- IBMPlexMath
The IBM Plex Math fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexMono
The IBM Plex Mono fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexSans
The IBM Plex Sans fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexSansArabic
The IBM Plex Sans Arabic fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexSansHebrew
The IBM Plex Sans Hebrew fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexSansJP
The IBM Plex Sans JP fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexSansKR
The IBM Plex Sans KR fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexSansSC
The IBM Plex Sans SC fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexSansTC
The IBM Plex Sans TC fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- IBMPlexSansThai
The IBM Plex Sans Thai fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- Image
Used to create image objects and draw them on a page. The image type can be one of the following: ImageType.JPG, ImageType.PNG or ImageType.BMP
Please see Example_32 and Example_14.
- ImageSize
The size an image is drawn at, and its pixels, read from the header of its file alone, without its image data in memory: the size of a page laid out before its images are drawn, and an image refused early, for its size or for a header that Image refuses, before a byte of its image data is decoded.
The size is the one Image gives the image: its pixels, or the physical size the file asks for, the pHYs chunk of a PNG, the JFIF density of a JPEG or the pixels per metre of a BMP; a JPEG turned a quarter of the way by its Exif orientation is its height by its width. What only the image data shows, a JPEG cut short or the rows of a PNG, is Image's to refuse.
- JISB5
Used to specify PDF page with size JIS B5, the Japanese B5 of 182 by 257 mm. For more information about the page size classes - A3, A4, A5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- JetBrainsMono
The JetBrains Mono fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- Legal
Used to specify PDF page with size Legal. For more information about the page size classes - A3, A4, A5, B5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- Letter
Used to specify PDF page with size Letter. For more information about the page size classes - A3, A4, A5, B5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- Line
Used to create line objects.
Please see Example_08 and Example_35.
- Mark
Used to specify the check mark in CheckBox.
- Markdown
Draws a Markdown text on as many pages as it needs: headings of # and of underlines, paragraphs with the inline markup of Markup, bullet and numbered lists that nest, block quotes, fenced and indented code, thematic breaks, the tables and the task lists of GitHub's Markdown, - [ ] and
- [x], drawn as boxes, and images alone in their paragraph. In a PDF/UA document the headings are H1 to H6, with no level skipped, the lists are lists, the boxes of the tasks their labels, read as ☐ and ☑, the quotes BlockQuotes, the code Code, the tables tables and the images figures, with their text as the alternate description.
It is not all of Markdown: HTML is drawn as the text it is, a line break is a space, links in a table cell are its text, and an image is drawn only when it is alone in its paragraph, from the directory that SetImageDirectory names; with none, its text is drawn instead, so that a text from anyone reads no file. Please see Example_19.
- Markup
Makes paragraphs of text with the inline markup of Markdown: bold, italic, bold italic,
codeand links, in the fonts given for each, and as GitHub's Markdown has them, bold and italic,strikethroughof two ~, one being text here, as in ~5, and links that are their address, <https://pdfjet.com> or https://pdfjet.com alone. An _ emphasizes only at the edge of a word, so that snake_case is text; an address alone ends before the punctuation at its end, as the period of a sentence, and before a ) that closes no ( of its own. A backslash before a punctuation character, as in *, makes it plain text, and so is a mark that has no match, such as the * of 2 * 3. Emphasis can be inside a link, and neither inside code. A word keeps its punctuation next to it in another style, as in bold, with no space between them: the paragraph joins its text lines with Paragraph.AddJoined.Headings, lists, block quotes and the rest of Markdown's blocks are not read: a line break is a space, and Paragraphs splits a text into paragraphs at its empty lines. The markup is read in time linear in the length of the text, so it can come from anyone. Please see Example_18.
- NotoSans
The Noto Sans fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- OptionalContentGroup
Container for drawable objects that can be drawn on a page as part of Optional Content Group. Please see the PDF specification and Example_47 for more details.
Used to create PDF objects that represent PDF documents.
- PDF417
Used to create PDF417 2D barcodes.
The bars are drawn from the location set with SetLocation. ISO/IEC 15438 asks for a quiet zone of at least two modules (twice the module width) on all four sides of the symbol, so leave that much space around it; scanners reject symbols with less.
Please see Example_38.
- PDFobj
An object of a PDF that was read with PDF.Read, which holds the tokens of its dictionary and its stream. See Example_34, Example_48 and Example_50.
- Page
Used to create PDF page objects.
Please note:
The coordinate (0.0f, 0.0f) is the top left corner of the page. The size of the pages are represented in points. 1 point is 1/72 inches.
- PageSize
The width and height of a page in points; 1 point is 1/72 inch. A page size cannot be changed once it is created, so the PORTRAIT and LANDSCAPE constants of A3, A4, A5, B5, JISB5, Executive, Legal, Letter and Tabloid are the same for every page made with them. Use the constructor for any other page size.
- Paragraph
Used to create paragraph objects. See the TextColumn class for more information.
- Passwords
The user and owner passwords of an encrypted PDF. A password is used as typed, in UTF-8, and at most 127 bytes of it are used. Chrome does not cut a longer password to its first 127 bytes, as other viewers do, and opens the PDF only when just those are typed, so a password of 127 bytes or fewer is the one to give. Please see Example_47.
- Path
Used to create path objects. The path objects may consist of lines, splines or both.
Please see Example_34 and Example_40.
- Permissions
The permissions of an encrypted PDF: the UserAccess flags a reader grants the user, written to the /P entry of the encryption dictionary.
- Point
A point with a marker: a shape drawn around its (x, y) coordinates, which are the center of the marker. A point is drawn on a page on its own, as the marker of a table cell, or in a chart Series, and a list of points is a path for Page.DrawPath.
Please see Example_05.
- PolygonAnnotation
A polygon annotation.
- QRCode
Used to create 2D QR Code barcodes. Please see Example_34.
- RadioButton
Creates a RadioButton, which can be set selected or unselected.
- Rect
A rectangle that can be drawn on a page.
- SVGImage
Used to embed SVG images in the PDF document.
- Series
One series of a Chart: its points, the line that connects them when it is drawn, and the marker of the points added by their coordinates. A series is created with Chart.AddSeries; its name is listed in the legend of the chart. See Example_26.
- Slice
A slice of a DonutChart: a value, a color and a label. The slice's share of the sum of the values of the chart sets its angle.
- SourceSerif4
The Source Serif 4 fonts. Each constant is the path of a font file in the TrueType (.ttf) format, embedded as a subset of the glyphs a document draws; pass it to the Font constructor that takes a font path.
- SquareAnnotation
A square annotation.
- Stamp
Content that is drawn once with the path and text methods of this class, written to the document as a PDF form XObject by Complete, and placed on pages with DrawOn, at a location, a rotation and a scale, as a Container is.
What a stamp is good at: the content is in the file once, and each placement is the q, the transform and the Do that name it -- 83 bytes for a 200 by 50 point box with two lines of text, against the 367 a Container writes into every page for the same drawing. From the fourth page on the stamp is the smaller of the two: over 100 pages it saves 12,855 bytes of a 104,530 byte file, and over 500 pages 66,052 of 275,553. The whole stamp is one structure element in a PDF/UA document, with the alternate description, the language and the actual text it is given, which is what a logo or a watermark wants.
What it costs: a stamp draws with the methods of this class -- MoveTo, LineTo, CurveTo, DrawRect, FillRect and DrawText -- and holds no drawable of its own, so it has no images, no annotations, no tables and no barcodes. Its text needs a font that is embedded in the document: a core font and a CJK font are refused, since a stamp has no map from their characters to their glyphs. It has to be completed before it is drawn, and completed once. On fewer than four pages it is the larger of the two, since its XObject costs about 300 bytes of its own.
Use a Container instead to group drawable elements -- Rect, TextLine, Image, Table, a chart, a barcode, an annotation -- that are moved, rotated and scaled together, and to lay a group out once for one page. A container can hold a stamp, so a header written once can be placed inside a group that is rotated with the rest of it.
Please see Example_31.
- Table
Used to create table objects and draw them on a page.
Please see Example_20.
- Tabloid
Used to specify PDF page with size Tabloid. For more information about the page size classes - A3, A4, A5, B5, JISB5, Executive, Letter, Legal and Tabloid - see the Page class.
- TextAnnotation
A text note annotation.
- TextBlock
A block of text that wraps at its width, with an optional border, background and padding. Without a height the block is as tall as its text; with one the text that does not fit is cut, and the lines are aligned to the top, the center or the bottom of the block.
Use a TextBlock for one run of text in one font: a label, a note, a table cell or a paragraph in a box. It breaks words that do not fit on a line, wraps right to left and Thai text, highlights keywords and can be cut to a height. Use a TextColumn for paragraphs of TextLine objects that differ in font or color, for justified text or for a rotated column, and a TextFrame for text that flows from one frame to the next. See Example_01, 10 and 11.
- TextColumn
A column of paragraphs, each a list of TextLine objects that can differ in font, size and color, aligned left, right, center or justified, with a line spacing, a paragraph spacing and an optional line between the paragraphs. It draws all of its paragraphs where it is placed, top down; to rotate a column, add it to a Container and rotate that.
Use a TextColumn for an article or a page of mixed text: bold or colored words in a paragraph, justified paragraphs, CJK paragraphs. Use a TextBlock for one run of text in one font, and a TextFrame when the text must continue from one frame to the next, across columns or pages. Please see Example_12, Example_22, Example_13 and Example_16.
- TextFrame
Paragraphs of text lines, wrapped at the width of the frame, with an optional border. A frame with a height draws as much of the text as fits and keeps the rest for the next frame, so text flows from frame to frame. A frame without a height draws all of the text. Drawing consumes the text: a second DrawOn draws what is left, so build a new frame to draw the same text again.
Use a TextFrame for text that continues from one frame to the next: the columns of an article, or the pages of a long text. Use a TextColumn to draw paragraphs in one place, with justified text or a rotation, and a TextBlock for one run of text in one font. Please see Example_14 and Example_15.
- TextLine
Used to create text line objects.
- TextParameters
The font, font size, location and text for Stamp.DrawText.
- Title
Please see Example_41
- XMLException
The document is not the XML that XMLParser reads; the message says where.
- XMLNode
An element of an XML document that XMLParser read: its name, its attributes, its text and the elements in it.
The elements are found by a path of the names without their prefix, such as "SupplyChainTradeTransaction/ApplicableHeaderTradeAgreement/BuyerReference", because the prefixes of an invoice are its own: what one writes as ram:ID another writes as a:ID. A * matches an element of any name.
- XMLParser
Reads XML into elements: their names, their namespaces, their attributes in the order they are written, and their text. It is the one parser of the four ports and of PDFjet Pro, which reads its electronic invoices with it, and SVGImage its images, so that they read a document alike. It reads what such a document is made of and no more, and what it leaves out is what makes XML dangerous to read:
- A document type declaration, a DOCTYPE, is refused by Parse, and skipped by ParseSkippingDoctype, as the files of the drawing programs have one; either way its entities are not read: an entity that names a file or a URL reads what it should not, and the ones that stand for each other grow a short document into gigabytes.
- The entities are the five of XML, <, >, &, " and ', and the numeric ones, such as   and  . Any other is an error, the ones a DOCTYPE declares among them.
- The elements nest MAX_DEPTH levels at most, and the reading does not recurse, so no document overflows the stack.
- The document is 20 MB at most, and has MAX_ELEMENTS elements at most.
- The namespaces are looked up in the elements that declare them, from the innermost out, and not copied into each element, so that no number of declarations makes the reading slower than the length of the document times its depth.
- Nothing is fetched, and no schema is read.
What is read is XML, and what is not is an error: a character that XML does not have, such as U+0000 or U+FFFF, written or as an entity; an attribute written twice, or not after a space; and a prefix that no element declares. A line break is a line feed, as XML reads a carriage return and the line feed after it, and the tabs and line breaks in the value of an attribute are spaces, as XML normalizes them.
The document is UTF-8, or UTF-16 when it starts with a byte order mark; another encoding in the declaration is an error. The bytes that are not valid UTF-8 are the character U+FFFD, one for each part of a sequence that is as much of a character as it is valid for, which is what the Unicode Standard recommends and the decoder of .NET does.
Interfaces
- IBaselineDrawable
A drawable whose location is the baseline of its text, not the top left corner of a box: a line of text, such as TextLine and CompositeTextLine.
A Cell draws such a drawable where it draws its own text, on the baseline that its vertical alignment asks for, and makes room for the ascent and the descent below. A drawable that is not one of these is placed by its top left corner, at the padding of the cell.
- IDrawable
Interface that is required for components that can be drawn on a PDF page as part of Optional Content Group.
Enums
- Alignment
Used to specify the horizontal and vertical alignment, for example of the text in a Cell, TextBlock, Paragraph or TextColumn.
- CJKFont
Used to select Chinese, Japanese or Korean fonts.
- CapStyle
Used to specify the cap style of a line. See the Line class for more information.
- Compliance
Used to set PDF/A compliance. See the constructors in the PDF class.
- Direction
The direction a Barcode is drawn in.
- ErrorCorrectionLevel
Used to specify the error correction level for QR Codes. The values are the bits of the level in the format information.
- JoinStyle
Used to specify the join style when joining two lines. See the Page and Line classes for more details.
- PageLayout
Used to specify the PDF page layout.
- PageMode
Used to specify the PDF page mode.
- PathOperator
The operators that paint a path, for example in Page.DrawPath.
- Relationship
Says how a file attached to the document relates to what the document shows. A document of PDF/A-3 names one for each file it carries, and a reader shows it to the person who opens the document.
- ScriptPosition
Used to specify whether text is drawn as normal text, as a subscript or as a superscript.
- Shape
The shape of the marker drawn at a Point.
- StructElem
The structure element types of a tagged (PDF/UA) document, as in ISO 32000-1 section 14.8.4. A TextLine is a P by default; see TextLine.SetStructureType.
- UserAccess
Represents the user access permissions for an encrypted PDF document as defined in ISO 32000-2 (PDF 2.0) Table 22. Permissions are stored as flags in a 32-bit integer, whose bit positions are numbered from 1, the low-order bit.