wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions
HeaderFooterDocument Class Reference

Document with header and footer. More...

Inheritance diagram for HeaderFooterDocument:
[legend]
Collaboration diagram for HeaderFooterDocument:
[legend]

Public Member Functions

virtual void Header () wxOVERRIDE
 This method is used to render the page header.
 
virtual void Footer () wxOVERRIDE
 This method is used to render the page footer.
 
virtual bool SetProtection (int permissions, const wxString &userPassword=wxEmptyString, const wxString &ownerPassword=wxEmptyString, wxPdfEncryptionMethod encryptionMethod=wxPDF_ENCRYPTION_AESV3R6, int keyLength=0)
 Set permissions as well as user and owner passwords.
 
virtual void SetImageScale (double scale)
 Set the image scale.
 
virtual double GetImageScale ()
 Returns the image scale.
 
virtual int GetPageOrientation ()
 Returns the page orientation.
 
virtual int GetDefaultPageOrientation ()
 Returns the default page orientation.
 
virtual double GetPageWidth ()
 Returns the page width in units.
 
virtual double GetPageHeight ()
 Returns the page height in units.
 
virtual double GetBreakMargin ()
 Returns the page break margin.
 
virtual double GetScaleFactor ()
 Returns the scale factor (number of points in user unit).
 
virtual void SetMargins (double left, double top, double right=-1)
 Defines the left, top and right margins.
 
virtual void SetLeftMargin (double margin)
 Defines the left margin.
 
virtual double GetLeftMargin ()
 Returns the left margin.
 
virtual void SetTopMargin (double margin)
 Defines the top margin.
 
virtual double GetTopMargin ()
 Returns the top margin.
 
virtual void SetRightMargin (double margin)
 Defines the right margin.
 
virtual double GetRightMargin ()
 Returns the right margin.
 
virtual void SetCellMargin (double margin)
 Defines the cell margin.
 
virtual double GetCellMargin ()
 Returns the cell margin.
 
virtual void SetLineHeight (double height)
 Sets the height of a text line.
 
virtual double GetLineHeight ()
 Returns the height of a text line.
 
virtual void SetAutoPageBreak (bool autoPageBreak, double margin=0)
 Enables or disables the automatic page breaking mode.
 
virtual void SetDisplayMode (wxPdfZoom zoom, wxPdfLayout layout=wxPDF_LAYOUT_CONTINUOUS, double zoomFactor=100.)
 Defines the way the document is to be displayed by the viewer.
 
virtual void SetPaperHandling (wxPdfPaperHandling paperHandling)
 Defines the paper handling when printing (simplex / duplex).
 
virtual void SetKerning (bool kerning)
 Enable or disable kerning.
 
virtual void SetCompression (bool compress)
 Activates or deactivates page compression.
 
virtual void SetViewerPreferences (int preferences=0)
 Defines the viewer preferences.
 
virtual void SetTitle (const wxString &title)
 Defines the title of the document.
 
virtual void SetSubject (const wxString &subject)
 Defines the subject of the document.
 
virtual void SetAuthor (const wxString &author)
 Defines the author of the document.
 
virtual void SetKeywords (const wxString &keywords)
 Associates keywords with the document,.
 
virtual void SetCreator (const wxString &creator)
 Defines the creator of the document.
 
virtual void SetCreationDate (const wxDateTime &creationDate)
 Defines the creation timestamp of the document.
 
virtual void AliasNbPages (const wxString &alias=wxString(wxS("{nb}")))
 Defines an alias for the total number of pages.
 
virtual void Open ()
 This method begins the generation of the PDF document.
 
virtual void Close ()
 Terminates the PDF document.
 
virtual void AddPage (int orientation=-1, bool useDefaultPageSize=true)
 Adds a new page to the document.
 
virtual void AddPage (int orientation, wxPaperSize format)
 Adds a new page with the specified orientation and format.
 
virtual void AddPage (int orientation, double pageWidth, double pageHeight)
 Adds a new page with the specified orientation and dimensions.
 
virtual bool IsInFooter ()
 Returns whether footer output is in progress.
 
virtual int PageNo ()
 Returns the current page number.
 
virtual void AddSpotColour (const wxString &name, double cyan, double magenta, double yellow, double black)
 Add spot colour.
 
virtual bool AddPattern (const wxString &patternName, const wxImage &image, double width, double height)
 Add an image pattern.
 
virtual bool AddPattern (const wxString &patternName, int templateId, double width, double height)
 Add a template based pattern.
 
virtual bool AddPattern (const wxString &patternName, wxPdfPatternStyle patternStyle, double width, double height, const wxColour &drawColour, const wxColour &fillColour=wxColour())
 Add a hatched pattern.
 
virtual bool AddLinearGradientPattern (const wxString &patternName, double x1, double y1, double x2, double y2, const wxColour &c1, const wxColour &c2)
 Add a linear gradient pattern.
 
virtual bool AddLinearGradientPattern (const wxString &patternName, double x1, double y1, double x2, double y2, const wxColour &c1, const wxColour &c2, const wxGraphicsMatrix &matrix)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool AddLinearGradientPattern (const wxString &patternName, double x1, double y1, double x2, double y2, const wxColour &c1, const wxColour &c2, const wxAffineMatrix2D &matrix)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool AddLinearGradientPattern (const wxString &patternName, double x1, double y1, double x2, double y2, const wxGraphicsGradientStops &stops)
 Add a linear gradient pattern.
 
virtual bool AddLinearGradientPattern (const wxString &patternName, double x1, double y1, double x2, double y2, const wxGraphicsGradientStops &stops, const wxGraphicsMatrix &matrix)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool AddLinearGradientPattern (const wxString &patternName, double x1, double y1, double x2, double y2, const wxGraphicsGradientStops &stops, const wxAffineMatrix2D &matrix)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool AddRadialGradientPattern (const wxString &patternName, double startX, double startY, double startRadius, double endX, double endY, double endRadius, const wxColour &oColor, const wxColour &cColor)
 Add a radial gradient pattern.
 
virtual bool AddRadialGradientPattern (const wxString &patternName, double startX, double startY, double startRadius, double endX, double endY, double endRadius, const wxColour &oColor, const wxColour &cColor, const wxGraphicsMatrix &matrix)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool AddRadialGradientPattern (const wxString &patternName, double startX, double startY, double startRadius, double endX, double endY, double endRadius, const wxColour &oColor, const wxColour &cColor, const wxAffineMatrix2D &matrix)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool AddRadialGradientPattern (const wxString &patternName, double startX, double startY, double startRadius, double endX, double endY, double endRadius, const wxGraphicsGradientStops &stops)
 Add a radial gradient pattern.
 
virtual bool AddRadialGradientPattern (const wxString &patternName, double startX, double startY, double startRadius, double endX, double endY, double endRadius, const wxGraphicsGradientStops &stops, const wxGraphicsMatrix &matrix)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool AddRadialGradientPattern (const wxString &patternName, double startX, double startY, double startRadius, double endX, double endY, double endRadius, const wxGraphicsGradientStops &stops, const wxAffineMatrix2D &matrix)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual void SetDrawColour (const unsigned char grayscale)
 Defines the colour used for all drawing operations.
 
virtual void SetDrawColour (const wxColour &colour)
 Defines the colour used for all drawing operations.
 
virtual void SetDrawColour (const wxPdfColour &colour)
 Defines the colour used for all drawing operations.
 
virtual void SetDrawColour (const unsigned char red, const unsigned char green, const unsigned char blue)
 Defines the colour used for all drawing operations.
 
virtual void SetDrawColour (double cyan, double magenta, double yellow, double black)
 Defines the colour used for all drawing operations.
 
virtual void SetDrawColour (const wxString &name, double tint=100)
 Defines the spot colour used for all drawing operations.
 
virtual void SetDrawPattern (const wxString &name)
 Defines the pattern used for all drawing operations.
 
virtual const wxPdfColour GetDrawColour ()
 Gets the colour used for all drawing operations.
 
virtual void SetFillColour (const unsigned char grayscale)
 Defines the colour used for all filling operations.
 
virtual void SetFillColour (const wxColour &colour)
 Defines the colour used for all filling operations.
 
virtual void SetFillColour (const wxPdfColour &colour)
 Defines the colour used for all filling operations.
 
virtual void SetFillColour (const unsigned char red, const unsigned char green, const unsigned char blue)
 Defines the colour used for all filling operations.
 
virtual void SetFillColour (double cyan, double magenta, double yellow, double black)
 Defines the colour used for all filling operations.
 
virtual void SetFillColour (const wxString &name, double tint=100)
 Defines the spot colour used for all filling operations.
 
virtual void SetFillPattern (const wxString &name)
 Defines the pattern used for all filling operations.
 
virtual const wxPdfColour GetPatternColour (const wxString &patternName)
 Gets the named pattern as a colour.
 
virtual const wxPdfColour GetFillColour ()
 Gets the colour used for all filling operations.
 
virtual void SetTextColour (const unsigned char grayscale)
 Defines the colour used for text.
 
virtual void SetTextColour (const wxColour &colour)
 Defines the colour used for text.
 
virtual void SetTextColour (const wxPdfColour &colour)
 Defines the colour used for text.
 
virtual void SetTextColour (const unsigned char red, const unsigned char green, const unsigned char blue)
 Defines the colour used for text.
 
virtual void SetTextColour (double cyan, double magenta, double yellow, double black)
 Defines the colour used for text.
 
virtual void SetTextColour (const wxString &name, double tint=100)
 Defines the spot colour used for text.
 
virtual void SetTextPattern (const wxString &name)
 Defines the pattern used for text output.
 
virtual const wxPdfColour GetTextColour ()
 Gets the colour used for text output.
 
virtual void SetTextRenderMode (wxPdfTextRenderMode mode=wxPDF_TEXT_RENDER_FILL)
 Sets the text render mode.
 
virtual wxPdfTextRenderMode GetTextRenderMode () const
 Returns the text render mode.
 
virtual double GetStringWidth (const wxString &s, double charSpacing=0)
 Returns the length of a string in user unit.
 
virtual void SetLineWidth (double width)
 Defines the line width.
 
virtual double GetLineWidth ()
 Gets the current line width.
 
virtual void SetLineStyle (const wxPdfLineStyle &linestyle)
 Sets line style.
 
virtual const wxPdfLineStyle & GetLineStyle ()
 Get current line style.
 
virtual void SetFillingRule (int rule=wxWINDING_RULE)
 Set the filling rule.
 
virtual int GetFillingRule ()
 Get the current filling rule.
 
virtual void Line (double x1, double y1, double x2, double y2)
 Draws a line between two points.
 
virtual void Arrow (double x1, double y1, double x2, double y2, double linewidth, double height, double width)
 Draws an arrow line between two points.
 
virtual void Rect (double x, double y, double w, double h, int style=wxPDF_STYLE_DRAW)
 Outputs a rectangle.
 
virtual void RoundedRect (double x, double y, double w, double h, double r, int roundCorner=wxPDF_CORNER_ALL, int style=wxPDF_STYLE_DRAW)
 Draws a rounded rectangle.
 
virtual void Curve (double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, int style=wxPDF_STYLE_DRAW)
 Draws a Bézier curve.
 
virtual void Ellipse (double x0, double y0, double rx, double ry=0, double angle=0, double astart=0, double afinish=360, int style=wxPDF_STYLE_DRAW, int nSeg=8, bool doSector=false)
 Draws an ellipse.
 
virtual void Circle (double x0, double y0, double r, double astart=0, double afinish=360, int style=wxPDF_STYLE_DRAW, int nSeg=8)
 Draws a circle.
 
virtual void Sector (double x0, double y0, double r, double astart, double afinish, int style=wxPDF_STYLE_FILLDRAW, bool clockwise=true, double origin=90.)
 Draws a sector.
 
virtual void Polygon (const wxPdfArrayDouble &x, const wxPdfArrayDouble &y, int style=wxPDF_STYLE_DRAW)
 Draws a polygon.
 
virtual void RegularPolygon (double x0, double y0, double r, int ns, double angle=0, bool circle=false, int style=wxPDF_STYLE_DRAW, int circleStyle=wxPDF_STYLE_DRAW, const wxPdfLineStyle &circleLineStyle=wxPdfLineStyle(), const wxPdfColour &circleFillColour=wxPdfColour())
 Draws a regular polygon.
 
virtual void StarPolygon (double x0, double y0, double r, int nv, int ng, double angle=0, bool circle=false, int style=wxPDF_STYLE_DRAW, int circleStyle=wxPDF_STYLE_DRAW, const wxPdfLineStyle &circleLineStyle=wxPdfLineStyle(), const wxPdfColour &circleFillColour=wxPdfColour())
 Draws a star polygon.
 
virtual void BezierSpline (const wxPdfArrayDouble &x, const wxPdfArrayDouble &y, int style)
 Draws a Bézier spline through a list of points.
 
virtual void ClosedBezierSpline (const wxPdfArrayDouble &x, const wxPdfArrayDouble &y, int style)
 Draws a closed Bézier spline through a list of points.
 
virtual void Shape (const wxPdfShape &shape, int style=wxPDF_STYLE_DRAW)
 Draws a shape.
 
virtual void Rotate (double angle)
 Performs a rotation around the current position.
 
virtual void Rotate (double angle, double x, double y)
 Performs a rotation around a given center.
 
virtual void SetFontSubsetting (bool fontSubsetting=true)
 Sets the font embedding mode.
 
virtual bool GetFontSubsetting () const
 Returns the font embedding mode.
 
virtual void SetEmbedAllFonts (bool embedAllFonts=true)
 Sets whether all fonts used in the document have to be embedded.
 
virtual bool GetEmbedAllFonts () const
 Returns whether all fonts used in the document have to be embedded.
 
virtual bool AddFont (const wxString &family, const wxString &style=wxEmptyString, const wxString &file=wxEmptyString)
 Imports a TrueType, TrueTypeUnicode or Type1 font and makes it available.
 
virtual bool AddFontCJK (const wxString &family)
 Imports a CJK (Chinese, Japanese or Korean) font and makes it available.
 
virtual bool SetFont (const wxString &family, const wxString &style=wxEmptyString, double size=0)
 Sets the font used to print character strings.
 
virtual bool SetFont (const wxString &family, int style, double size=0)
 Sets the font used to print character strings.
 
virtual bool SetFont (const wxPdfFont &font, int style=wxPDF_FONTSTYLE_REGULAR, double size=0)
 Sets the font used to print character strings based on a wxFont object.
 
virtual bool SetFont (const wxFont &font)
 Sets the font used to print character strings based on a wxFont object.
 
virtual void SetFontSize (double size)
 Defines the size of the current font.
 
virtual bool AddFallbackFont (const wxPdfFont &font)
 Adds a font to the list of fallback fonts.
 
virtual bool AddFallbackFont (const wxString &family)
 Adds a font family to the list of fallback fonts.
 
virtual void ClearFallbackFonts ()
 Removes all fonts from the list of fallback fonts.
 
virtual void SetSystemFontFallback (bool enable)
 Enables or disables the search for fallback fonts among the installed system fonts.
 
virtual bool GetSystemFontFallback () const
 Checks whether fallback fonts are searched among the installed system fonts.
 
virtual wxPdfFont GetCurrentFont () const
 Returns the current font.
 
virtual const wxPdfFontDescription & GetFontDescription () const
 Returns the current font description instance.
 
virtual const wxString GetFontFamily ()
 Gets the font family of the current font.
 
virtual const wxString GetFontStyle () const
 Gets the style of the current font.
 
virtual int GetFontStyles () const
 Gets the style of the current font.
 
virtual double GetFontSize () const
 Gets the size of the current font.
 
virtual int AddLink ()
 Creates a new internal link and returns its identifier.
 
virtual bool SetLink (int link, double y=0., int page=-1)
 Defines the page and position a link points to.
 
virtual void Link (double x, double y, double w, double h, const wxPdfLink &link)
 Puts a link on a rectangular area of the page.
 
virtual void Bookmark (const wxString &txt, int level=0, double y=0)
 Adds a bookmark to the document outline.
 
virtual void Text (double x, double y, const wxString &txt)
 Prints a character string.
 
virtual void RotatedText (double x, double y, const wxString &txt, double angle)
 Prints a rotated text string.
 
virtual void RotatedText (double textX, double textY, double rotationX, double rotationY, const wxString &txt, double angle)
 Prints a rotated text string with explicit rotation center.
 
virtual bool AcceptPageBreak ()
 Whenever a page break condition is met,.
 
virtual void Cell (double w, double h=0., const wxString &txt=wxEmptyString, int border=wxPDF_BORDER_NONE, int ln=0, int align=wxPDF_ALIGN_LEFT, int fill=0, const wxPdfLink &link=wxPdfLink(-1))
 Prints a cell (rectangular area) with optional borders, background colour and character string.
 
virtual int MultiCell (double w, double h, const wxString &txt, int border=0, int align=wxPDF_ALIGN_JUSTIFY, int fill=0, int maxline=0)
 This method allows printing text with line breaks.
 
virtual int LineCount (double w, const wxString &txt)
 This method counts the number of lines a text would occupy in respect to a given maximal width.
 
virtual int TextBox (double w, double h, const wxString &txt, int halign=wxPDF_ALIGN_JUSTIFY, int valign=wxPDF_ALIGN_TOP, int border=0, int fill=0)
 This method counts the number of lines a text will occupy in respect to a given maximal width.
 
virtual void Write (double h, const wxString &txt, const wxPdfLink &link=wxPdfLink(-1))
 This method prints text from the current position.
 
virtual void WriteCell (double h, const wxString &txt, int border=wxPDF_BORDER_NONE, int fill=0, const wxPdfLink &link=wxPdfLink(-1))
 This method prints text with cell attributes from the current position.
 
virtual bool WriteGlyphArray (wxPdfArrayDouble &x, wxPdfArrayDouble &y, wxPdfArrayUint32 &glyphs)
 Prints an array of glyphs identified by glyph numbers from the current position.
 
virtual bool Image (const wxString &file, double x, double y, double w=0, double h=0, const wxString &mimeType=wxEmptyString, const wxPdfLink &link=wxPdfLink(-1), int maskImage=0)
 Puts an image in the page.
 
virtual bool Image (const wxString &name, const wxImage &image, double x, double y, double w=0, double h=0, const wxPdfLink &link=wxPdfLink(-1), int maskImage=0, bool jpegFormat=false, int jpegQuality=75)
 Puts an image in the page The image is given by a wxImage-Object.
 
virtual bool Image (const wxString &name, wxInputStream &stream, const wxString &mimeType, double x, double y, double w=0, double h=0, const wxPdfLink &link=wxPdfLink(-1), int maskImage=0)
 Puts an image in the page The image is given by a wxInputStream-Object containing the raw image data.
 
virtual int ImageMask (const wxString &file, const wxString &mimeType=wxEmptyString)
 Prepares an image for use as an image mask The image is given as the name of the file containing the image.
 
virtual int ImageMask (const wxString &name, const wxImage &image)
 Prepares an image for use as an image mask The image is given by an wxImage-Object.
 
virtual int ImageMask (const wxString &name, wxInputStream &stream, const wxString &mimeType)
 Prepares an image for use as an image mask The image is given by an wxInputStream-Object containing the raw image data.
 
virtual void RotatedImage (const wxString &file, double x, double y, double w, double h, double angle, const wxString &type=wxEmptyString, const wxPdfLink &link=wxPdfLink(-1), int maskImage=0)
 Puts a rotated image in the page.
 
virtual double GetLastImageBottomRightX ()
 Get x coordinate of bottom right corner of last inserted image.
 
virtual double GetLastImageBottomRightY ()
 Get y coordinate of bottom right corner of last inserted image.
 
virtual void Ln (double h=-1)
 Performs a line break.
 
virtual double GetX ()
 Returns the abscissa of the current position.
 
virtual void SetX (double x)
 Defines the abscissa of the current position.
 
virtual double GetY ()
 Returns the ordinate of the current position.
 
virtual void SetY (double y)
 Moves the current abscissa back to the left margin and sets the ordinate.
 
virtual void SetXY (double x, double y)
 Defines the abscissa and ordinate of the current position.
 
virtual bool SaveAsFile (const wxString &name=wxEmptyString)
 Saves the document to a file on disk.
 
virtual const wxMemoryOutputStream & CloseAndGetBuffer ()
 Closes the document and returns the memory buffer containing the document.
 
virtual void ClippingText (double x, double y, const wxString &txt, bool outline=false)
 Define text as clipping area.
 
virtual void ClippingRect (double x, double y, double w, double h, bool outline=false)
 Define rectangle as clipping area.
 
virtual void ClippingEllipse (double x, double y, double rx, double ry=0, bool outline=false)
 Define ellipse as clipping area.
 
virtual void ClippingPolygon (const wxPdfArrayDouble &x, const wxPdfArrayDouble &y, bool outline=false)
 Define polygon as clipping area.
 
virtual void ClippingPath ()
 Start defining a clipping path.
 
virtual void ClippingPath (const wxPdfShape &shape, int style=wxPDF_STYLE_NOOP)
 Define clipping area using a shape.
 
virtual void MoveTo (double x, double y)
 Begin a new subpath.
 
virtual void LineTo (double x, double y)
 Append a straight line segment to the current (sub)path.
 
virtual void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
 Append a cubic Bézier curve to the current (sub)path.
 
virtual void EndPath (int style=wxPDF_STYLE_DRAW)
 End a graphics path.
 
virtual void ClosePath (int style=wxPDF_STYLE_NOOP)
 Close the clipping path.
 
virtual void UnsetClipping ()
 Remove clipping area.
 
virtual void ClippedCell (double w, double h=0., const wxString &txt=wxEmptyString, int border=wxPDF_BORDER_NONE, int ln=0, int align=wxPDF_ALIGN_LEFT, int fill=0, const wxPdfLink &link=wxPdfLink(-1))
 Prints a cell clipped to a rectangular area.
 
virtual void StartTransform ()
 Enters a transformation environment.
 
virtual bool ScaleX (double sx)
 Performs scaling in X direction only with the current position as the scaling center.
 
virtual bool ScaleX (double sx, double x, double y)
 Performs scaling in X direction only.
 
virtual bool ScaleY (double sy)
 Performs scaling in Y direction only with the current position as the scaling center.
 
virtual bool ScaleY (double sy, double x, double y)
 Performs scaling in Y direction only.
 
virtual bool ScaleXY (double s)
 Performs equal scaling in X and Y direction with the current position as the scaling center.
 
virtual bool ScaleXY (double s, double x, double y)
 Performs equal scaling in X and Y direction.
 
virtual bool Scale (double sx, double sy)
 Performs scaling in X and Y direction with the current position as the scaling center.
 
virtual bool Scale (double sx, double sy, double x, double y)
 Performs scaling in X and Y direction.
 
virtual void MirrorH ()
 Performs a horizontal mirroring transformation.
 
virtual void MirrorH (double x)
 Performs a horizontal mirroring transformation.
 
virtual void MirrorV ()
 Performs a vertical mirroring transformation.
 
virtual void MirrorV (double y)
 Performs a vertical mirroring transformation.
 
virtual void TranslateX (double tx)
 Moves the X origin.
 
virtual void TranslateY (double ty)
 Moves the Y origin.
 
virtual void Translate (double tx, double ty)
 Moves the origin.
 
virtual bool SkewX (double xAngle)
 Performs a skewing in X direction only with the current position as the skewing center.
 
virtual bool SkewX (double xAngle, double x, double y)
 Performs a skewing in both X direction only.
 
virtual bool SkewY (double yAngle)
 Performs a skewing in Y direction only with the current position as the skewing center.
 
virtual bool SkewY (double yAngle, double x, double y)
 Performs a skewing in Y direction only.
 
virtual bool Skew (double xAngle, double yAngle)
 Performs a skewing in both X and Y directions with the current position as the skewing center.
 
virtual bool Skew (double xAngle, double yAngle, double x, double y)
 Performs a skewing in both X and Y directions.
 
virtual void Transform (double a, double b, double c, double d, double tx, double ty)
 Performs a transformation.
 
virtual void StopTransform ()
 Leaves a transformation environment.
 
virtual int SetAlpha (double lineAlpha=1, double fillAlpha=1, wxPdfBlendMode blendMode=wxPDF_BLENDMODE_NORMAL)
 Sets alpha values and blend mode.
 
virtual void SetAlphaState (int alphaState)
 Sets a previously defined alpha state.
 
virtual int LinearGradient (const wxPdfColour &col1, const wxPdfColour &col2, wxPdfLinearGradientType gradientType=wxPDF_LINEAR_GRADIENT_HORIZONTAL)
 Defines a linear gradient shading.
 
virtual int AxialGradient (const wxPdfColour &col1, const wxPdfColour &col2, double x1=0, double y1=0, double x2=1, double y2=0, double intexp=1)
 Defines an axial gradient shading.
 
virtual int MidAxialGradient (const wxPdfColour &col1, const wxPdfColour &col2, double x1=0, double y1=0, double x2=1, double y2=0, double midpoint=0.5, double intexp=1)
 Defines an axial gradient shading with a configurable midpoint.
 
virtual int RadialGradient (const wxPdfColour &col1, const wxPdfColour &col2, double x1=0.5, double y1=0.5, double r1=0, double x2=0.5, double y2=0.5, double r2=1, double intexp=1)
 Defines a radial gradient shading.
 
virtual int CoonsPatchGradient (const wxPdfCoonsPatchMesh &mesh, double minCoord=0, double maxCoord=1)
 Defines a coons patch mesh gradient shading.
 
virtual void SetFillGradient (double x, double y, double w, double h, int gradient)
 Paints a gradient shading to rectangular area.
 
virtual void Marker (double x, double y, wxPdfMarker markerType, double size)
 Draws a graphical marker symbol.
 
virtual void Annotate (double x, double y, const wxString &text)
 Adds a text annotation.
 
virtual void AppendJavascript (const wxString &javascript)
 Appends Javascript.
 
virtual void WriteXml (const wxString &str)
 Prints a string containing simple XML markup.
 
virtual void CheckBox (const wxString &name, double width, bool checked=false)
 Adds a check box field at the current position.
 
virtual void CheckBox (const wxString &name, double x, double y, double width, bool checked=false)
 Adds a check box field.
 
virtual void ComboBox (const wxString &name, double width, double height, const wxArrayString &values)
 Adds a combo box field at the current position.
 
virtual void ComboBox (const wxString &name, double x, double y, double width, double height, const wxArrayString &values)
 Adds a combo box field.
 
virtual void PushButton (const wxString &name, double width, double height, const wxString &caption, const wxString &action)
 Adds a push button at the current position.
 
virtual void PushButton (const wxString &name, double x, double y, double width, double height, const wxString &caption, const wxString &action)
 Adds a push button.
 
virtual void RadioButton (const wxString &group, const wxString &name, double width)
 Adds a radio button at the current position.
 
virtual void RadioButton (const wxString &group, const wxString &name, double x, double y, double width)
 Adds a radio button.
 
virtual void TextField (const wxString &name, double width, double height, const wxString &value=wxEmptyString, bool multiline=false)
 Adds a text field at the current position.
 
virtual void TextField (const wxString &name, double x, double y, double width, double height, const wxString &value=wxEmptyString, bool multiline=false)
 Adds a text field.
 
virtual void SetFormColours (const wxPdfColour &borderColour=wxPdfColour(), const wxPdfColour &backgroundColour=wxPdfColour(250), const wxPdfColour &textColour=wxPdfColour())
 Sets colours for form fields.
 
virtual void SetFormBorderStyle (wxPdfBorderStyle borderStyle=wxPDF_BORDER_SOLID, double borderWidth=-1)
 Sets the border style for form fields.
 
virtual int BeginTemplate (double x=0, double y=0, double width=0, double height=0)
 Starts a new Template.
 
virtual int EndTemplate ()
 Terminates a template.
 
virtual void GetTemplateSize (int templateId, double &width, double &height)
 Get the calculated size of a template.
 
virtual void UseTemplate (int templateId)
 Uses a template in current page or in another template.
 
virtual void UseTemplate (int templateId, double x, double y, double width=0, double height=0)
 Uses a template in current page or in another template.
 
virtual int SetSourceFile (const wxString &filename, const wxString &password=wxEmptyString)
 Sets a source file for the external template feature.
 
virtual bool GetSourceInfo (wxPdfInfo &info)
 Gets the document information dictionary of the current external PDF document.
 
virtual int ImportPage (unsigned int pageno, wxPdfPageBox pageBox=wxPDF_PAGEBOX_ARTBOX)
 Imports a page from an external PDF document.
 
virtual void GetTemplateBBox (int templateId, double &x, double &y, double &width, double &height)
 Gets the bounding box of a template.
 
virtual void SetTemplateBBox (int templateId, double x, double y, double width, double height)
 Sets the bounding box of a template.
 
virtual void ShapedText (const wxPdfShape &shape, const wxString &text, wxPdfShapedTextMode mode=wxPDF_SHAPEDTEXTMODE_STRETCHTOFIT)
 Prints a text string along a path defined by a shape.
 
virtual wxPdfLayer * AddLayer (const wxString &layerName)
 Add a layer.
 
virtual wxPdfLayer * AddLayerTitle (const wxString &layerTitle)
 Add a title layer.
 
virtual wxPdfLayerMembership * AddLayerMembership ()
 Add a layer membership container.
 
virtual void LockLayer (wxPdfLayer *layer)
 Lock a layer.
 
virtual void AddLayerRadioGroup (const wxPdfLayerGroup &radioGroup)
 Add a radio group of layers.
 
virtual void EnterLayer (wxPdfLayer *layer)
 Enter a layer.
 
virtual void EnterLayer (wxPdfLayerMembership *layer)
 
virtual void LeaveLayer ()
 Leave a layer.
 
void SetTagged (bool tagged=true)
 Enable or disable tagged PDF output.
 
bool IsTagged () const
 Check whether tagged PDF output is enabled.
 
void SetLanguage (const wxString &language)
 Set the natural language of the document.
 
const wxString & GetLanguage () const
 Get the natural language of the document.
 
virtual void BeginTag (const wxPdfTag &tag)
 Begin a logical structure element.
 
void BeginTag (const wxString &structureType, const wxString &altText=wxEmptyString, const wxString &actualText=wxEmptyString)
 Begin a logical structure element.
 
virtual void EndTag ()
 End the innermost open structure element.
 
void BeginFormula (const wxString &altText, const wxString &mathML=wxEmptyString, const wxString &actualText=wxEmptyString)
 Begin a mathematical formula.
 
void EndFormula ()
 End a mathematical formula.
 
int GetTagDepth () const
 Get the number of currently open structure elements.
 
virtual void BeginArtifact ()
 Begin an artifact.
 
virtual void EndArtifact ()
 End an artifact.
 
virtual bool AttachFile (const wxString &fileName, const wxString &attachName=wxEmptyString, const wxString &description=wxEmptyString)
 Attach file.
 
void SetPdfA1Conformance (bool enable)
 Set PDF/A-1b conformance.
 
bool GetPdfA1Conformance () const
 Get PDF/A-1b conformance.
 
void SetMessageTranslateMode (bool translate)
 Set message translation mode.
 
bool GetMessageTranslateMode ()
 Get message translation mode.
 

Protected Member Functions

virtual void AddPage (int orientation, wxSize pageSize)
 Adds a new page with specified orientation and size.
 
virtual void SetFontSize (double size, bool setSize)
 Defines the size of the current font.
 
void Transform (double tm[6])
 Perform transformation.
 
void WriteXml (wxXmlNode *node)
 Write XML using XML node.
 
virtual void Initialize (int orientation)
 Initialize the document.
 
virtual void SaveGraphicState ()
 Pushes the current graphic state onto an internal stack.
 
virtual void RestoreGraphicState ()
 Pops and restores the most recently saved graphic state.
 
virtual void ClearGraphicState ()
 Discards all saved graphic states.
 
virtual bool SelectFont (const wxString &family, const wxString &style=wxEmptyString, double size=0, bool setFont=true)
 Select font.
 
virtual bool SelectFont (const wxString &family, int style, double size=0, bool setFont=true)
 Select font.
 
virtual bool SelectFont (const wxFont &font, bool setFont=true)
 Select font based on wxFont object.
 
virtual bool SelectFont (const wxPdfFont &font, int style, double size=0, bool setFont=true)
 Select font based on wxPdfFont object.
 
wxPdfFont GetFontToEmbed (const wxPdfFont &font, int style)
 Get the font to be used for a selected font, honouring the embed-all-fonts mode.
 
wxPdfFont FindEmbeddableFont (const wxString &family, int style)
 Find an embeddable font for a family that is not registered (embed-all-fonts mode)
 
virtual wxString ApplyVisualOrdering (const wxString &txt)
 Apply visual ordering to a text string.
 
virtual double DoGetStringWidth (const wxString &s, double charSpacing=0)
 Returns the length of a string in user unit.
 
virtual void DoCell (double w, double h=0., const wxString &txt=wxEmptyString, int border=wxPDF_BORDER_NONE, int ln=0, int align=wxPDF_ALIGN_LEFT, int fill=0, const wxPdfLink &link=wxPdfLink(-1))
 Prints a cell (rectangular area) with optional borders, background colour and character string.
 
virtual wxSize GetImageSize (const wxString &file, const wxString &mimeType=wxEmptyString)
 Get size of an image.
 
virtual void BeginPage (int orientation, wxSize pageSize)
 Start document.
 
virtual void EndPage ()
 End of page contents.
 
virtual void EndDoc ()
 End document.
 
virtual void PutHeader ()
 Add header.
 
virtual void PutPages ()
 Add pages.
 
virtual void ReplaceNbPagesAlias ()
 Replace page number aliases.
 
virtual void PutResources ()
 Add resources.
 
virtual void PutBookmarks ()
 Add bookmarks.
 
virtual void PutExtGStates ()
 Add extended graphics states.
 
virtual void PutShaders ()
 Add shaders.
 
virtual void PutFonts ()
 Adds fonts.
 
virtual void PutImages ()
 Add images.
 
virtual void PutTemplates ()
 Add templates.
 
virtual void PutImportedObjects ()
 Add imported objects.
 
virtual void WriteObjectValue (wxPdfObject *value, bool newline=true)
 
virtual void PutSpotColours ()
 Add spot colours.
 
virtual void InitPatternIds ()
 Initialize object ids of patterns.
 
virtual void PutPatterns ()
 Add patterns.
 
virtual void PutLayers ()
 Add layers.
 
void PutOCProperties ()
 Add optional content properties.
 
void PutOCGOrder (wxPdfLayer *layer)
 Add optional content order.
 
void PutASEvent (const wxString &situation, const wxString &category, bool &first)
 Add automatic state event.
 
virtual void PutJavaScript ()
 Add Javascript (document level)
 
virtual void PutFiles ()
 Add attached files.
 
virtual void PutResourceDict ()
 Add resource dictionary.
 
virtual void PutEncryption ()
 Add encryption info.
 
virtual void PutFormFields ()
 Add form fields.
 
virtual void PutInfo ()
 Add info.
 
virtual void PutColourProfile ()
 Add colour profile.
 
virtual void PutMetaData ()
 Add XMP meta data.
 
virtual void PutCatalog ()
 Add catalog.
 
virtual void PutStructTree ()
 Add the structure tree of a tagged document.
 
void PutStructElement (wxPdfStructElement *element, int parentObjId)
 Write a structure element (and, recursively, its kids) of a tagged document.
 
void TagOpenMarkedContent ()
 Open the marked-content sequence required by the current tagging state.
 
void TagCloseMarkedContent ()
 Close the currently open marked-content sequence of a tagged document, if any.
 
void TagSuspendMarkedContent ()
 Close the currently open marked-content sequence and don't open another one until TagResumeMarkedContent()
 
void TagResumeMarkedContent ()
 Allow opening marked-content sequences again after TagSuspendMarkedContent()
 
void TagPagination (bool begin)
 Start or end writing page decoration (header or footer) in a tagged document.
 
virtual void PutXObjectDict ()
 Add object dictionary.
 
virtual void PutTrailer ()
 Add trailer.
 
size_t CalculateStreamLength (size_t len)
 Calculate stream size.
 
size_t CalculateStreamOffset ()
 Calculate stream offset.
 
int GetNewObjId ()
 Get new object id.
 
void NewObj (int objId=0)
 Begin a new object.
 
wxString DoDecoration (double x, double y, const wxString &txt)
 Decorate text.
 
void ShowText (const wxString &txt)
 Show text string, with kerning if requested.
 
void ShowTextRun (const wxString &txt)
 Show a text string with the current font, with kerning and word spacing if requested.
 
bool SplitTextByFont (const wxString &txt, std::vector< wxPdfFontFallbackRun > &runs)
 Split a text into runs that can each be rendered with a single font.
 
int FindFallbackSlot (wxUint32 codePoint, const wxString &chr)
 Find the fallback font slot for a single code point.
 
wxPdfFontDetails * RegisterFontDetails (const wxPdfFont &font)
 Make sure that a font is known to the document (and to the current template)
 
void ShowGlyph (wxUint32 glyph)
 Show a single glyph.
 
void TextEscape (const wxString &s, bool newline=true)
 Format a text string.
 
void PutStream (wxMemoryOutputStream &s)
 Add byte stream.
 
void OutTextstring (const wxString &s, bool newline=true)
 Add a text string to the document.
 
void OutRawTextstring (const wxString &s, bool newline=true)
 Add a raw text string to the document (without charset conversion)
 
void OutHexTextstring (const wxString &s, bool newline=true)
 Add a hex text string to the document (without charset conversion)
 
void OutAsciiTextstring (const wxString &s, bool newline=true)
 Add an ASCII text string to the document.
 
void OutEscape (const char *s, size_t len)
 Add \ before \, ( and )
 
void OutEscape (const std::string &s)
 Add \ before \, ( and )
 
void OutHex (const char *s, size_t len)
 Add a hex string to the document.
 
void OutHex (const std::string &s)
 Add a hex string to the document.
 
void OutAscii (const wxString &s, bool newline=true)
 Add ASCII string.
 
void Out (const char *s, bool newline=true)
 Add character string.
 
void Out (const char *s, size_t len, bool newline=true)
 Add len characters.
 
void OutPoint (double x, double y)
 Sets a draw point.
 
void OutPointRelative (double dx, double dy)
 Sets a draw point relative to current position.
 
void OutLine (double x, double y)
 Draws a line from last draw point.
 
void OutLineRelative (double dx, double dy)
 Draws a line relative from last draw point.
 
void OutCurve (double x1, double y1, double x2, double y2, double x3, double y3)
 Draws a Bézier curve from last draw point.
 
void AddFormField (wxPdfAnnotationWidget *field, bool setFormField=true)
 Adds a form field to the document.
 
void OutIndirectObject (wxPdfIndirectObject *object)
 Add an indirect object to the document.
 
void OutImage (wxPdfImage *currentImage, double x, double y, double w, double h, const wxPdfLink &link)
 Add an image object to the document.
 
void PrepareXmlCell (wxXmlNode *node, wxPdfCellContext &context)
 Prepare an XML cell for output.
 
void WriteXmlCell (wxXmlNode *node, wxPdfCellContext &context)
 Output a prepared XML cell.
 
void DoXmlAlign (wxPdfCellContext &context)
 Take alignment of an XML cell into account.
 
void PrepareXmlTable (wxXmlNode *node, wxPdfCellContext &context)
 Prepare an XML table for output.
 
void WriteXmlTable (wxPdfCellContext &context)
 Output a prepared XML table.
 
void SetScaleFactor (const wxString &unit)
 Set internal scale factor.
 
wxSize CalculatePageSize (wxPaperSize format)
 Calculate page size for a given paper format.
 
wxSize CalculatePageSize (double pageWidth, double pageHeight)
 Calculate page size for given dimensions.
 
void LoadZapfDingBats ()
 Loads the ZapfDingbats core font.
 
double GetHeaderHeight () const
 

Detailed Description

Document with header and footer.

Member Function Documentation

◆ AcceptPageBreak()

bool wxPdfDocument::AcceptPageBreak ( )
virtualinherited

Whenever a page break condition is met,.

Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. The default implementation returns a value according to the mode selected by SetAutoPageBreak()

This method is called automatically and should not be called directly by the application.

Returns
boolean
See also
SetAutoPageBreak()

Reimplemented in PdfTuto4.

◆ AddFallbackFont() [1/2]

bool wxPdfDocument::AddFallbackFont ( const wxPdfFont &  font)
virtualinherited

Adds a font to the list of fallback fonts.

Font fallback (also known as font substitution) is used for characters the current font has no glyph for. Without fallback such characters are rendered as blanks (or as the font's "missing glyph" symbol). With fallback, wxPdfDocument splits the text into runs, rendering each character the current font lacks with the first fallback font that contains it - similar to what wxWidgets and the operating system do when drawing text on screen. Typical use: Greek letters and mathematical symbols in a document whose main font only covers Latin script.

Fallback fonts are tried in the order they were added. If the current font is bold and/or italic, the corresponding style of the fallback font family is used if it is registered; otherwise the font as given is used.

Fallback affects text output (Text(), Cell(), MultiCell(), Write(), WriteXml(), wxPdfDC and wxPdfGraphicsContext) as well as GetStringWidth(), so that layout and rendering stay consistent. Characters the current font can show are always rendered with the current font, so documents that do not need fallback are written exactly as before.

Parameters
fonta valid font, for example as returned by wxPdfFontManager::GetFont() or wxPdfFontManager::RegisterFont()
Returns
true if the font was added, false if the font is invalid
Note
Font fallback is disabled by default.
If all fonts have to be embedded (SetEmbedAllFonts(), PDF/A-1), the same rules apply to fallback fonts as to the current font.
See also
ClearFallbackFonts(), SetSystemFontFallback()

◆ AddFallbackFont() [2/2]

bool wxPdfDocument::AddFallbackFont ( const wxString &  family)
virtualinherited

Adds a font family to the list of fallback fonts.

Convenience variant of AddFallbackFont(const wxPdfFont&) for fonts already registered with wxPdfFontManager (including the core fonts, e.g. "Symbol").

Parameters
familyname of a registered font family
Returns
true if the family is known and was added, false otherwise

◆ AddFont()

bool wxPdfDocument::AddFont ( const wxString &  family,
const wxString &  style = wxEmptyString,
const wxString &  file = wxEmptyString 
)
virtualinherited

Imports a TrueType, TrueTypeUnicode or Type1 font and makes it available.

It is necessary to generate a font definition file first with the makefont utility. The definition file (and the font file itself when embedding) must be present either in the subdirectory 'fonts' of the current working directory or in the one indicated by WXPDF_FONTPATH if this environment variable is defined.

Parameters
familyFont family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.
styleFont style. Possible values are (case insensitive):
  • empty string: regular (default)
  • B: bold
  • I: italic
  • BI or IB: bold italic
  • O: overline
  • S: strikethrough
  • T: thin
  • E: extra light
  • L: light
  • M: medium
  • D: demi / semi-bold
  • X: extra bold
  • H: heavy / black
  • A: extra heavy Granular weights (Thin to ExtraHeavy) are fully supported when using wxFont starting with wxWidgets 3.1.2. In older versions, they fall back to the closest standard weight (Bold or Regular).
fileThe font definition file. By default, the name is built from the family and style, in lower case with no space.
See also
SetFont()
Deprecated:
use the wxPdfFontManager to register fonts for use in creating PDF documents

◆ AddFontCJK()

virtual bool wxPdfDocument::AddFontCJK ( const wxString &  family)
inlinevirtualinherited

Imports a CJK (Chinese, Japanese or Korean) font and makes it available.

It is necessary to generate a font definition file first with the makefont utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by WXPDF_FONTPATH if the constant is defined.

Parameters
familyFont family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.

All font styles (regular, bold, italic and bold-italic) are made available The font definition file name is built from the family in lower case with no space. There are several predefined font definition files available:

  • BIG5 Chinese (traditional)
  • BIG5-HW Chinese (traditional) half-width ASCII characters
  • GB Chinese (simplified)
  • GB-HW Chinese (simplified) half-width ASCII characters
  • SJIS Japanese
  • SJIS-HW Japanese, half-width ASCII characters
  • UHC Korean
  • UHC-HW Korean, half-width ASCII characters

These fonts require that the Adobe CJK font support is installed

See also
SetFont()
Deprecated:
use the wxPdfFontManager to register fonts for use in creating PDF documents

◆ AddLayer()

wxPdfLayer * wxPdfDocument::AddLayer ( const wxString &  layerName)
virtualinherited

Add a layer.

An optional content group represents a collection of graphics that can be made visible or invisible dynamically by users of viewer applications. In wxPdfDocument they are referenced as layers.

Parameters
layerNamethe name of the layer
Returns
a reference to the new layer
Example
wxPdfLayer* layer = pdf.AddLayer(wxS("Watermark"));
pdf.EnterLayer(layer);
pdf.SetTextColour(wxPdfColour(wxString(wxS("red"))));
pdf.Cell(0, 6, wxS("DRAFT"));
pdf.LeaveLayer();
Class representing wxPdfDocument colours.
Definition: pdfcolour.h:40
Class for a layer with optional content.
Definition: pdflayer.h:110
See also
AddLayerTitle(), AddLayerMembership(), LockLayer(), AddLayerRadioGroup(), EnterLayer(), LeaveLayer()

◆ AddLayerMembership()

wxPdfLayerMembership * wxPdfDocument::AddLayerMembership ( )
virtualinherited

Add a layer membership container.

Content typically belongs to a single optional content group, and is visible when the group is ON and invisible when it is OFF. To express more complex visibility policies, content should not declare itself to belong to an optional content group directly, but rather to an optional content membership container.

Returns
a reference to the new layer membership container
Example
wxPdfLayer* l1 = pdf.AddLayer(wxS("Layer 1"));
wxPdfLayer* l2 = pdf.AddLayer(wxS("Layer 2"));
wxPdfLayerMembership* m = pdf.AddLayerMembership();
m->AddMember(l1);
m->AddMember(l2);
pdf.EnterLayer(m);
pdf.Cell(0, 6, wxS("Visible when Layer 1 or Layer 2 is on"));
pdf.LeaveLayer();
Class for a layer with optional content.
Definition: pdflayer.h:314
bool AddMember(wxPdfLayer *layer)
Add layer.
Definition: pdflayer.cpp:247
See also
AddLayer(), EnterLayer(), LeaveLayer()

◆ AddLayerRadioGroup()

void wxPdfDocument::AddLayerRadioGroup ( const wxPdfLayerGroup &  radioGroup)
virtualinherited

Add a radio group of layers.

Use this method to set a collection of optional content groups whose states are intended to follow a "radio button" paradigm. That is, the state of at most one optional content group in the array should be ON at a time: if one group is turned ON, all others must be turned OFF.

Parameters
radioGroupthe radio group
Example
wxPdfLayer* l1 = pdf.AddLayer(wxS("Layer 1"));
wxPdfLayer* l2 = pdf.AddLayer(wxS("Layer 2"));
wxPdfLayer* l3 = pdf.AddLayer(wxS("Layer 3"));
radio.Add(l1);
radio.Add(l2);
radio.Add(l3);
pdf.AddLayerRadioGroup(radio);
Class for a group of layers with optional content.
Definition: pdflayer.h:365
bool Add(wxPdfLayer *layer)
Add layer.
Definition: pdflayer.cpp:296
See also
AddLayer()

◆ AddLayerTitle()

wxPdfLayer * wxPdfDocument::AddLayerTitle ( const wxString &  layerTitle)
virtualinherited

Add a title layer.

Creates a title layer. A title layer is not really a layer but a collection of layers under the same title heading.

Parameters
layerTitlethe title text
Returns
a reference to the title layer
Example
wxPdfLayer* title = pdf.AddLayerTitle(wxS("Background elements"));
wxPdfLayer* l1 = pdf.AddLayer(wxS("Logo"));
wxPdfLayer* l2 = pdf.AddLayer(wxS("Watermark"));
title->AddChild(l1);
title->AddChild(l2);
bool AddChild(wxPdfLayer *child)
Add child layer.
Definition: pdflayer.cpp:69
See also
AddLayer(), EnterLayer(), LeaveLayer()

◆ AddLinearGradientPattern() [1/2]

bool wxPdfDocument::AddLinearGradientPattern ( const wxString &  patternName,
double  x1,
double  y1,
double  x2,
double  y2,
const wxColour &  c1,
const wxColour &  c2 
)
virtualinherited

Add a linear gradient pattern.

Add a linear gradient pattern which can be referenced in draw or fill pattern methods

The pattern starts at (x1, y1) and ends at (x2, y2). The colours c1 and c2 are used as the start and end gradient colours.

Parameters
patternNamethe name of the pattern (case sensitive)
x1the x coordinate of the start value
y1the y coordinate of the start value
x2the x coordinate of the end value
y2the y coordinate of the end value
c1the start colour
c2the end colour
matrixan optional transformation matrix

◆ AddLinearGradientPattern() [2/2]

bool wxPdfDocument::AddLinearGradientPattern ( const wxString &  patternName,
double  x1,
double  y1,
double  x2,
double  y2,
const wxGraphicsGradientStops &  stops 
)
virtualinherited

Add a linear gradient pattern.

Add a linear gradient pattern which can be referenced in draw or fill pattern methods

The pattern starts at (x1, y1) and ends at (x2, y2). A full set of gradient stops can be specified. At least 2 stops are required.

Parameters
patternNamethe name of the pattern (case sensitive)
x1the x coordinate of the start value
y1the y coordinate of the start value
x2the x coordinate of the end value
y2the y coordinate of the end value
stopsa full set of gradient stops (at least 2)
matrixan optional transformation matrix

◆ AddLink()

int wxPdfDocument::AddLink ( )
virtualinherited

Creates a new internal link and returns its identifier.

An internal link is a clickable area which directs to another place within the document. The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().

See also
Cell(), Write(), Image(), Link(), SetLink()

◆ AddPage() [1/4]

void wxPdfDocument::AddPage ( int  orientation,
double  pageWidth,
double  pageHeight 
)
virtualinherited

Adds a new page with the specified orientation and dimensions.

Parameters
orientationPage orientation (wxPORTRAIT, wxLANDSCAPE).
pageWidthPage width in user units.
pageHeightPage height in user units.
Example
// A5 page (148 x 210 mm) in landscape
pdf.AddPage(wxLANDSCAPE, 210, 148);
pdf.SaveAsFile(wxS("output.pdf"));
Class representing a PDF document.
Definition: pdfdocument.h:176
virtual bool SaveAsFile(const wxString &name=wxEmptyString)
Saves the document to a file on disk.
Definition: pdfdocument.cpp:2233
virtual void AddPage(int orientation=-1, bool useDefaultPageSize=true)
Adds a new page to the document.
Definition: pdfdocument.cpp:686

◆ AddPage() [2/4]

void wxPdfDocument::AddPage ( int  orientation,
wxPaperSize  format 
)
virtualinherited

Adds a new page with the specified orientation and format.

Parameters
orientationPage orientation (wxPORTRAIT, wxLANDSCAPE).
formatPaper size format.
Example
pdf.AddPage(wxPORTRAIT, wxPAPER_A4);
pdf.AddPage(wxLANDSCAPE, wxPAPER_A4);
pdf.AddPage(wxPORTRAIT, wxPAPER_A3);
pdf.AddPage(wxLANDSCAPE, wxPAPER_A3);
pdf.SaveAsFile(wxS("output.pdf"));

◆ AddPage() [3/4]

void wxPdfDocument::AddPage ( int  orientation,
wxSize  pageSize 
)
protectedvirtualinherited

Adds a new page with specified orientation and size.

Parameters
orientationPage orientation (wxPORTRAIT, wxLANDSCAPE)
pageSizePage size in user units

◆ AddPage() [4/4]

void wxPdfDocument::AddPage ( int  orientation = -1,
bool  useDefaultPageSize = true 
)
virtualinherited

Adds a new page to the document.

If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and Header() is called to display the header. The font which was set before calling is automatically restored. There is no need to call SetFont() again if you want to continue with the same font. The same is true for colours and line width. The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.

Parameters
orientationPage orientation. Possible values are:
  • wxPORTRAIT
  • wxLANDSCAPE The default value is the one passed to the constructor.
useDefaultPageSizeFlag whether to use the default page size or the current page size
See also
FPDF(), Header(), Footer(), SetMargins()

◆ AddPattern() [1/3]

bool wxPdfDocument::AddPattern ( const wxString &  patternName,
const wxImage &  image,
double  width,
double  height 
)
virtualinherited

Add an image pattern.

Add an image pattern which can be referenced in draw or fill pattern methods

Parameters
patternNamethe name of the pattern (case sensitive)
imagethe image to be used as a pattern
widththe display width of the pattern
heightthe display height of the pattern

◆ AddPattern() [2/3]

bool wxPdfDocument::AddPattern ( const wxString &  patternName,
int  templateId,
double  width,
double  height 
)
virtualinherited

Add a template based pattern.

Add a template based pattern which can be referenced in draw or fill pattern methods

Parameters
patternNamethe name of the pattern (case sensitive)
templateIdthe id of the template to be used as a pattern
widththe display width of the pattern
heightthe display height of the pattern

◆ AddPattern() [3/3]

bool wxPdfDocument::AddPattern ( const wxString &  patternName,
wxPdfPatternStyle  patternStyle,
double  width,
double  height,
const wxColour &  drawColour,
const wxColour &  fillColour = wxColour() 
)
virtualinherited

Add a hatched pattern.

Add a hatched pattern which can be referenced in draw or fill pattern methods

Parameters
patternNamethe name of the pattern (case sensitive)
patternStylethe pattern style to be used as a pattern
widththe display width
heightthe display height
drawColourthe foreground colour used for hatching
fillColourthe background colour to fill the pattern background (optional)

◆ AddRadialGradientPattern() [1/2]

bool wxPdfDocument::AddRadialGradientPattern ( const wxString &  patternName,
double  startX,
double  startY,
double  startRadius,
double  endX,
double  endY,
double  endRadius,
const wxColour &  oColor,
const wxColour &  cColor 
)
virtualinherited

Add a radial gradient pattern.

Add a radial gradient pattern which can be referenced in draw or fill pattern methods

The pattern originates at (startX, startY) and ends on a circle around (endX, endY) with the given radius. The gradient is specified by its start and end colours, oColor and cColor.

Parameters
patternNamethe name of the pattern (case sensitive)
startXthe x coordinate of the start value
startYthe y coordinate of the start value
startRadiusthe radius at the start point
endXthe x coordinate of the end value
endYthe y coordinate of the end value
endRadiusthe radius at the end point
oColorthe start colour
cColorthe end colour
matrixan optional transformation matrix

◆ AddRadialGradientPattern() [2/2]

bool wxPdfDocument::AddRadialGradientPattern ( const wxString &  patternName,
double  startX,
double  startY,
double  startRadius,
double  endX,
double  endY,
double  endRadius,
const wxGraphicsGradientStops &  stops 
)
virtualinherited

Add a radial gradient pattern.

Add a radial gradient pattern which can be referenced in draw or fill pattern methods

The pattern originates at (startX, startY) and ends on a circle around (endX, endY) with the given radius. The gradient is specified by a full set of gradient stops.

Parameters
patternNamethe name of the pattern (case sensitive)
startXthe x coordinate of the start value
startYthe y coordinate of the start value
startRadiusthe radius at the start point
endXthe x coordinate of the end value
endYthe y coordinate of the end value
endRadiusthe radius at the end point
stopsa full set of gradient stops (at least 2)
matrixan optional transformation matrix

◆ AddSpotColour()

void wxPdfDocument::AddSpotColour ( const wxString &  name,
double  cyan,
double  magenta,
double  yellow,
double  black 
)
virtualinherited

Add spot colour.

Add a spot colour which can be referenced in colour setting methods

Parameters
namethe name of the spot colour (case sensitive)
cyanindicates the cyan level. Value between 0 and 100
magentaindicates the magenta level. Value between 0 and 100
yellowindicates the yellow level. Value between 0 and 100
blackindicates the black level. Value between 0 and 100
See also
SetDrawColour(), SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell()

◆ AliasNbPages()

void wxPdfDocument::AliasNbPages ( const wxString &  alias = wxString(wxS("{nb}")))
virtualinherited

Defines an alias for the total number of pages.

It will be substituted as the document is closed.

Parameters
aliasThe alias. Default value: {nb}.
See also
PageNo(), Footer()

◆ Annotate()

void wxPdfDocument::Annotate ( double  x,
double  y,
const wxString &  text 
)
virtualinherited

Adds a text annotation.

Parameters
xabscissa of the annotation symbol
yordinate of the annotation symbol
textannotation text
Example
pdf.AddPage();
pdf.SetFont(wxS("Helvetica"), wxS(""), 12);
pdf.Cell(0, 6, wxS("Paragraph 1"));
pdf.Annotate(60, 30, wxS("Note about paragraph 1"));
pdf.Ln(20);
pdf.Cell(0, 6, wxS("Paragraph 2"));
pdf.Annotate(60, 60, wxS("Note about paragraph 2"));

◆ AppendJavascript()

void wxPdfDocument::AppendJavascript ( const wxString &  javascript)
virtualinherited

Appends Javascript.

Allows to append Javascript code to a Javascript object at the document level.

Parameters
javascriptJavascript code to be appended
Example
// Show the print dialog when the document is opened
pdf.AddPage();
pdf.Text(90, 50, wxS("Print me!"));
pdf.AppendJavascript(wxS("print(true);"));

◆ ApplyVisualOrdering()

wxString wxPdfDocument::ApplyVisualOrdering ( const wxString &  txt)
protectedvirtualinherited

Apply visual ordering to a text string.

Converts a string from Unicode logical order to visual display order by applying VOLT (Visual OpenType Layout Tool) glyph-substitution rules embedded in the current font. This is required for complex scripts such as Indic languages where the rendered glyph sequence differs from the Unicode code-point sequence.

Called automatically by all text output methods (Text(), Cell(), MultiCell(), WriteCell(), GetStringWidth()) before the string is rendered. If the current font carries no VOLT data the string is returned unchanged.

Override this method in a subclass to provide a custom shaping or reordering strategy for fonts that do not use the built-in VOLT mechanism.

Parameters
txtthe input string in Unicode logical order
Returns
the string transformed into visual display order

◆ Arrow()

void wxPdfDocument::Arrow ( double  x1,
double  y1,
double  x2,
double  y2,
double  linewidth,
double  height,
double  width 
)
virtualinherited

Draws an arrow line between two points.

Parameters
x1Abscissa of first point
y1Ordinate of first point
x2Abscissa of second point
y2Ordinate of second point
linewidthline width
heightheight of the arrow head
widthwidth of the arrow head
See also
SetLineWidth(), SetDrawColour(), SetFillColour()

◆ AttachFile()

bool wxPdfDocument::AttachFile ( const wxString &  fileName,
const wxString &  attachName = wxEmptyString,
const wxString &  description = wxEmptyString 
)
virtualinherited

Attach file.

Attaches a file to the PDF document.

Parameters
fileNamepath to the file to attach
attachNamethe name under which the file will be attached (default: filename)
descriptionan optional description

◆ AxialGradient()

int wxPdfDocument::AxialGradient ( const wxPdfColour &  col1,
const wxPdfColour &  col2,
double  x1 = 0,
double  y1 = 0,
double  x2 = 1,
double  y2 = 0,
double  intexp = 1 
)
virtualinherited

Defines an axial gradient shading.

Parameters
col1first colour (RGB or CMYK).
col2second colour (RGB or CMYK).
x1start point of gradient vector, default: 0 (range 0 .. 1)
y1start point of gradient vector, default: 0 (range 0 .. 1)
x2end point of gradient vector, default: 1 (range 0 .. 1)
y2end point of gradient vector, default: 0 (range 0 .. 1)
intexpinterpolation exponent, default: 1
Example
// Diagonal gradient from top-left (red) to bottom-right (blue)
int grad = pdf.AxialGradient(wxPdfColour(255, 0, 0), wxPdfColour(0, 0, 255),
0, 0, 1, 1);
pdf.SetFillGradient(10, 10, 90, 90, grad);
See also
LinearGradient(), MidAxialGradient(), RadialGradient(), CoonsPatchGradient(), SetFillGradient()

◆ BeginArtifact()

void wxPdfDocument::BeginArtifact ( )
virtualinherited

Begin an artifact.

Content drawn until the matching EndArtifact() is marked as an artifact: decoration that carries no meaning and is skipped by assistive technology, e.g. background graphics, rules, cell brackets or line numbers. Artifacts may be nested. Do not begin structure elements inside an artifact.

Has no effect unless tagged output was enabled with SetTagged().

See also
EndArtifact()

◆ BeginFormula()

void wxPdfDocument::BeginFormula ( const wxString &  altText,
const wxString &  mathML = wxEmptyString,
const wxString &  actualText = wxEmptyString 
)
inherited

Begin a mathematical formula.

Convenience method that opens a Formula structure element. All content drawn until EndFormula() is the visual representation of the formula.

Parameters
altTexta textual description of the formula, read by screen readers that don't understand MathML; required by PDF/UA. A linear notation such as x^2+1 or a spoken form such as "x squared plus one" are both common.
mathMLoptional MathML representation of the formula; it is embedded as an associated file of the structure element (see wxPdfTag::SetMathML()).
actualTextoptional text that replaces the formula's glyphs on text extraction or copy & paste, e.g. a linear notation of the formula
See also
EndFormula(), BeginTag()

◆ BeginPage()

void wxPdfDocument::BeginPage ( int  orientation,
wxSize  pageSize 
)
protectedvirtualinherited

Start document.

See also
EndPage()

◆ BeginTag() [1/2]

void wxPdfDocument::BeginTag ( const wxPdfTag &  tag)
virtualinherited

Begin a logical structure element.

Opens a new structure element as a child of the innermost open element. All content drawn until the matching EndTag() belongs to this element; structure elements may be nested to any depth, and may span several pages. The order in which elements are begun is the reading order.

Has no effect unless tagged output was enabled with SetTagged().

Parameters
tagthe description of the structure element
Example
pdf.SetTagged();
pdf.SetLanguage(wxS("en"));
pdf.AddPage();
pdf.BeginTag(wxS("H1"));
pdf.Cell(0, 10, wxS("Results"));
pdf.EndTag();
pdf.BeginTag(wxPdfTag(wxS("Figure")).SetAltText(wxS("Plot of sin(x) from 0 to 2 pi")));
pdf.Image(wxS("plot.png"), 10, 30, 80);
pdf.EndTag();
Description of a logical structure element ("tag") of a tagged PDF document.
Definition: pdfstructure.h:80
See also
EndTag(), BeginFormula(), wxPdfTag

◆ BeginTag() [2/2]

void wxPdfDocument::BeginTag ( const wxString &  structureType,
const wxString &  altText = wxEmptyString,
const wxString &  actualText = wxEmptyString 
)
inherited

Begin a logical structure element.

Convenience method, equivalent to BeginTag(wxPdfTag(structureType).SetAltText(altText).SetActualText(actualText)).

Parameters
structureTypethe structure type, e.g. "P", "H1", "Span" or "Figure"
altTextoptional alternate description (read instead of the content)
actualTextoptional replacement text (used for text extraction instead of the content)
See also
BeginTag(const wxPdfTag&), EndTag()

◆ BeginTemplate()

int wxPdfDocument::BeginTemplate ( double  x = 0,
double  y = 0,
double  width = 0,
double  height = 0 
)
virtualinherited

Starts a new Template.

Starts a new template, optionally with own dimensions. The margins have to adapted to the new template size. For writing outside the template, for example to build a clipped template, the margins and "cursor" position have to be set manually after the call to BeginTemplate().

If no dimensions are given, the template uses the current page size. The method returns the ID of the current template. The ID is used to reference a template in the UseTemplate() method. Warning: A template once created is embedded in the resulting PDF document at all events, even if it is not used.

Parameters
xThe x-coordinate given in user units
yThe y-coordinate given in user units
widthThe width given in user units
heightThe height given in user units
Returns
int The ID of the created template
See also
EndTemplate(), UseTemplate()
Attention
Calls to BeginTemplate() cannot be nested!

◆ BezierSpline()

void wxPdfDocument::BezierSpline ( const wxPdfArrayDouble &  x,
const wxPdfArrayDouble &  y,
int  style 
)
virtualinherited

Draws a Bézier spline through a list of points.

Parameters
xArray with abscissa values
yArray with ordinate values
styleStyle of the spline (draw and/or fill)
Example
wxPdfArrayDouble x, y;
x.Add(20); y.Add(100);
x.Add(60); y.Add(80);
x.Add(100); y.Add(100);
x.Add(140); y.Add(80);
pdf.BezierSpline(x, y, wxPDF_STYLE_DRAW);
#define wxPDF_STYLE_DRAW
Draw (stroke) the path.
Definition: pdfproperties.h:37
See also
ClosedBezierSpline(), Curve()

◆ Bookmark()

void wxPdfDocument::Bookmark ( const wxString &  txt,
int  level = 0,
double  y = 0 
)
virtualinherited

Adds a bookmark to the document outline.

Parameters
txtthe bookmark title.
levelthe bookmark level (0 is top level, 1 is just below, and so on).
ythe y position of the bookmark destination in the current page. -1 means the current position. Default value: 0.
Example
pdf.AddPage();
pdf.Bookmark(wxS("Page 1"));
pdf.Bookmark(wxS("Paragraph 1"), 1, -1);
pdf.Cell(0, 6, wxS("Paragraph 1"));
pdf.Ln(50);
pdf.Bookmark(wxS("Paragraph 2"), 1, -1);
pdf.Cell(0, 6, wxS("Paragraph 2"));

◆ CalculatePageSize() [1/2]

wxSize wxPdfDocument::CalculatePageSize ( double  pageWidth,
double  pageHeight 
)
protectedinherited

Calculate page size for given dimensions.

Parameters
pageWidthPage width
pageHeightPage height
Returns
Page size in user units

◆ CalculatePageSize() [2/2]

wxSize wxPdfDocument::CalculatePageSize ( wxPaperSize  format)
protectedinherited

Calculate page size for a given paper format.

Parameters
formatPaper size format
Returns
Page size in user units

◆ Cell()

void wxPdfDocument::Cell ( double  w,
double  h = 0.,
const wxString &  txt = wxEmptyString,
int  border = wxPDF_BORDER_NONE,
int  ln = 0,
int  align = wxPDF_ALIGN_LEFT,
int  fill = 0,
const wxPdfLink &  link = wxPdfLink(-1) 
)
virtualinherited

Prints a cell (rectangular area) with optional borders, background colour and character string.

The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.

Parameters
wCell width. If 0, the cell extends up to the right margin.
hCell height. Default value: 0.
txtString to print. Default value: empty string.
borderIndicates if borders must be drawn around the cell. The value can be
  • wxPDF_BORDER_NONE no border
  • wxPDF_BORDER_LEFT left border
  • wxPDF_BORDER_RIGHT right border
  • wxPDF_BORDER_TOP top border
  • wxPDF_BORDER_BOTTOM bottom border
  • wxPDF_BORDER_FRAME border on all sides
or a combination of them.
lnIndicates where the current position should go after the call. Possible values are:
  • 0: to the right
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
alignAllows to center or align the text. Possible values are:
  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • wxPDF_ALIGN_LEFT align the text at the left margin
  • wxPDF_ALIGN_CENTER center the text
  • wxPDF_ALIGN_RIGHT align the text at the right margin
  • wxPDF_ALIGN_JUSTIFY justify the text
fillIndicates if the cell background must be painted (1) or transparent (0). Default value: 0.
linkURL or identifier returned by AddLink().
See also
SetFont(), SetDrawColour(), SetFillColour(), SetTextColour(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak()

◆ CheckBox() [1/2]

void wxPdfDocument::CheckBox ( const wxString &  name,
double  width,
bool  checked = false 
)
virtualinherited

Adds a check box field at the current position.

Adds a check box to the list of form fields at the current position

Parameters
namefield name of the check box
widthwidth of the check box
checkeddefault value of the check box

◆ CheckBox() [2/2]

void wxPdfDocument::CheckBox ( const wxString &  name,
double  x,
double  y,
double  width,
bool  checked = false 
)
virtualinherited

Adds a check box field.

Adds a check box to the list of form fields

Parameters
namefield name of the check box
xabscissa of the check box position
yordinate of the check box position
widthwidth of the check box
checkeddefault value of the check box

◆ Circle()

void wxPdfDocument::Circle ( double  x0,
double  y0,
double  r,
double  astart = 0,
double  afinish = 360,
int  style = wxPDF_STYLE_DRAW,
int  nSeg = 8 
)
virtualinherited

Draws a circle.

Parameters
x0Abscissa of Center point
y0Ordinate of Center point
rRadius
astartStart angle
afinishFinish angle
styleStyle of rectangle (draw and/or fill)
nSegCircle is made up of nSeg Bézier curves
Example
// Full circle
pdf.Circle(25, 105, 20);
// Lower semi-arc, filled
pdf.Circle(25, 105, 10, 270, 360, wxPDF_STYLE_FILL);
#define wxPDF_STYLE_FILL
Fill the path.
Definition: pdfproperties.h:38
See also
Ellipse(), Sector()

◆ ClearFallbackFonts()

void wxPdfDocument::ClearFallbackFonts ( )
virtualinherited

Removes all fonts from the list of fallback fonts.

Note
This does not affect SetSystemFontFallback().

◆ ClearGraphicState()

void wxPdfDocument::ClearGraphicState ( )
protectedvirtualinherited

Discards all saved graphic states.

Empties the entire SaveGraphicState() stack without restoring any values. Called internally when a new page begins.

See also
SaveGraphicState()

◆ ClippedCell()

void wxPdfDocument::ClippedCell ( double  w,
double  h = 0.,
const wxString &  txt = wxEmptyString,
int  border = wxPDF_BORDER_NONE,
int  ln = 0,
int  align = wxPDF_ALIGN_LEFT,
int  fill = 0,
const wxPdfLink &  link = wxPdfLink(-1) 
)
virtualinherited

Prints a cell clipped to a rectangular area.

The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.

Parameters
wCell width.
hCell height.
txtString to print. Default value: empty string.
borderIndicates if borders must be drawn around the cell. The value can be
  • wxPDF_BORDER_NONE no border
  • wxPDF_BORDER_LEFT left border
  • wxPDF_BORDER_RIGHT right border
  • wxPDF_BORDER_TOP top border
  • wxPDF_BORDER_BOTTOM bottom border
  • wxPDF_BORDER_FRAME border on all sides
or a combination of them.
lnIndicates where the current position should go after the call. Possible values are:
  • 0: to the right
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
alignAllows to center or align the text. Possible values are:
  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • wxPDF_ALIGN_LEFT align the text at the left margin
  • wxPDF_ALIGN_CENTER center the text
  • wxPDF_ALIGN_RIGHT align the text at the right margin
  • wxPDF_ALIGN_JUSTIFY justify the text
fillIndicates if the cell background must be painted (1) or transparent (0). Default value: 0.
linkURL or identifier returned by AddLink().
Example
pdf.SetX(72);
pdf.ClippedCell(60, 6, wxS("This text is clipped to the cell width"), wxPDF_BORDER_FRAME);
#define wxPDF_BORDER_FRAME
Full frame border.
Definition: pdfproperties.h:25
See also
SetDrawColour(), SetFillColour(), SetTextColour(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak()

◆ ClippingEllipse()

void wxPdfDocument::ClippingEllipse ( double  x,
double  y,
double  rx,
double  ry = 0,
bool  outline = false 
)
virtualinherited

Define ellipse as clipping area.

A clipping area restricts the display and prevents any elements from showing outside of it.

Parameters
xAbscissa of the Center point
yOrdinate of the Center point
rxHorizontal radius
ryVertical radius (if ry = 0, draws a circle)
outlineDraw the outline or not. (Default false)
Example
pdf.ClippingEllipse(102, 104, 16, 10, true);
pdf.Image(wxS("background.jpg"), 40, 10, 130);
pdf.UnsetClipping();
See also
ClippingText(), ClippingRect(), ClippingPolygon(), ClippingPath(), UnsetClipping()

◆ ClippingPath() [1/2]

void wxPdfDocument::ClippingPath ( )
virtualinherited

Start defining a clipping path.

A clipping area restricts the display and prevents any elements from showing outside of it. The clipping path may consist of one or more subpaths.

Example
pdf.ClippingPath();
pdf.MoveTo(50, 50);
pdf.LineTo(150, 50);
pdf.LineTo(100, 120);
pdf.ClosePath(wxPDF_STYLE_DRAW);
pdf.Image(wxS("background.jpg"), 40, 30, 130);
pdf.UnsetClipping();
See also
UnsetClipping()

◆ ClippingPath() [2/2]

void wxPdfDocument::ClippingPath ( const wxPdfShape &  shape,
int  style = wxPDF_STYLE_NOOP 
)
virtualinherited

Define clipping area using a shape.

A clipping area restricts the display and prevents any elements from showing outside of it.

Parameters
shapeshape defining the clipping path
styleStyle of rendering. Possible values are:
  • wxPDF_STYLE_NOOP (default)
  • wxPDF_STYLE_DRAW: draw the outline of the clipping path
  • wxPDF_STYLE_FILL: fill the area enclosed by the clipping path
  • wxPDF_STYLE_FILLDRAW: draw and fill
Example
wxPdfShape shape;
shape.MoveTo(135, 140);
shape.CurveTo(135, 137, 130, 125, 110, 125);
shape.CurveTo(80, 125, 80, 162.5, 80, 162.5);
shape.CurveTo(80, 180, 100, 202, 135, 220);
pdf.SetFillColour(wxPdfColour(wxString(wxS("red"))));
pdf.ClippingPath(shape, wxPDF_STYLE_FILLDRAW);
pdf.UnsetClipping();
Class representing a shape consisting of line and curve segments.
Definition: pdfshape.h:34
void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
Add a cubic Bézier curve to the shape.
Definition: pdfgraphics.cpp:178
void MoveTo(double x, double y)
Begin a new subpath of the shape.
Definition: pdfgraphics.cpp:153
#define wxPDF_STYLE_FILLDRAW
Fill and draw (stroke) the path.
Definition: pdfproperties.h:39
See also
ClippingPath(), UnsetClipping()

◆ ClippingPolygon()

void wxPdfDocument::ClippingPolygon ( const wxPdfArrayDouble &  x,
const wxPdfArrayDouble &  y,
bool  outline = false 
)
virtualinherited

Define polygon as clipping area.

A clipping area restricts the display and prevents any elements from showing outside of it.

Parameters
xArray with abscissa values
yArray with ordinate values
outlineDraw the outline or not. (Default false)
Example
wxPdfArrayDouble x, y;
x.Add(30); y.Add(135);
x.Add(60); y.Add(155);
x.Add(40); y.Add(155);
x.Add(70); y.Add(160);
x.Add(30); y.Add(165);
pdf.ClippingPolygon(x, y, true);
pdf.Image(wxS("background.jpg"), 20, 100, 130);
pdf.UnsetClipping();
See also
ClippingText(), ClippingRect(), ClippingEllipse(), ClippingPath(), UnsetClipping()

◆ ClippingRect()

void wxPdfDocument::ClippingRect ( double  x,
double  y,
double  w,
double  h,
bool  outline = false 
)
virtualinherited

Define rectangle as clipping area.

A clipping area restricts the display and prevents any elements from showing outside of it.

Parameters
xAbscissa of the upper-left corner
yOrdinate of the upper-left corner
wWidth of the rectangle
hHeight of the rectangle
outlineDraw the outline or not.
Example
pdf.ClippingRect(45, 65, 116, 20, true);
pdf.Image(wxS("background.jpg"), 40, 10, 130);
pdf.UnsetClipping();
See also
ClippingText(), ClippingEllipse(), ClippingPolygon(), ClippingPath(), UnsetClipping()

◆ ClippingText()

void wxPdfDocument::ClippingText ( double  x,
double  y,
const wxString &  txt,
bool  outline = false 
)
virtualinherited

Define text as clipping area.

A clipping area restricts the display and prevents any elements from showing outside of it.

Parameters
xAbscissa of the origin
yOrdinate of the origin
txtString to print
outlineDraw the outline or not.
Example
// Fill large text with an image
pdf.SetDrawColour(0);
pdf.SetLineWidth(2);
pdf.ClippingText(40, 55, wxS("CLIPS"), true);
pdf.Image(wxS("background.jpg"), 40, 10, 130);
pdf.UnsetClipping();
See also
ClippingRect(), ClippingEllipse(), ClippingPolygon(), ClippingPath(), UnsetClipping()

◆ Close()

void wxPdfDocument::Close ( )
virtualinherited

Terminates the PDF document.

It is not necessary to call this method explicitly because SaveAsFile() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document.

See also
Open(), SaveAsFile()

◆ CloseAndGetBuffer()

const wxMemoryOutputStream & wxPdfDocument::CloseAndGetBuffer ( )
virtualinherited

Closes the document and returns the memory buffer containing the document.

The method first calls Close() if necessary to terminate the document.

Returns
const wxMemoryOutputStream reference to the buffer containing the PDF document.
See also
Close()

◆ ClosedBezierSpline()

void wxPdfDocument::ClosedBezierSpline ( const wxPdfArrayDouble &  x,
const wxPdfArrayDouble &  y,
int  style 
)
virtualinherited

Draws a closed Bézier spline through a list of points.

Parameters
xArray with abscissa values
yArray with ordinate values
styleStyle of the spline (draw and/or fill)
Example
wxPdfArrayDouble x, y;
x.Add(20); y.Add(40);
x.Add(50); y.Add(20);
x.Add(80); y.Add(40);
x.Add(50); y.Add(60);
pdf.ClosedBezierSpline(x, y, wxPDF_STYLE_DRAW);
See also
BezierSpline(), Curve()

◆ ClosePath()

void wxPdfDocument::ClosePath ( int  style = wxPDF_STYLE_NOOP)
virtualinherited

Close the clipping path.

A clipping area restricts the display and prevents any elements from showing outside of it.

Parameters
styleStyle of rendering. Possible values are:
  • wxPDF_STYLE_NOOP (default)
  • wxPDF_STYLE_DRAW: draw the outline of the clipping path
  • wxPDF_STYLE_FILL: fill the area enclosed by the clipping path
  • wxPDF_STYLE_FILLDRAW: draw and fill
See also
MoveTo(), LineTo(), CurveTo(), EndPath()

◆ ComboBox() [1/2]

void wxPdfDocument::ComboBox ( const wxString &  name,
double  width,
double  height,
const wxArrayString &  values 
)
virtualinherited

Adds a combo box field at the current position.

Adds a combo box to the list of form fields at the current position

Parameters
namefield name of the combo box
widthwidth of the combo box
heightheight of the combo box
valuesarray of option values of the combo box

◆ ComboBox() [2/2]

void wxPdfDocument::ComboBox ( const wxString &  name,
double  x,
double  y,
double  width,
double  height,
const wxArrayString &  values 
)
virtualinherited

Adds a combo box field.

Adds a combo box to the list of form fields

Parameters
namefield name of the combo box
xabscissa of the combo box position
yordinate of the combo box position
widthwidth of the combo box
heightheight of the combo box
valuesarray of option values of the combo box

◆ CoonsPatchGradient()

int wxPdfDocument::CoonsPatchGradient ( const wxPdfCoonsPatchMesh &  mesh,
double  minCoord = 0,
double  maxCoord = 1 
)
virtualinherited

Defines a coons patch mesh gradient shading.

Parameters
meshcoons patch mesh to be used for the gradient
minCoordminimal coordinate of the mesh
maxCoordmaximal coordinate of the mesh
Example
wxPdfColour colors[] = { wxPdfColour(255,255,0), wxPdfColour(0,0,255),
wxPdfColour(0,255,0), wxPdfColour(255,0,0) };
double cx[] = { 0.00, 0.33, 0.67, 1.00, 1.00, 1.00, 1.00, 0.67, 0.33, 0.00, 0.00, 0.00 };
double cy[] = { 0.00, 0.00, 0.00, 0.00, 0.33, 0.67, 1.00, 1.00, 1.00, 1.00, 0.67, 0.33 };
mesh.AddPatch(0, colors, cx, cy);
int grad = pdf.CoonsPatchGradient(mesh);
pdf.SetFillGradient(20, 115, 80, 80, grad);
Class representing a coons patch mesh.
Definition: pdfcoonspatchmesh.h:24
bool AddPatch(int edgeFlag, wxPdfColour colours[], double x[], double y[])
Add patch to mesh.
Definition: pdfgradient.cpp:123
See also
LinearGradient(), AxialGradient(), MidAxialGradient(), RadialGradient(), SetFillGradient()

◆ Curve()

void wxPdfDocument::Curve ( double  x0,
double  y0,
double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
int  style = wxPDF_STYLE_DRAW 
)
virtualinherited

Draws a Bézier curve.

A Bézier curve is tangent to the line between the control points at either end of the curve.

Parameters
x0Abscissa of start point
y0Ordinate of start point
x1Abscissa of control point 1
y1Ordinate of control point 1
x2Abscissa of control point 2
y2Ordinate of control point 2
x3Abscissa of end point
y3Ordinate of end point
styleStyle of rectangle (draw and/or fill)
Example
pdf.SetDrawColour(wxColour(0, 255, 0));
pdf.Curve(5, 40, 30, 55, 70, 45, 60, 75, wxPDF_STYLE_DRAW);
pdf.SetFillColour(wxColour(200, 220, 200));
pdf.Curve(140, 40, 150, 55, 180, 45, 200, 75, wxPDF_STYLE_FILLDRAW);
See also
BezierSpline(), ClosedBezierSpline(), ShapedText()

◆ CurveTo()

void wxPdfDocument::CurveTo ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)
virtualinherited

Append a cubic Bézier curve to the current (sub)path.

Append a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bézier control points. The new current point is (x3, y3).

Parameters
x1Abscissa of control point 1
y1Ordinate of control point 1
x2Abscissa of control point 2
y2Ordinate of control point 2
x3Abscissa of end point
y3Ordinate of end point
See also
MoveTo(), LineTo(), EndPath(), ClosePath()

◆ DoCell()

void wxPdfDocument::DoCell ( double  w,
double  h = 0.,
const wxString &  txt = wxEmptyString,
int  border = wxPDF_BORDER_NONE,
int  ln = 0,
int  align = wxPDF_ALIGN_LEFT,
int  fill = 0,
const wxPdfLink &  link = wxPdfLink(-1) 
)
protectedvirtualinherited

Prints a cell (rectangular area) with optional borders, background colour and character string.

Note
This method expects the text already to be preprocessed in respect to visual layout.

◆ DoGetStringWidth()

double wxPdfDocument::DoGetStringWidth ( const wxString &  s,
double  charSpacing = 0 
)
protectedvirtualinherited

Returns the length of a string in user unit.

A font must be selected.

Parameters
sThe string whose length is to be computed
charSpacingExtra amount of spacing between characters (optional)
Returns
int
Note
This method expects the text already to be preprocessed in respect to visual layout.

◆ Ellipse()

void wxPdfDocument::Ellipse ( double  x0,
double  y0,
double  rx,
double  ry = 0,
double  angle = 0,
double  astart = 0,
double  afinish = 360,
int  style = wxPDF_STYLE_DRAW,
int  nSeg = 8,
bool  doSector = false 
)
virtualinherited

Draws an ellipse.

Parameters
x0Abscissa of Center point
y0Ordinate of Center point
rxHorizontal radius
ryVertical radius (if ry = 0, draws a circle)
angleOrientation angle (anti-clockwise)
astartStart angle
afinishFinish angle
styleStyle of rectangle (draw and/or fill)
nSegEllipse is made up of nSeg Bézier curves
doSectorconnect end points of elliptic arc with center point
Example
// Full ellipse
pdf.Ellipse(100, 105, 40, 20);
// Partial arc of a rotated ellipse, filled
pdf.Ellipse(175, 105, 30, 15, 45, 270, 360, wxPDF_STYLE_FILLDRAW);
See also
Circle(), Sector()

◆ EndArtifact()

void wxPdfDocument::EndArtifact ( )
virtualinherited

End an artifact.

See also
BeginArtifact()

◆ EndFormula()

void wxPdfDocument::EndFormula ( )
inlineinherited

End a mathematical formula.

Equivalent to EndTag().

See also
BeginFormula()

◆ EndPage()

void wxPdfDocument::EndPage ( )
protectedvirtualinherited

End of page contents.

See also
BeginPage()

◆ EndPath()

void wxPdfDocument::EndPath ( int  style = wxPDF_STYLE_DRAW)
virtualinherited

End a graphics path.

Parameters
styleStyle of rendering. Possible values are:
  • wxPDF_STYLE_NOOP
  • wxPDF_STYLE_DRAW: draw the outline of the path (default)
  • wxPDF_STYLE_FILL: fill the area enclosed by the path
  • wxPDF_STYLE_FILLDRAW: draw and fill
See also
MoveTo(), LineTo(), CurveTo(), ClosePath()

◆ EndTag()

void wxPdfDocument::EndTag ( )
virtualinherited

End the innermost open structure element.

See also
BeginTag()

◆ EndTemplate()

int wxPdfDocument::EndTemplate ( )
virtualinherited

Terminates a template.

Terminates the creation of a template and reset initiated variables on beginTemplate.

Returns
If a template was under construction, its ID is returned, otherwise a 0 is returned.
See also
BeginTemplate(), UseTemplate()

◆ EnterLayer()

void wxPdfDocument::EnterLayer ( wxPdfLayer *  layer)
virtualinherited

Enter a layer.

Begins a graphic block whose visibility is controlled by the layer. Blocks can be nested. Each block must be terminated by LeaveLayer().

Note that nested layers only require a single call to this method and a single call to LeaveLayer(); all the nesting control is built in.

Parameters
layerthe layer
Example
wxPdfLayer* l1 = pdf.AddLayer(wxS("Layer 1"));
wxPdfLayer* l2 = pdf.AddLayer(wxS("Layer 2"));
pdf.EnterLayer(l1);
pdf.Cell(0, 6, wxS("Text in layer 1"));
pdf.LeaveLayer();
pdf.EnterLayer(l2);
pdf.Cell(0, 6, wxS("Text in layer 2"));
pdf.LeaveLayer();
See also
LeaveLayer(), AddLayer(), AddLayerMembership()

◆ FindEmbeddableFont()

wxPdfFont wxPdfDocument::FindEmbeddableFont ( const wxString &  family,
int  style 
)
protectedinherited

Find an embeddable font for a family that is not registered (embed-all-fonts mode)

Used if a font family requested by name is not registered with the requested style, for example to select the bold style of a replacement font family that was located via the operating system. The result (including failure) is cached per document.

Parameters
familythe requested font family
stylethe requested font style
Returns
the embeddable font, or an invalid font if none was found

◆ FindFallbackSlot()

int wxPdfDocument::FindFallbackSlot ( wxUint32  codePoint,
const wxString &  chr 
)
protectedinherited

Find the fallback font slot for a single code point.

Parameters
codePointthe Unicode code point
chrthe code point as a string (one or two UTF-16 code units)
Returns
the slot index or -1 if no fallback font contains the glyph

◆ Footer()

virtual void HeaderFooterDocument::Footer ( )
inlinevirtual

This method is used to render the page footer.

It is automatically called by AddPage() and Close() and should not be called directly by the application. The implementation in wxPdfDocument is empty, so you have to subclass it and override the method if you want a specific processing.

See also
Header()

Reimplemented from wxPdfDocument.

◆ GetBreakMargin()

double wxPdfDocument::GetBreakMargin ( )
virtualinherited

Returns the page break margin.

Returns
int page break margin.

◆ GetCellMargin()

double wxPdfDocument::GetCellMargin ( )
virtualinherited

Returns the cell margin.

Returns
double cell margin.

◆ GetCurrentFont()

wxPdfFont wxPdfDocument::GetCurrentFont ( ) const
virtualinherited

Returns the current font.

Returns
The current font.
See also
SetFont()

◆ GetDefaultPageOrientation()

int wxPdfDocument::GetDefaultPageOrientation ( )
virtualinherited

Returns the default page orientation.

Returns
page orientation.

◆ GetDrawColour()

const wxPdfColour wxPdfDocument::GetDrawColour ( )
virtualinherited

Gets the colour used for all drawing operations.

See also
SetDrawColour()

◆ GetEmbedAllFonts()

virtual bool wxPdfDocument::GetEmbedAllFonts ( ) const
inlinevirtualinherited

Returns whether all fonts used in the document have to be embedded.

Returns
true if all fonts will be embedded, false otherwise
Note
This reflects the setting of SetEmbedAllFonts() only; PDF/A-1 conformance implies embedding of all fonts in any case.

◆ GetFillColour()

const wxPdfColour wxPdfDocument::GetFillColour ( )
virtualinherited

Gets the colour used for all filling operations.

See also
SetFillColour()

◆ GetFillingRule()

int wxPdfDocument::GetFillingRule ( )
virtualinherited

Get the current filling rule.

Returns
the current filling rule

◆ GetFontDescription()

const wxPdfFontDescription & wxPdfDocument::GetFontDescription ( ) const
virtualinherited

Returns the current font description instance.

Returns
The current font description.
See also
SetFont()

◆ GetFontFamily()

const wxString wxPdfDocument::GetFontFamily ( )
virtualinherited

Gets the font family of the current font.

Returns
The font family of the current font
See also
SetFont()

◆ GetFontSize()

double wxPdfDocument::GetFontSize ( ) const
virtualinherited

Gets the size of the current font.

Returns
The size (in points) of the current font
See also
SetFont()

◆ GetFontStyle()

const wxString wxPdfDocument::GetFontStyle ( ) const
virtualinherited

Gets the style of the current font.

Returns
The style of the current font as a string. The string may contain any combination of the following characters:
  • B: bold
  • I: italic
  • U: underline
  • O: overline
  • S: strikethrough
  • T: thin
  • E: extra light
  • L: light
  • M: medium
  • D: demi / semi-bold
  • X: extra bold
  • H: heavy / black
  • A: extra heavy Granular weights (Thin to ExtraHeavy) are fully supported when using wxFont starting with wxWidgets 3.1.2. In older versions, they fall back to the closest standard weight (Bold or Regular).
See also
SetFont()

◆ GetFontStyles()

int wxPdfDocument::GetFontStyles ( ) const
virtualinherited

Gets the style of the current font.

Returns
The style of the current font
See also
SetFont()

◆ GetFontSubsetting()

virtual bool wxPdfDocument::GetFontSubsetting ( ) const
inlinevirtualinherited

Returns the font embedding mode.

Returns
true if font subsetting is enabled, false otherwise

◆ GetFontToEmbed()

wxPdfFont wxPdfDocument::GetFontToEmbed ( const wxPdfFont &  font,
int  style 
)
protectedinherited

Get the font to be used for a selected font, honouring the embed-all-fonts mode.

If all fonts have to be embedded (see SetEmbedAllFonts()), this returns an embeddable version of the font or an embeddable replacement. If neither exists, a warning is logged once per font and the font itself is returned.

Parameters
fontthe selected font
stylethe requested font style
Returns
the font to be used in the document

◆ GetHeaderHeight()

double wxPdfDocument::GetHeaderHeight ( ) const
protectedinherited
Returns
Get the height of the header at the top of the page

◆ GetImageScale()

double wxPdfDocument::GetImageScale ( )
virtualinherited

Returns the image scale.

Returns
image scale.

◆ GetImageSize()

wxSize wxPdfDocument::GetImageSize ( const wxString &  file,
const wxString &  mimeType = wxEmptyString 
)
protectedvirtualinherited

Get size of an image.

The size of the image is determined from the given graphics file.

Parameters
fileName of the file containing the image.
mimeTypeImage format. Possible values are: image/jpeg, image/png, image/gif, image/wmf.
Returns
width and height of the image

◆ GetLanguage()

const wxString & wxPdfDocument::GetLanguage ( ) const
inlineinherited

Get the natural language of the document.

Returns
the language tag set by SetLanguage()

◆ GetLastImageBottomRightX()

virtual double wxPdfDocument::GetLastImageBottomRightX ( )
inlinevirtualinherited

Get x coordinate of bottom right corner of last inserted image.

Returns
The x coordinate in user units

◆ GetLastImageBottomRightY()

virtual double wxPdfDocument::GetLastImageBottomRightY ( )
inlinevirtualinherited

Get y coordinate of bottom right corner of last inserted image.

Returns
The y coordinate in user units

◆ GetLeftMargin()

double wxPdfDocument::GetLeftMargin ( )
virtualinherited

Returns the left margin.

Returns
double left margin.

◆ GetLineHeight()

double wxPdfDocument::GetLineHeight ( )
virtualinherited

Returns the height of a text line.

Returns
double line height

◆ GetLineStyle()

const wxPdfLineStyle & wxPdfDocument::GetLineStyle ( )
virtualinherited

Get current line style.

Returns
current line style.

◆ GetLineWidth()

double wxPdfDocument::GetLineWidth ( )
virtualinherited

Gets the current line width.

Returns
current line width
See also
Line(), Rect(), Cell(), MultiCell()

◆ GetMessageTranslateMode()

bool wxPdfDocument::GetMessageTranslateMode ( )
inlineinherited

Get message translation mode.

Gets the message translation mode which controls the handling of msg tags in XML output

Returns
true if messages are translated, false otherwise

◆ GetPageHeight()

double wxPdfDocument::GetPageHeight ( )
virtualinherited

Returns the page height in units.

Returns
int page height.

◆ GetPageOrientation()

int wxPdfDocument::GetPageOrientation ( )
virtualinherited

Returns the page orientation.

Returns
page orientation.

◆ GetPageWidth()

double wxPdfDocument::GetPageWidth ( )
virtualinherited

Returns the page width in units.

Returns
int page width.

◆ GetPatternColour()

const wxPdfColour wxPdfDocument::GetPatternColour ( const wxString &  patternName)
virtualinherited

Gets the named pattern as a colour.

Parameters
patternNamethe name of the pattern
See also
SetDrawPattern(), SetFillPattern(), AddPattern()

◆ GetPdfA1Conformance()

bool wxPdfDocument::GetPdfA1Conformance ( ) const
inlineinherited

Get PDF/A-1b conformance.

Gets the document conformance intent for PDF/A-1 Level B

Returns
flag whether PDF/A-1b conformance is enabled

◆ GetRightMargin()

double wxPdfDocument::GetRightMargin ( )
virtualinherited

Returns the right margin.

Returns
double right margin.

◆ GetScaleFactor()

double wxPdfDocument::GetScaleFactor ( )
virtualinherited

Returns the scale factor (number of points in user unit).

Returns
int scale factor.

◆ GetSourceInfo()

bool wxPdfDocument::GetSourceInfo ( wxPdfInfo &  info)
virtualinherited

Gets the document information dictionary of the current external PDF document.

Gets the values of the Info dictionary of the current external document, if available.

Parameters
infothe info dictionary object receiving the document information
Returns
true if the info dictionary was available, false otherwise
See also
SetSourceFile()

◆ GetStringWidth()

double wxPdfDocument::GetStringWidth ( const wxString &  s,
double  charSpacing = 0 
)
virtualinherited

Returns the length of a string in user unit.

A font must be selected.

Parameters
sThe string whose length is to be computed
charSpacingExtra amount of spacing between characters (optional)
Returns
int
Example
// Measure the title to center it precisely and draw a coloured framed cell
pdf.AddPage();
pdf.SetFont(wxS("Helvetica"), wxS("B"), 15);
wxString title = wxS("20000 Leagues Under the Seas");
double w = pdf.GetStringWidth(title) + 6;
pdf.SetX((210 - w) / 2);
pdf.SetDrawColour(wxColour(0, 80, 180));
pdf.SetFillColour(wxColour(230, 230, 0));
pdf.SetTextColour(wxColour(220, 50, 50));
pdf.SetLineWidth(1);
pdf.Cell(w, 9, title, wxPDF_BORDER_FRAME, 1, wxPDF_ALIGN_CENTER, 1);
pdf.SaveAsFile(wxS("output.pdf"));
virtual void SetLineWidth(double width)
Defines the line width.
Definition: pdfdocument.cpp:837
virtual double GetStringWidth(const wxString &s, double charSpacing=0)
Returns the length of a string in user unit.
Definition: pdfdocument.cpp:1104
virtual bool SetFont(const wxString &family, const wxString &style=wxEmptyString, double size=0)
Sets the font used to print character strings.
Definition: pdfdocument.cpp:895
virtual void SetX(double x)
Defines the abscissa of the current position.
Definition: pdfdocument.cpp:2546
virtual void SetDrawColour(const unsigned char grayscale)
Defines the colour used for all drawing operations.
Definition: pdfdocument.cpp:3052
virtual void SetTextColour(const unsigned char grayscale)
Defines the colour used for text.
Definition: pdfdocument.cpp:3260
virtual void Cell(double w, double h=0., const wxString &txt=wxEmptyString, int border=wxPDF_BORDER_NONE, int ln=0, int align=wxPDF_ALIGN_LEFT, int fill=0, const wxPdfLink &link=wxPdfLink(-1))
Prints a cell (rectangular area) with optional borders, background colour and character string.
Definition: pdfdocument.cpp:1228
virtual void SetFillColour(const unsigned char grayscale)
Defines the colour used for all filling operations.
Definition: pdfdocument.cpp:3147
@ wxPDF_ALIGN_CENTER
Center alignment (or middle alignment for vertical)
Definition: pdfproperties.h:166

◆ GetSystemFontFallback()

bool wxPdfDocument::GetSystemFontFallback ( ) const
virtualinherited

Checks whether fallback fonts are searched among the installed system fonts.

Returns
true if SetSystemFontFallback() was enabled, false otherwise

◆ GetTagDepth()

int wxPdfDocument::GetTagDepth ( ) const
inherited

Get the number of currently open structure elements.

Returns
the nesting depth of BeginTag() calls; 0 if no structure element is open or tagging is disabled

◆ GetTemplateBBox()

void wxPdfDocument::GetTemplateBBox ( int  templateId,
double &  x,
double &  y,
double &  width,
double &  height 
)
virtualinherited

Gets the bounding box of a template.

Especially for pages imported from an external PDF document the size of the bounding box might be of interest. The values returned correspond to the coordinates of the lower left corner and the width and height of the template.

Parameters
templateIdA valid template ID
xThe x coordinate of the lower left corner
yThe y coordinate of the lower left corner
widthThe width of the template
heightThe height of the template
See also
SetTemplateBBox(), BeginTemplate(), ImportPage()

◆ GetTemplateSize()

void wxPdfDocument::GetTemplateSize ( int  templateId,
double &  width,
double &  height 
)
virtualinherited

Get the calculated size of a template.

Retrieves the size of a template.

Parameters
templateIdA valid template ID
widthThe width of the template
heightThe height of the template
See also
BeginTemplate(), EndTemplate(), UseTemplate(), ImportPage()
Attention
The width and/or height parameters have to be set to a value <= 0 prior to calling this method, otherwise they will not be calculated. If one dimension, i.e. width, is passed with a value > 0, the other one, i.e. height, is calculated accordingly.

◆ GetTextColour()

const wxPdfColour wxPdfDocument::GetTextColour ( )
virtualinherited

Gets the colour used for text output.

See also
SetTextColour()

◆ GetTextRenderMode()

wxPdfTextRenderMode wxPdfDocument::GetTextRenderMode ( ) const
virtualinherited

Returns the text render mode.

Returns
The current text render mode

◆ GetTopMargin()

double wxPdfDocument::GetTopMargin ( )
virtualinherited

Returns the top margin.

Returns
double top margin.

◆ GetX()

double wxPdfDocument::GetX ( )
virtualinherited

Returns the abscissa of the current position.

Returns
float
See also
SetX(), GetY(), SetY()

◆ GetY()

double wxPdfDocument::GetY ( )
virtualinherited

Returns the ordinate of the current position.

Returns
float
See also
SetY(), GetX(), SetX()

◆ Header()

virtual void HeaderFooterDocument::Header ( )
inlinevirtual

This method is used to render the page header.

It is automatically called by AddPage() and should not be called directly by the application. The implementation in wxPdfDocument is empty, so you have to subclass it and override the method if you want a specific processing.

Example
class MyDocument : public wxPdfDocument
{
void Header() override
{
// Logo at top-left, then a framed title cell
Image(wxS("logo.png"), 10, 8, 28);
SetFont(wxS("Helvetica"), wxS("B"), 15);
Cell(80);
Cell(30, 10, wxS("My Report"), wxPDF_BORDER_FRAME, 0, wxPDF_ALIGN_CENTER);
Ln(20);
}
void Footer() override
{
// Position 15mm from the bottom of the page
SetY(-15);
SetFont(wxS("Helvetica"), wxS("I"), 8);
Cell(0, 10, wxString::Format(wxS("Page %d/{nb}"), PageNo()),
}
};
MyDocument pdf;
pdf.AliasNbPages();
pdf.AddPage();
// ... add content ...
pdf.SaveAsFile(wxS("report.pdf"));
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:148
Manages an auto-scaling image.
Definition: Image.h:70
#define wxPDF_BORDER_NONE
Border options.
Definition: pdfproperties.h:20
See also
Footer()

Reimplemented from wxPdfDocument.

◆ Image() [1/3]

bool wxPdfDocument::Image ( const wxString &  file,
double  x,
double  y,
double  w = 0,
double  h = 0,
const wxString &  mimeType = wxEmptyString,
const wxPdfLink &  link = wxPdfLink(-1),
int  maskImage = 0 
)
virtualinherited

Puts an image in the page.

The upper-left corner must be given. The dimensions can be specified in different ways:

  • explicit width and height (expressed in user unit)
  • one explicit dimension, the other being calculated automatically in order to keep the original proportions
  • no explicit dimension, in which case the image is put at 72 dpi

Supported formats are JPEG, PNG, GIF and WMF. For JPEG, all flavors are allowed:

  • gray scales,
  • true colours (24 bits),
  • CMYK (32 bits)

For PNG, the following flavors are allowed:

  • gray scales on at most 8 bits (256 levels)
  • indexed colours
  • true colours (24 bits)

but the following options are not supported:

  • Interlacing
  • Alpha channel

If a transparent colour is defined, it will be taken into account (but will be only interpreted by Acrobat 4 and above).

For GIF, all flavors the wxWidgets GIF decoder is able to handle are supported

For WMF: WMF files contain vector data described in terms of Windows Graphics Device Interface (GDI) commands. There are approximately 80 different GDI commands allowed for in the WMF standard. This method interprets only a small subset of these, but is sufficient to display most WMF images. Please feel free to add further functionality.

The format can be specified explicitly or inferred from the file extension.

It is possible to put a link on the image.

Remark: if an image is used several times, only one copy will be embedded in the file.

Parameters
fileName of the file containing the image.
xAbscissa of the upper-left corner.
yOrdinate of the upper-left corner.
wWidth of the image in the page. If not specified or equal to zero, it is automatically calculated.
hHeight of the image in the page. If not specified or equal to zero, it is automatically calculated.
mimeTypeImage format. Possible values are: image/jpeg, image/png, image/gif, image/wmf. If not specified, the type is inferred from the file extension.
linkURL or identifier returned by AddLink().
maskImageId of an image mask created previously by ImageMask().
See also
AddLink()

◆ Image() [2/3]

bool wxPdfDocument::Image ( const wxString &  name,
const wxImage &  image,
double  x,
double  y,
double  w = 0,
double  h = 0,
const wxPdfLink &  link = wxPdfLink(-1),
int  maskImage = 0,
bool  jpegFormat = false,
int  jpegQuality = 75 
)
virtualinherited

Puts an image in the page The image is given by a wxImage-Object.

Parameters
nameName of the image to be used as an identifier for this image object.
imagewxImage object which will be embedded as PNG
xAbscissa of the upper-left corner.
yOrdinate of the upper-left corner.
wWidth of the image in the page. If not specified or equal to zero, it is automatically calculated.
hHeight of the image in the page. If not specified or equal to zero, it is automatically calculated.
linkURL or identifier returned by AddLink().
maskImageId of an image mask created previously by ImageMask().
jpegFormatSwitch whether to save image as JPEG (true) or PNG (false, default).
jpegQualityQuality in case of JPEG format (0 = poor, 100 = best, default 75).

◆ Image() [3/3]

bool wxPdfDocument::Image ( const wxString &  name,
wxInputStream &  stream,
const wxString &  mimeType,
double  x,
double  y,
double  w = 0,
double  h = 0,
const wxPdfLink &  link = wxPdfLink(-1),
int  maskImage = 0 
)
virtualinherited

Puts an image in the page The image is given by a wxInputStream-Object containing the raw image data.

Parameters
nameName of the image to be used as an identifier for this image object.
streamwxInputStream object containing the raw image data
mimeTypeImage format. Possible values are: image/jpeg, image/png, image/gif, image/wmf.
xAbscissa of the upper-left corner.
yOrdinate of the upper-left corner.
wWidth of the image in the page. If not specified or equal to zero, it is automatically calculated.
hHeight of the image in the page. If not specified or equal to zero, it is automatically calculated.
linkURL or identifier returned by AddLink().
maskImageId of an image mask created previously by ImageMask().

◆ ImageMask() [1/3]

int wxPdfDocument::ImageMask ( const wxString &  file,
const wxString &  mimeType = wxEmptyString 
)
virtualinherited

Prepares an image for use as an image mask The image is given as the name of the file containing the image.

Parameters
fileName of the file containing the image.
mimeTypeImage format. Possible values are: image/jpeg, image/png, image/gif, image/wmf.
Returns
id of the image mask, or 0 in case of an error

◆ ImageMask() [2/3]

int wxPdfDocument::ImageMask ( const wxString &  name,
const wxImage &  image 
)
virtualinherited

Prepares an image for use as an image mask The image is given by an wxImage-Object.

Parameters
nameName of the image.
imagewxImage object.
Returns
id of the image mask, or 0 in case of an error

◆ ImageMask() [3/3]

int wxPdfDocument::ImageMask ( const wxString &  name,
wxInputStream &  stream,
const wxString &  mimeType 
)
virtualinherited

Prepares an image for use as an image mask The image is given by an wxInputStream-Object containing the raw image data.

Parameters
nameName of the image.
streamwxInputStream object containing the raw image data
mimeTypeImage format. Possible values are: image/jpeg, image/png, image/gif, image/wmf.
Returns
id of the image mask, or 0 in case of an error

◆ ImportPage()

int wxPdfDocument::ImportPage ( unsigned int  pageno,
wxPdfPageBox  pageBox = wxPDF_PAGEBOX_ARTBOX 
)
virtualinherited

Imports a page from an external PDF document.

Imports a page from the current external PDF document. As the bounding box of the template the ArtBox of the imported page is used. If the page does not have an explicit ArtBox, the CropBox will be used instead; if there is no explicit CropBox then the MediaBox will be used.

Parameters
pagenopage number of the page to be imported
pageBoxpage box which should be used (default: ArtBox)
Returns
Index of imported page - for use in UseTemplate(). A value of 0 is returned if the page number is out of range or no source was selected.
See also
SetSourceFile()

◆ Initialize()

void wxPdfDocument::Initialize ( int  orientation)
protectedvirtualinherited

Initialize the document.

Parameters
orientationInitial page orientation

◆ IsInFooter()

bool wxPdfDocument::IsInFooter ( )
virtualinherited

Returns whether footer output is in progress.

Returns
true if footer output is in progress, false otherwise
See also
Header(), Footer()

◆ IsTagged()

bool wxPdfDocument::IsTagged ( ) const
inlineinherited

Check whether tagged PDF output is enabled.

Returns
TRUE if tagged PDF output is enabled, FALSE otherwise
See also
SetTagged()

◆ LeaveLayer()

void wxPdfDocument::LeaveLayer ( )
virtualinherited

Leave a layer.

Ends a layer controlled graphic block. It will end the most recent open block.

See also
EnterLayer()

◆ Line()

void wxPdfDocument::Line ( double  x1,
double  y1,
double  x2,
double  y2 
)
virtualinherited

Draws a line between two points.

Parameters
x1Abscissa of first point
y1Ordinate of first point
x2Abscissa of second point
y2Ordinate of second point
Example
pdf.SetDrawColour(wxColour(255, 0, 0));
pdf.SetLineWidth(0.5);
pdf.Line(5, 10, 80, 30);
See also
SetLineWidth(), SetDrawColour(), SetLineStyle(), Arrow()

◆ LinearGradient()

int wxPdfDocument::LinearGradient ( const wxPdfColour &  col1,
const wxPdfColour &  col2,
wxPdfLinearGradientType  gradientType = wxPDF_LINEAR_GRADIENT_HORIZONTAL 
)
virtualinherited

Defines a linear gradient shading.

Parameters
col1first colour (RGB or CMYK).
col2second colour (RGB or CMYK).
gradientTypeType of the gradient
Example
// Simple horizontal red-to-blue gradient
int grad = pdf.LinearGradient(wxPdfColour(255, 0, 0), wxPdfColour(0, 0, 255));
pdf.SetFillGradient(10, 10, 90, 90, grad);
// Vertical reflection gradient
wxPdfColour from(wxString(wxS("#440000")));
wxPdfColour to(wxString(wxS("#FF9090")));
int gradR = pdf.LinearGradient(from, to, wxPDF_LINEAR_GRADIENT_REFLECTION_TOP);
pdf.SetFillGradient(10, 110, 90, 20, gradR);
@ wxPDF_LINEAR_GRADIENT_REFLECTION_TOP
Reflection-top linear gradient.
Definition: pdfproperties.h:268
See also
AxialGradient(), MidAxialGradient(), RadialGradient(), CoonsPatchGradient(), SetFillGradient()

◆ LineCount()

int wxPdfDocument::LineCount ( double  w,
const wxString &  txt 
)
virtualinherited

This method counts the number of lines a text would occupy in respect to a given maximal width.

Parameters
wWidth of cells. If 0, they extend up to the right margin of the page.
txtString for which the number of lines is to be counted
Returns
Number of lines this text would occupy

◆ LineTo()

void wxPdfDocument::LineTo ( double  x,
double  y 
)
virtualinherited

Append a straight line segment to the current (sub)path.

Append a straight line segment from the current point to the point (x, y). The new current point is (x, y).

Parameters
xabscissa value
yordinate value
See also
MoveTo(), CurveTo(), EndPath(), ClosePath()

◆ Link()

void wxPdfDocument::Link ( double  x,
double  y,
double  w,
double  h,
const wxPdfLink &  link 
)
virtualinherited

Puts a link on a rectangular area of the page.

Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.

Parameters
xAbscissa of the upper-left corner of the rectangle
yOrdinate of the upper-left corner of the rectangle
wWidth of the rectangle
hHeight of the rectangle
linkURL or identifier returned by AddLink()
See also
AddLink(), Cell(), Write(), Image()

◆ Ln()

void wxPdfDocument::Ln ( double  h = -1)
virtualinherited

Performs a line break.

The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.

Parameters
hThe height of the break. By default, the value equals the height of the last printed cell.
See also
Cell()

◆ LockLayer()

void wxPdfDocument::LockLayer ( wxPdfLayer *  layer)
virtualinherited

Lock a layer.

Use this method to lock an optional content group. The state of a locked group cannot be changed through the user interface of a viewer application. Producers can use this entry to prevent the visibility of content that depends on these groups from being changed by users.

Parameters
layerthe layer that needs to be added to the array of locked OCGs
Example
wxPdfLayer* layer = pdf.AddLayer(wxS("Fixed Content"));
pdf.LockLayer(layer);
See also
AddLayer()

◆ Marker()

void wxPdfDocument::Marker ( double  x,
double  y,
wxPdfMarker  markerType,
double  size 
)
virtualinherited

Draws a graphical marker symbol.

Parameters
xabscissa of the marker's center
yordinate of the marker's center
markerTypetype of the marker
sizesize of the marker
Example
// Mark data points along a spline
wxPdfArrayDouble x, y;
x.Add(20); y.Add(40);
x.Add(50); y.Add(20);
x.Add(80); y.Add(40);
for (size_t i = 0; i < x.GetCount(); ++i)
pdf.Marker(x[i], y[i], wxPDF_MARKER_CIRCLE, 2.0);
pdf.BezierSpline(x, y, wxPDF_STYLE_DRAW);
@ wxPDF_MARKER_CIRCLE
Circle marker.
Definition: pdfproperties.h:214

◆ MidAxialGradient()

int wxPdfDocument::MidAxialGradient ( const wxPdfColour &  col1,
const wxPdfColour &  col2,
double  x1 = 0,
double  y1 = 0,
double  x2 = 1,
double  y2 = 0,
double  midpoint = 0.5,
double  intexp = 1 
)
virtualinherited

Defines an axial gradient shading with a configurable midpoint.

Parameters
col1first colour (RGB or CMYK).
col2second colour (RGB or CMYK).
x1start point of gradient vector, default: 0 (range 0 .. 1)
y1start point of gradient vector, default: 0 (range 0 .. 1)
x2end point of gradient vector, default: 1 (range 0 .. 1)
y2end point of gradient vector, default: 0 (range 0 .. 1)
midpointposition of the mirror point, default: 0.5 (range 0 .. 1)
intexpinterpolation exponent, default: 1
Example
wxPdfColour navy(wxString(wxS("navy")));
wxPdfColour lightsteelblue(wxString(wxS("lightsteelblue")));
// Horizontal gradient with midpoint shifted to 75%
int grad = pdf.MidAxialGradient(navy, lightsteelblue, 0, 0, 1, 0, 0.5, 0.75);
pdf.SetFillGradient(90, 200, 10, 20, grad);
See also
LinearGradient(), AxialGradient(), RadialGradient(), CoonsPatchGradient(), SetFillGradient()

◆ MirrorH() [1/2]

void wxPdfDocument::MirrorH ( )
virtualinherited

Performs a horizontal mirroring transformation.

Alias for scaling -100% in x-direction

Note
The current position is used as the scaling center.
See also
StartTransform(), StopTransform()

◆ MirrorH() [2/2]

void wxPdfDocument::MirrorH ( double  x)
virtualinherited

Performs a horizontal mirroring transformation.

Alias for scaling -100% in x-direction

Parameters
xabscissa of the axis of reflection
Example
// Mirror a rectangle about its left edge (x = 50)
pdf.StartTransform();
pdf.MirrorH(50);
pdf.Rect(50, 80, 40, 10, wxPDF_STYLE_DRAW);
pdf.StopTransform();
See also
StartTransform(), StopTransform()

◆ MirrorV() [1/2]

void wxPdfDocument::MirrorV ( )
virtualinherited

Performs a vertical mirroring transformation.

Alias for scaling -100% in y-direction

Note
The current position is used as the scaling center.
See also
StartTransform(), StopTransform()

◆ MirrorV() [2/2]

void wxPdfDocument::MirrorV ( double  y)
virtualinherited

Performs a vertical mirroring transformation.

Alias for scaling -100% in y-direction

Parameters
yabscissa of the axis of reflection
Example
// Mirror a rectangle about its bottom edge (y = 90)
pdf.StartTransform();
pdf.MirrorV(90);
pdf.Rect(125, 80, 40, 10, wxPDF_STYLE_DRAW);
pdf.StopTransform();
See also
StartTransform(), StopTransform()

◆ MoveTo()

void wxPdfDocument::MoveTo ( double  x,
double  y 
)
virtualinherited

Begin a new subpath.

Move to the starting point of a new (sub)path. The new current point is (x, y).

Parameters
xabscissa value
yordinate value
Remarks
This must be the first operation after ClippingPath().
See also
LineTo(), CurveTo(), EndPath(), ClosePath()

◆ MultiCell()

int wxPdfDocument::MultiCell ( double  w,
double  h,
const wxString &  txt,
int  border = 0,
int  align = wxPDF_ALIGN_JUSTIFY,
int  fill = 0,
int  maxline = 0 
)
virtualinherited

This method allows printing text with line breaks.

They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the
character). As many cells as necessary are output, one below the other. Text can be aligned, centered or justified. The cell block can be framed and the background painted.

Parameters
wWidth of cells. If 0, they extend up to the right margin of the page.
hHeight of cells.
txtString to print
borderIndicates if borders must be drawn around the cell. The value can be
  • wxPDF_BORDER_NONE no border
  • wxPDF_BORDER_LEFT left border
  • wxPDF_BORDER_RIGHT right border
  • wxPDF_BORDER_TOP top border
  • wxPDF_BORDER_BOTTOM bottom border
  • wxPDF_BORDER_FRAME border on all sides
or a combination of them.
alignAllows to center or align the text. Possible values are:
  • wxPDF_ALIGN_LEFT align the text at the left margin
  • wxPDF_ALIGN_CENTER center the text
  • wxPDF_ALIGN_RIGHT align the text at the right margin
  • wxPDF_ALIGN_JUSTIFY justify the text (default)
fillIndicates if the cell background must be painted (1) or transparent (0). Default value: 0.
maxlineDefines the maximum number of lines which should be printed. If maxline is 0 then the number of lines is not restricted. Default value: 0.
Returns
position in text string txt where output ended due to reaching the maximum number of lines
Example
// Output a long passage of text with automatic line breaks
// (justified by default)
pdf.AddPage();
pdf.SetFont(wxS("Times"), wxS(""), 12);
pdf.MultiCell(0, 5, longText);
pdf.Ln();
// Switch to italic for a closing note
pdf.SetFont(wxS(""), wxS("I"));
pdf.Cell(0, 5, wxS("(end of excerpt)"));
pdf.SaveAsFile(wxS("output.pdf"));
virtual void Ln(double h=-1)
Performs a line break.
Definition: pdfdocument.cpp:2204
virtual int MultiCell(double w, double h, const wxString &txt, int border=0, int align=wxPDF_ALIGN_JUSTIFY, int fill=0, int maxline=0)
This method allows printing text with line breaks.
Definition: pdfdocument.cpp:1404
See also
SetFont(), SetDrawColour(), SetFillColour(), SetTextColour(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak()

◆ Open()

void wxPdfDocument::Open ( )
virtualinherited

This method begins the generation of the PDF document.

It is not necessary to call it explicitly because AddPage() does it automatically. Note: no page is created by this method

See also
AddPage(), Close()

◆ OutIndirectObject()

void wxPdfDocument::OutIndirectObject ( wxPdfIndirectObject *  object)
protectedinherited

Add an indirect object to the document.

TODO: support for radio button groups

◆ PageNo()

int wxPdfDocument::PageNo ( )
virtualinherited

Returns the current page number.

Returns
page number
See also
AliasNbPages()

◆ Polygon()

void wxPdfDocument::Polygon ( const wxPdfArrayDouble &  x,
const wxPdfArrayDouble &  y,
int  style = wxPDF_STYLE_DRAW 
)
virtualinherited

Draws a polygon.

Parameters
xArray with abscissa values
yArray with ordinate values
styleStyle of polygon (draw and/or fill)
Example
wxPdfArrayDouble x, y;
x.Add(5); y.Add(135);
x.Add(45); y.Add(135);
x.Add(15); y.Add(165);
pdf.Polygon(x, y, wxPDF_STYLE_FILLDRAW);
See also
RegularPolygon(), StarPolygon()

◆ PushButton() [1/2]

void wxPdfDocument::PushButton ( const wxString &  name,
double  width,
double  height,
const wxString &  caption,
const wxString &  action 
)
virtualinherited

Adds a push button at the current position.

Adds a push button to the list of form fields at the current position

Parameters
namefield name of the push button
widthwidth of the push button
heightheight of the push button
captioncaption of the push button
actionassociated Javascript action

◆ PushButton() [2/2]

void wxPdfDocument::PushButton ( const wxString &  name,
double  x,
double  y,
double  width,
double  height,
const wxString &  caption,
const wxString &  action 
)
virtualinherited

Adds a push button.

Adds a push button to the list of form fields

Parameters
namefield name of the push button
xabscissa of the push button position
yordinate of the push button position
widthwidth of the push button
heightheight of the push button
captioncaption of the push button
actionassociated Javascript action

◆ RadialGradient()

int wxPdfDocument::RadialGradient ( const wxPdfColour &  col1,
const wxPdfColour &  col2,
double  x1 = 0.5,
double  y1 = 0.5,
double  r1 = 0,
double  x2 = 0.5,
double  y2 = 0.5,
double  r2 = 1,
double  intexp = 1 
)
virtualinherited

Defines a radial gradient shading.

Parameters
col1first colour (RGB or CMYK).
col2second colour (RGB or CMYK).
x1center point of circle 1, default: 0.5 (range 0 .. 1)
y1center point of circle 1, default: 0.5 (range 0 .. 1)
r1radius of circle 1, default: 0
x2center point of circle 2, default: 0.5 (range 0 .. 1)
y2center point of circle 2, default: 0.5 (range 0 .. 1)
r2radius of circle 2, default: 1
intexpinterpolation exponent, default: 1
Example
// White center fading to black, inner radius 0, outer radius 1.2
int grad = pdf.RadialGradient(wxPdfColour(255, 255, 255), wxPdfColour(0, 0, 0),
0.5, 0.5, 0, 1, 1, 1.2);
pdf.SetFillGradient(110, 10, 90, 90, grad);
See also
LinearGradient(), AxialGradient(), MidAxialGradient(), CoonsPatchGradient(), SetFillGradient()

◆ RadioButton() [1/2]

void wxPdfDocument::RadioButton ( const wxString &  group,
const wxString &  name,
double  width 
)
virtualinherited

Adds a radio button at the current position.

Adds a radio button to the list of form fields at the current position

Parameters
groupname of the radio button group this radio button belongs to
namefield name of the radio button
widthwidth of the radio button

◆ RadioButton() [2/2]

void wxPdfDocument::RadioButton ( const wxString &  group,
const wxString &  name,
double  x,
double  y,
double  width 
)
virtualinherited

Adds a radio button.

Adds a radio button to the list of form fields

Parameters
groupname of the radio button group this radio button belongs to
namefield name of the radio button
xabscissa of the radio button position
yordinate of the radio button position
widthwidth of the radio button

◆ Rect()

void wxPdfDocument::Rect ( double  x,
double  y,
double  w,
double  h,
int  style = wxPDF_STYLE_DRAW 
)
virtualinherited

Outputs a rectangle.

It can be drawn (border only), filled (with no border) or both.

Parameters
xAbscissa of upper-left corner
yOrdinate of upper-left corner
wWidth
hHeight
styleStyle of rendering. Possible values are:
  • wxPDF_STYLE_DRAW (default)
  • wxPDF_STYLE_FILL: fill
  • wxPDF_STYLE_FILLDRAW: draw and fill
Example
pdf.SetFillColour(wxColour(220, 220, 200));
pdf.Rect(100, 10, 40, 20, wxPDF_STYLE_FILLDRAW);
See also
SetLineWidth(), SetDrawColour(), SetFillColour(), RoundedRect()

◆ RegisterFontDetails()

wxPdfFontDetails * wxPdfDocument::RegisterFontDetails ( const wxPdfFont &  font)
protectedinherited

Make sure that a font is known to the document (and to the current template)

Assigns a resource index to the font if it is used for the first time.

Parameters
fontthe font to register
Returns
the font details of the font

◆ RegularPolygon()

void wxPdfDocument::RegularPolygon ( double  x0,
double  y0,
double  r,
int  ns,
double  angle = 0,
bool  circle = false,
int  style = wxPDF_STYLE_DRAW,
int  circleStyle = wxPDF_STYLE_DRAW,
const wxPdfLineStyle &  circleLineStyle = wxPdfLineStyle(),
const wxPdfColour &  circleFillColour = wxPdfColour() 
)
virtualinherited

Draws a regular polygon.

Parameters
x0Abscissa of Center point
y0Ordinate of Center point
rRadius of circumscribed circle
nsNumber of sides
angleOrientation angle (anti-clockwise)
circleFlag whether to draw circumscribed circle or not
styleStyle of polygon (draw and/or fill)
circleStyleStyle of circumscribed circle (draw and/or fill) (if draw)
circleLineStyleLine style for circumscribed circle. (if draw)
circleFillColourFill colour for circumscribed circle. (if draw fill circle)
Example
// Filled hexagon
pdf.SetFillColour(wxColour(220, 220, 220));
pdf.RegularPolygon(20, 190, 15, 6, 0, 1, wxPDF_STYLE_FILL);
// Square with circumscribed circle, drawn only
pdf.RegularPolygon(125, 190, 15, 4, 30, 1, wxPDF_STYLE_DRAW, wxPDF_STYLE_DRAW);
See also
Polygon(), StarPolygon()

◆ RestoreGraphicState()

void wxPdfDocument::RestoreGraphicState ( )
protectedvirtualinherited

Pops and restores the most recently saved graphic state.

Restores the font, colour, line, and extended graphics state values that were saved by the most recent call to SaveGraphicState(). If the stack is empty the call is a no-op.

Called automatically by StopTransform().

See also
SaveGraphicState(), StopTransform()

◆ Rotate() [1/2]

void wxPdfDocument::Rotate ( double  angle)
virtualinherited

Performs a rotation around the current position.

Parameters
angleangle in degrees.

The rotation affects all elements which are printed after the method call (with the exception of the clickable areas).

Remarks:

  • Only the display is altered. The GetX() and GetY() methods are not affected, nor the automatic page break mechanism.
  • Rotation is not kept from page to page. Each page begins with a null rotation.

◆ Rotate() [2/2]

void wxPdfDocument::Rotate ( double  angle,
double  x,
double  y 
)
virtualinherited

Performs a rotation around a given center.

Parameters
angleangle in degrees.
xabscissa of the rotation center. Default value: current position.
yordinate of the rotation center. Default value: current position.

The rotation affects all elements which are printed after the method call (with the exception of the clickable areas).

Remarks:

  • Only the display is altered. The GetX() and GetY() methods are not affected, nor the automatic page break mechanism.
  • Rotation is not kept from page to page. Each page begins with a null rotation.
    Example
    // Rotate a rectangle 20 degrees counter-clockwise around its lower-left corner (50, 60)
    pdf.StartTransform();
    pdf.Rotate(20, 50, 60);
    pdf.Rect(50, 50, 40, 10, wxPDF_STYLE_DRAW);
    pdf.StopTransform();
    See also
    StartTransform(), StopTransform()

◆ RotatedImage()

void wxPdfDocument::RotatedImage ( const wxString &  file,
double  x,
double  y,
double  w,
double  h,
double  angle,
const wxString &  type = wxEmptyString,
const wxPdfLink &  link = wxPdfLink(-1),
int  maskImage = 0 
)
virtualinherited

Puts a rotated image in the page.

The upper-left corner must be given.

The format can be specified explicitly or inferred from the file extension.

It is possible to put a link on the image.

Remark: if an image is used several times, only one copy will be embedded in the file.

Parameters
fileName of the file containing the image.
xAbscissa of the upper-left corner.
yOrdinate of the upper-left corner.
wWidth of the image in the page. If not specified or equal to zero, it is automatically calculated.
hHeight of the image in the page. If not specified or equal to zero, it is automatically calculated.
angleAngle of rotation
typeImage format. Possible values are (case insensitive): JPG, JPEG, PNG, GIF, WMF. If not specified, the type is inferred from the file extension.
linkURL or identifier returned by AddLink().
maskImageId of an image mask created previously by ImageMask().
See also
Image(), AddLink()

◆ RotatedText() [1/2]

void wxPdfDocument::RotatedText ( double  textX,
double  textY,
double  rotationX,
double  rotationY,
const wxString &  txt,
double  angle 
)
virtualinherited

Prints a rotated text string with explicit rotation center.

Parameters
textXAbscissa of the origin
textYOrdinate of the origin
rotationXabscissa of the rotation center.
rotationYordinate of the rotation center.
txtString to print
angleangle in degrees.

◆ RotatedText() [2/2]

void wxPdfDocument::RotatedText ( double  x,
double  y,
const wxString &  txt,
double  angle 
)
virtualinherited

Prints a rotated text string.

Parameters
xabscissa of the rotation center.
yordinate of the rotation center.
txtString to print
angleangle in degrees.

◆ RoundedRect()

void wxPdfDocument::RoundedRect ( double  x,
double  y,
double  w,
double  h,
double  r,
int  roundCorner = wxPDF_CORNER_ALL,
int  style = wxPDF_STYLE_DRAW 
)
virtualinherited

Draws a rounded rectangle.

Parameters
xAbscissa of upper-left corner
yOrdinate of upper-left corner
wWidth
hHeight
rRadius of the rounded corners
roundCornerDraws rounded corner or not.
  • wxPDF_CORNER_NONE no rounded corners
  • wxPDF_CORNER_TOP_LEFT top left corner
  • wxPDF_CORNER_TOP_RIGHT top right corner
  • wxPDF_CORNER_BOTTOM_LEFT bottom left corner
  • wxPDF_CORNER_BOTTOM_RIGHT bottom right corner
  • wxPDF_CORNER_ALL all corners
styleStyle of rectangle (draw and/or fill)
Example
// All corners rounded with radius 3.5
pdf.RoundedRect(5, 255, 40, 30, 3.50, wxPDF_CORNER_ALL, wxPDF_STYLE_FILLDRAW);
// Only top-left and top-right corners rounded
pdf.RoundedRect(50, 255, 40, 30, 6.50, wxPDF_CORNER_TOP_LEFT | wxPDF_CORNER_TOP_RIGHT);
#define wxPDF_CORNER_TOP_LEFT
Top-left rounded corner.
Definition: pdfproperties.h:29
#define wxPDF_CORNER_TOP_RIGHT
Top-right rounded corner.
Definition: pdfproperties.h:30
#define wxPDF_CORNER_ALL
All corners rounded.
Definition: pdfproperties.h:33
See also
Rect(), SetLineWidth(), SetDrawColour(), SetFillColour()

◆ SaveAsFile()

bool wxPdfDocument::SaveAsFile ( const wxString &  name = wxEmptyString)
virtualinherited

Saves the document to a file on disk.

The method first calls Close() if necessary to terminate the document.

Parameters
nameThe name of the file. If not given, the document will be named 'doc.pdf'
Returns
true if successful, false otherwise
Example
pdf.AddPage();
// ... add content ...
pdf.SaveAsFile(wxS("report.pdf"));
See also
Close()

◆ SaveGraphicState()

void wxPdfDocument::SaveGraphicState ( )
protectedvirtualinherited

Pushes the current graphic state onto an internal stack.

Saves the current values of:

  • font (family, style, and size)
  • draw, fill, and text colours
  • line width, line style, and extended graphics state (alpha)

Called automatically by StartTransform(). Subclasses that apply temporary rendering changes can call this directly and pair it with RestoreGraphicState() to leave the document state unchanged after the changes are done.

Note
The saved state stack is separate from the PDF content-stream operator stack (q/Q). If you need both the content-stream state and the wxPdfDocument member state saved, use StartTransform() and StopTransform() instead.
See also
RestoreGraphicState(), StartTransform()

◆ Scale() [1/2]

bool wxPdfDocument::Scale ( double  sx,
double  sy 
)
virtualinherited

Performs scaling in X and Y direction with the current position as the scaling center.

A scaling transformation is applied independently for X and Y direction.

Parameters
sxscaling factor for width in percent. 0 is not allowed.
syscaling factor for height in percent. 0 is not allowed.
See also
StartTransform(), StopTransform()

◆ Scale() [2/2]

bool wxPdfDocument::Scale ( double  sx,
double  sy,
double  x,
double  y 
)
virtualinherited

Performs scaling in X and Y direction.

A scaling transformation is applied independently for X and Y direction.

Parameters
sxscaling factor for width in percent. 0 is not allowed.
syscaling factor for height in percent. 0 is not allowed.
xabscissa of the scaling center.
yordinate of the scaling center.
See also
StartTransform(), StopTransform()

◆ ScaleX() [1/2]

bool wxPdfDocument::ScaleX ( double  sx)
virtualinherited

Performs scaling in X direction only with the current position as the scaling center.

A scaling transformation is applied for the X direction.

Parameters
sxscaling factor for width as percent. 0 is not allowed.
See also
StartTransform(), StopTransform()

◆ ScaleX() [2/2]

bool wxPdfDocument::ScaleX ( double  sx,
double  x,
double  y 
)
virtualinherited

Performs scaling in X direction only.

A scaling transformation is applied for the X direction.

Parameters
sxscaling factor for width as percent. 0 is not allowed.
xabscissa of the scaling center.
yordinate of the scaling center.
See also
StartTransform(), StopTransform()

◆ ScaleXY() [1/2]

bool wxPdfDocument::ScaleXY ( double  s)
virtualinherited

Performs equal scaling in X and Y direction with the current position as the scaling center.

A scaling transformation is applied for both - X and Y - directions.

Parameters
sscaling factor for width and height as percent. 0 is not allowed.
See also
StartTransform(), StopTransform()

◆ ScaleXY() [2/2]

bool wxPdfDocument::ScaleXY ( double  s,
double  x,
double  y 
)
virtualinherited

Performs equal scaling in X and Y direction.

A scaling transformation is applied for both - X and Y - directions.

Parameters
sscaling factor for width and height as percent. 0 is not allowed.
xabscissa of the scaling center.
yordinate of the scaling center.
Example
// Scale a rectangle to 150% from its lower-left corner (50, 30)
pdf.StartTransform();
pdf.ScaleXY(150, 50, 30);
pdf.Rect(50, 20, 40, 10, wxPDF_STYLE_DRAW);
pdf.StopTransform();
See also
StartTransform(), StopTransform()

◆ ScaleY() [1/2]

bool wxPdfDocument::ScaleY ( double  sy)
virtualinherited

Performs scaling in Y direction only with the current position as the scaling center.

A scaling transformation is applied for the Y direction.

Parameters
syscaling factor for height as percent. 0 is not allowed.
See also
StartTransform(), StopTransform()

◆ ScaleY() [2/2]

bool wxPdfDocument::ScaleY ( double  sy,
double  x,
double  y 
)
virtualinherited

Performs scaling in Y direction only.

A scaling transformation is applied for the Y direction.

Parameters
syscaling factor for height as percent. 0 is not allowed.
xabscissa of the scaling center.
yordinate of the scaling center.
See also
StartTransform(), StopTransform()

◆ Sector()

void wxPdfDocument::Sector ( double  x0,
double  y0,
double  r,
double  astart,
double  afinish,
int  style = wxPDF_STYLE_FILLDRAW,
bool  clockwise = true,
double  origin = 90. 
)
virtualinherited

Draws a sector.

Parameters
x0Abscissa of Center point
y0Ordinate of Center point
rRadius
astartStart angle
afinishFinish angle
styleStyle of rectangle (draw and/or fill, default: fill&draw)
clockwiseindicates whether to go clockwise (default: true)
originorigin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock; default: 90)

◆ SelectFont() [1/4]

bool wxPdfDocument::SelectFont ( const wxFont &  font,
bool  setFont = true 
)
protectedvirtualinherited

Select font based on wxFont object.

Parameters
fontwxFont object
setFontFlag whether to set the font in PDF output
Returns
true if font was selected, false otherwise

◆ SelectFont() [2/4]

bool wxPdfDocument::SelectFont ( const wxPdfFont &  font,
int  style,
double  size = 0,
bool  setFont = true 
)
protectedvirtualinherited

Select font based on wxPdfFont object.

Parameters
fontwxPdfFont object
styleFont style flags
sizeFont size
setFontFlag whether to set the font in PDF output
Returns
true if font was selected, false otherwise

◆ SelectFont() [3/4]

bool wxPdfDocument::SelectFont ( const wxString &  family,
const wxString &  style = wxEmptyString,
double  size = 0,
bool  setFont = true 
)
protectedvirtualinherited

Select font.

Parameters
familyFont family
styleFont style string
sizeFont size
setFontFlag whether to set the font in PDF output
Returns
true if font was selected, false otherwise

◆ SelectFont() [4/4]

bool wxPdfDocument::SelectFont ( const wxString &  family,
int  style,
double  size = 0,
bool  setFont = true 
)
protectedvirtualinherited

Select font.

Parameters
familyFont family
styleFont style flags
sizeFont size
setFontFlag whether to set the font in PDF output
Returns
true if font was selected, false otherwise

◆ SetAlpha()

int wxPdfDocument::SetAlpha ( double  lineAlpha = 1,
double  fillAlpha = 1,
wxPdfBlendMode  blendMode = wxPDF_BLENDMODE_NORMAL 
)
virtualinherited

Sets alpha values and blend mode.

Parameters
lineAlphaalpha value for stroking operations, from 0 (transparent) to 1 (opaque)
fillAlphaalpha value for non-stroking operations, from 0 (transparent) to 1 (opaque)
blendModeone of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity
Example
// Draw an opaque red square
pdf.SetAlpha();
pdf.SetFillColour(wxPdfColour(255, 0, 0));
pdf.Rect(10, 10, 40, 40, wxPDF_STYLE_FILLDRAW);
// Draw a semi-transparent green square overlapping it
pdf.SetAlpha(1, 0.5);
pdf.SetFillColour(wxPdfColour(0, 255, 0));
pdf.Rect(20, 20, 40, 40, wxPDF_STYLE_FILLDRAW);
// Restore full opacity
pdf.SetAlpha();
See also
SetAlphaState()

◆ SetAlphaState()

void wxPdfDocument::SetAlphaState ( int  alphaState)
virtualinherited

Sets a previously defined alpha state.

Parameters
alphaStateid of alpha state
Example
// Define two alpha states and switch between them
int halfAlpha = pdf.SetAlpha(1, 0.5);
int fullAlpha = pdf.SetAlpha(1, 1);
pdf.SetAlphaState(halfAlpha);
pdf.SetFillColour(wxPdfColour(255, 0, 0));
pdf.Rect(10, 10, 40, 40, wxPDF_STYLE_FILL);
pdf.SetAlphaState(fullAlpha);
pdf.SetFillColour(wxPdfColour(0, 0, 255));
pdf.Rect(60, 10, 40, 40, wxPDF_STYLE_FILL);
See also
SetAlpha()

◆ SetAuthor()

void wxPdfDocument::SetAuthor ( const wxString &  author)
virtualinherited

Defines the author of the document.

Parameters
authorThe name of the author.
See also
SetCreator(), SetKeywords(), SetSubject(), SetTitle()

◆ SetAutoPageBreak()

void wxPdfDocument::SetAutoPageBreak ( bool  autoPageBreak,
double  margin = 0 
)
virtualinherited

Enables or disables the automatic page breaking mode.

When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.

Parameters
autoPageBreakBoolean indicating if mode should be on or off.
marginDistance from the bottom of the page.
See also
Cell(), MultiCell(), AcceptPageBreak()

◆ SetCellMargin()

void wxPdfDocument::SetCellMargin ( double  margin)
virtualinherited

Defines the cell margin.

The method can be called before creating the first page.

Parameters
marginThe margin.

◆ SetCompression()

void wxPdfDocument::SetCompression ( bool  compress)
virtualinherited

Activates or deactivates page compression.

When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default.

Parameters
compressBoolean indicating if compression must be enabled.

◆ SetCreationDate()

void wxPdfDocument::SetCreationDate ( const wxDateTime &  creationDate)
virtualinherited

Defines the creation timestamp of the document.

Optionally the creation date can be specified with this method. If this method is not called the default is the current date and time.

Parameters
creationDateThe date and time to be used as the creation timestamp.
See also
SetAuthor(), SetKeywords(), SetSubject(), SetTitle()

◆ SetCreator()

void wxPdfDocument::SetCreator ( const wxString &  creator)
virtualinherited

Defines the creator of the document.

This is typically the name of the application that generates the PDF.

Parameters
creatorThe name of the creator.
See also
SetAuthor(), SetKeywords(), SetSubject(), SetTitle()

◆ SetDisplayMode()

void wxPdfDocument::SetDisplayMode ( wxPdfZoom  zoom,
wxPdfLayout  layout = wxPDF_LAYOUT_CONTINUOUS,
double  zoomFactor = 100. 
)
virtualinherited

Defines the way the document is to be displayed by the viewer.

The zoom level can be set:pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display.

Parameters
zoomThe zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
  • wxPDF_ZOOM_FULLPAGE: displays the entire page on screen
  • wxPDF_ZOOM_FULLWIDTH: uses maximum width of window
  • wxPDF_ZOOM_REAL: uses real size (equivalent to 100% zoom)
  • wxPDF_ZOOM_DEFAULT: uses viewer default mode
  • wxPDF_ZOOM_FACTOR: uses viewer default mode
layoutThe page layout. Possible values are:
  • wxPDF_LAYOUT_SINGLE: displays one page at once
  • wxPDF_LAYOUT_CONTINUOUS: displays pages continuously (default)
  • wxPDF_LAYOUT_TWO: displays two pages on two columns
  • wxPDF_LAYOUT_DEFAULT: uses viewer default mode
zoomFactorspecifies the zoom factor in percent if layout is wxPDF_ZOOM_FACTOR

◆ SetDrawColour() [1/6]

void wxPdfDocument::SetDrawColour ( const unsigned char  grayscale)
virtualinherited

Defines the colour used for all drawing operations.

Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
grayscaleindicates the gray level. Value between 0 and 255
See also
SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell()

◆ SetDrawColour() [2/6]

void wxPdfDocument::SetDrawColour ( const unsigned char  red,
const unsigned char  green,
const unsigned char  blue 
)
virtualinherited

Defines the colour used for all drawing operations.

Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
redindicates the red level. Value between 0 and 255
greenindicates the green level. Value between 0 and 255
blueindicates the blue level. Value between 0 and 255
See also
SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell()

◆ SetDrawColour() [3/6]

void wxPdfDocument::SetDrawColour ( const wxColour &  colour)
virtualinherited

Defines the colour used for all drawing operations.

Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
colourdefines a colour composed of a red, green and blue component
See also
SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell()

◆ SetDrawColour() [4/6]

void wxPdfDocument::SetDrawColour ( const wxPdfColour &  colour)
virtualinherited

Defines the colour used for all drawing operations.

Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
colourdefines a colour using the class wxPdfColour
See also
SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell()

◆ SetDrawColour() [5/6]

void wxPdfDocument::SetDrawColour ( const wxString &  name,
double  tint = 100 
)
virtualinherited

Defines the spot colour used for all drawing operations.

Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
namethe name of the spot colour
tintindicates the tint level. Value between 0 and 100. Default: 100.
See also
SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell()

◆ SetDrawColour() [6/6]

void wxPdfDocument::SetDrawColour ( double  cyan,
double  magenta,
double  yellow,
double  black 
)
virtualinherited

Defines the colour used for all drawing operations.

Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
cyanindicates the cyan level. Value between 0 and 100
magentaindicates the magenta level. Value between 0 and 100
yellowindicates the yellow level. Value between 0 and 100
blackindicates the black level. Value between 0 and 100
See also
SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell()

◆ SetDrawPattern()

void wxPdfDocument::SetDrawPattern ( const wxString &  name)
virtualinherited

Defines the pattern used for all drawing operations.

The given pattern is used for all drawing operations instead of a colour. Affected drawing operations are: lines, rectangles and cell borders. The method can be called before the first page is created and the value is retained from page to page.

Parameters
namethe name of the pattern
See also
SetFillPattern()

◆ SetEmbedAllFonts()

virtual void wxPdfDocument::SetEmbedAllFonts ( bool  embedAllFonts = true)
inlinevirtualinherited

Sets whether all fonts used in the document have to be embedded.

By default TrueType, OpenType and Type1 fonts are embedded (unless embedding was disabled with wxPdfFont::SetEmbed() or wxPdfFontManager::SetDefaultEmbed()), while the 14 Adobe standard fonts and the Adobe CJK fonts are never embedded. A PDF viewer has to substitute fonts that are not embedded, so the document may look different on other systems, and archival formats like PDF/A forbid non-embedded fonts.

If this mode is enabled, fonts selected afterwards are embedded:

If no embeddable replacement can be found for such a font, the font is used without embedding and a warning is logged (once per font and document).

This mode is implicitly enabled for documents conforming to PDF/A-1 (see SetPdfA1Conformance()). Since PDF/A forbids non-embedded fonts, standard fonts are replaced in PDF/A documents even without an explicit replacement: for Helvetica (alias Arial), Times and Courier installed metric-compatible free fonts like the Liberation fonts are used automatically (see wxPdfFontManager::GetEmbeddableFont()).

Note
Enable this mode before selecting the first font. Fonts selected while the mode was disabled keep their embedding state within the document.
Parameters
embedAllFontsflag whether all fonts should be embedded
See also
GetEmbedAllFonts(), wxPdfFontManager::GetEmbeddableFont()

◆ SetFillColour() [1/6]

void wxPdfDocument::SetFillColour ( const unsigned char  grayscale)
virtualinherited

Defines the colour used for all filling operations.

Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
grayscaleindicates the gray level. Value between 0 and 255
See also
SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell()

◆ SetFillColour() [2/6]

void wxPdfDocument::SetFillColour ( const unsigned char  red,
const unsigned char  green,
const unsigned char  blue 
)
virtualinherited

Defines the colour used for all filling operations.

Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
redindicates the red level. Value between 0 and 255
greenindicates the green level. Value between 0 and 255
blueindicates the blue level. Value between 0 and 255
See also
SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell()

◆ SetFillColour() [3/6]

void wxPdfDocument::SetFillColour ( const wxColour &  colour)
virtualinherited

Defines the colour used for all filling operations.

Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
colourdefines a colour composed of a red, green and blue component
See also
SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell()

◆ SetFillColour() [4/6]

void wxPdfDocument::SetFillColour ( const wxPdfColour &  colour)
virtualinherited

Defines the colour used for all filling operations.

Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
colourdefines a colour using the class wxPdfColour
See also
SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell()

◆ SetFillColour() [5/6]

void wxPdfDocument::SetFillColour ( const wxString &  name,
double  tint = 100 
)
virtualinherited

Defines the spot colour used for all filling operations.

Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
nameis the name of the spot colour
tintindicates the tint level. Value between 0 and 100. Default: 100.
See also
SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell()

◆ SetFillColour() [6/6]

void wxPdfDocument::SetFillColour ( double  cyan,
double  magenta,
double  yellow,
double  black 
)
virtualinherited

Defines the colour used for all filling operations.

Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
cyanindicates the cyan level. Value between 0 and 100
magentaindicates the magenta level. Value between 0 and 100
yellowindicates the yellow level. Value between 0 and 100
blackindicates the black level. Value between 0 and 100
See also
SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell()

◆ SetFillGradient()

void wxPdfDocument::SetFillGradient ( double  x,
double  y,
double  w,
double  h,
int  gradient 
)
virtualinherited

Paints a gradient shading to rectangular area.

Parameters
xabscissa of the top left corner of the rectangle.
yordinate of the top left corner of the rectangle.
wwidth of the rectangle.
hheight of the rectangle.
gradientid of the gradient returned by a gradient definition function.
Example
// Define once, paint multiple times at different positions
int grad = pdf.LinearGradient(wxPdfColour(255, 0, 0), wxPdfColour(0, 0, 255));
pdf.SetFillGradient(10, 10, 90, 90, grad);
pdf.SetFillGradient(10, 110, 90, 20, grad);
See also
LinearGradient(), AxialGradient(), MidAxialGradient(), RadialGradient(), CoonsPatchGradient()

◆ SetFillingRule()

void wxPdfDocument::SetFillingRule ( int  rule = wxWINDING_RULE)
virtualinherited

Set the filling rule.

Parameters
ruleThe filling rule to be used in complex filling operations. Possible values are:
  • wxWINDING_RULE (default)
  • wxODDEVEN_RULE

◆ SetFillPattern()

void wxPdfDocument::SetFillPattern ( const wxString &  name)
virtualinherited

Defines the pattern used for all filling operations.

The given pattern is used for all filling operations instead of a colour. Affected filling operations are: filled rectangles and cell backgrounds. The method can be called before the first page is created and the value is retained from page to page.

Parameters
namethe name of the pattern
See also
SetDrawPattern()

◆ SetFont() [1/4]

bool wxPdfDocument::SetFont ( const wxFont &  font)
virtualinherited

Sets the font used to print character strings based on a wxFont object.

The font referenced by the wxFont object will be added to the document if necessary.

Parameters
fontThe font to be set.
See also
AddFont(), SetFont(), SetFontSize(), Cell(), MultiCell(), Write()

◆ SetFont() [2/4]

bool wxPdfDocument::SetFont ( const wxPdfFont &  font,
int  style = wxPDF_FONTSTYLE_REGULAR,
double  size = 0 
)
virtualinherited

Sets the font used to print character strings based on a wxFont object.

The font referenced by the wxFont object will be added to the document if necessary.

Parameters
fontThe font to be set.
styleFont style. Possible values are:
  • wxPDF_FONTSTYLE_REGULAR : regular (default)
  • wxPDF_FONTSTYLE_ITALIC : italic
  • wxPDF_FONTSTYLE_BOLD : bold
  • wxPDF_FONTSTYLE_UNDERLINE : underline
  • wxPDF_FONTSTYLE_OVERLINE : overline
  • wxPDF_FONTSTYLE_STRIKEOUT : strike through
  • wxPDF_FONTSTYLE_THIN : thin
  • wxPDF_FONTSTYLE_EXTRALIGHT : extra light
  • wxPDF_FONTSTYLE_LIGHT : light
  • wxPDF_FONTSTYLE_MEDIUM : medium
  • wxPDF_FONTSTYLE_SEMIBOLD : semi-bold
  • wxPDF_FONTSTYLE_EXTRABOLD : extra bold
  • wxPDF_FONTSTYLE_HEAVY : heavy
  • wxPDF_FONTSTYLE_EXTRAHEAVY : extra heavy or any combination. Granular weights (Thin to ExtraHeavy) are fully supported when using wxFont starting with wxWidgets 3.1.2. In older versions, they fall back to the closest standard weight (Bold or Regular). Bold and italic styles do not apply to Symbol and ZapfDingbats
sizeFont size in points. The default value is the current size. If no size has been
See also
AddFont(), SetFont(), SetFontSize(), Cell(), MultiCell(), Write()

◆ SetFont() [3/4]

bool wxPdfDocument::SetFont ( const wxString &  family,
const wxString &  style = wxEmptyString,
double  size = 0 
)
virtualinherited

Sets the font used to print character strings.

It is mandatory to call a variant of this method at least once before printing text or the resulting document would not be valid. The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe). The method can be called before the first page is created and the font is retained from page to page. If you just wish to change the current font size, it is simpler to call SetFontSize().

Parameters
familyFamily font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):
  • Courier (fixed-width)
  • Helvetica or Arial (synonymous; sans serif)
  • Times (serif)
  • Symbol (symbolic)
  • ZapfDingbats (symbolic)
It is also possible to pass an empty string. In that case, the current family is retained.
styleFont style. Possible values are (case insensitive):
  • empty string: regular (default)
  • B: bold
  • I: italic
  • BI or IB: bold italic
  • U: underline
  • O: overline
  • S: strikethrough
  • T: thin
  • E: extra light
  • L: light
  • M: medium
  • D: demi / semi-bold
  • X: extra bold
  • H: heavy / black
  • A: extra heavy or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats
sizeFont size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12
See also
AddFont(), SetFontSize(), Cell(), MultiCell(), Write()

◆ SetFont() [4/4]

bool wxPdfDocument::SetFont ( const wxString &  family,
int  style,
double  size = 0 
)
virtualinherited

Sets the font used to print character strings.

It is mandatory to call a variant of this method at least once before printing text or the resulting document would not be valid. The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe). The method can be called before the first page is created and the font is retained from page to page. If you just wish to change the current font size, it is simpler to call SetFontSize().

Parameters
familyFamily font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):
  • Courier (fixed-width)
  • Helvetica or Arial (synonymous; sans serif)
  • Times (serif)
  • Symbol (symbolic)
  • ZapfDingbats (symbolic)
It is also possible to pass an empty string. In that case, the current family is retained.
styleFont style. Possible values are (case insensitive):
  • wxPDF_FONTSTYLE_REGULAR : regular (default)
  • wxPDF_FONTSTYLE_ITALIC : italic
  • wxPDF_FONTSTYLE_BOLD : bold
  • wxPDF_FONTSTYLE_UNDERLINE : underline
  • wxPDF_FONTSTYLE_OVERLINE : overline
  • wxPDF_FONTSTYLE_STRIKEOUT : strike through
  • wxPDF_FONTSTYLE_THIN : thin
  • wxPDF_FONTSTYLE_EXTRALIGHT : extra light
  • wxPDF_FONTSTYLE_LIGHT : light
  • wxPDF_FONTSTYLE_MEDIUM : medium
  • wxPDF_FONTSTYLE_SEMIBOLD : semi-bold
  • wxPDF_FONTSTYLE_EXTRABOLD : extra bold
  • wxPDF_FONTSTYLE_HEAVY : heavy
  • wxPDF_FONTSTYLE_EXTRAHEAVY : extra heavy or any combination. Granular weights (Thin to ExtraHeavy) are fully supported when using wxFont starting with wxWidgets 3.1.2. In older versions, they fall back to the closest standard weight (Bold or Regular).
sizeFont size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12
See also
AddFont(), SetFontSize(), Cell(), MultiCell(), Write()

◆ SetFontSize() [1/2]

void wxPdfDocument::SetFontSize ( double  size)
virtualinherited

Defines the size of the current font.

Parameters
sizeThe size (in points)
See also
SetFont()

Reimplemented in PdfLabel.

◆ SetFontSize() [2/2]

void wxPdfDocument::SetFontSize ( double  size,
bool  setSize 
)
protectedvirtualinherited

Defines the size of the current font.

Parameters
sizeThe size (in points)
setSizeflag whether to actually set the font size in PDF output
See also
SetFont()

◆ SetFontSubsetting()

virtual void wxPdfDocument::SetFontSubsetting ( bool  fontSubsetting = true)
inlinevirtualinherited

Sets the font embedding mode.

If other fonts than the 14 Adobe core fonts are used in a document, they are usually embedded into the PDF file, often resulting in rather large PDF files. This is especially true for Unicode fonts with thousands of glyphs. To reduce the size of the resulting PDF file fonts may be subsetted, that is, only those glyphs actually used in the document are embedded.

Currently wxPdfDocument supports font subsetting for TrueType Unicode fonts only.

Parameters
fontSubsettingBoolean indicating whether font subsetting should be used or not.

◆ SetFormBorderStyle()

void wxPdfDocument::SetFormBorderStyle ( wxPdfBorderStyle  borderStyle = wxPDF_BORDER_SOLID,
double  borderWidth = -1 
)
virtualinherited

Sets the border style for form fields.

Sets the border width and style to be used for all subsequent form field additions until this method is called again with different values.

Parameters
borderStylestyle of the form field's border
  • wxPDF_BORDER_SOLID - solid border
  • wxPDF_BORDER_DASHED - dashed border
  • wxPDF_BORDER_BEVELED - beveled border
  • wxPDF_BORDER_INSET - inset border
  • wxPDF_BORDER_UNDERLINE - border on the bottom side only
borderWidthwidth of the form field's border

◆ SetFormColours()

void wxPdfDocument::SetFormColours ( const wxPdfColour &  borderColour = wxPdfColour(),
const wxPdfColour &  backgroundColour = wxPdfColour(250),
const wxPdfColour &  textColour = wxPdfColour() 
)
virtualinherited

Sets colours for form fields.

Sets the border, background and text colour to be used for all subsequent form field additions until this method is called again with different values.

Parameters
borderColourcolour of the form field's border
backgroundColourcolour of the form field's background
textColourcolour of the form field's font

◆ SetImageScale()

void wxPdfDocument::SetImageScale ( double  scale)
virtualinherited

Set the image scale.

Parameters
[in]scaleimage scale.

◆ SetKerning()

void wxPdfDocument::SetKerning ( bool  kerning)
virtualinherited

Enable or disable kerning.

When enabled, kerning is applied to text output. Kerning is disabled by default.

Parameters
kerningBoolean indicating if kerning should be enabled.

◆ SetKeywords()

void wxPdfDocument::SetKeywords ( const wxString &  keywords)
virtualinherited

Associates keywords with the document,.

Generally keywords are in the form 'keyword1 keyword2 ...'.

Parameters
keywordsThe list of keywords.
See also
SetAuthor(), SetCreator(), SetSubject(), SetTitle()

◆ SetLanguage()

void wxPdfDocument::SetLanguage ( const wxString &  language)
inlineinherited

Set the natural language of the document.

Writes the /Lang entry of the document catalog, which screen readers use to select the speech synthesizer. The value is a BCP 47 language tag, e.g. "en-US" or "de". This setting is independent of SetTagged().

Parameters
languagethe language tag; an empty string removes the entry

◆ SetLeftMargin()

void wxPdfDocument::SetLeftMargin ( double  margin)
virtualinherited

Defines the left margin.

The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.

Parameters
marginThe margin.
See also
SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()

◆ SetLineHeight()

void wxPdfDocument::SetLineHeight ( double  height)
virtualinherited

Sets the height of a text line.

Parameters
heightThe line height.

◆ SetLineStyle()

void wxPdfDocument::SetLineStyle ( const wxPdfLineStyle &  linestyle)
virtualinherited

Sets line style.

Parameters
linestyleLine style to apply to subsequent drawing operations.
Example
wxPdfArrayDouble dash;
dash.Add(3.5);
dash.Add(7.0);
wxPdfLineStyle style(0.5, wxPDF_LINECAP_BUTT, wxPDF_LINEJOIN_MITER, dash, 0., wxColour(255, 0, 0));
pdf.SetLineStyle(style);
pdf.Line(5, 10, 80, 30);
Class representing line styles.
Definition: pdflinestyle.h:42
See also
wxPdfLineStyle

◆ SetLineWidth()

void wxPdfDocument::SetLineWidth ( double  width)
virtualinherited

Defines the line width.

By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.

Parameters
widthThe width.
See also
Line(), Rect(), Cell(), MultiCell()

◆ SetLink()

bool wxPdfDocument::SetLink ( int  link,
double  y = 0.,
int  page = -1 
)
virtualinherited

Defines the page and position a link points to.

Parameters
linkThe link identifier returned by AddLink()
yOrdinate of target position; -1 indicates the current position. The default value is 0 (top of page)
pageNumber of target page; -1 indicates the current page. This is the default value
See also
AddLink()

◆ SetMargins()

void wxPdfDocument::SetMargins ( double  left,
double  top,
double  right = -1 
)
virtualinherited

Defines the left, top and right margins.

By default, they equal 1 cm. Call this method to change them.

Parameters
leftLeft margin.
topTop margin.
rightRight margin. Default value is the left one.
See also
SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak()

◆ SetMessageTranslateMode()

void wxPdfDocument::SetMessageTranslateMode ( bool  translate)
inlineinherited

Set message translation mode.

Sets the message translation mode which controls the handling of msg tags in XML output

Parameters
translateflag specifying whether messages translation should be enabled

◆ SetPaperHandling()

void wxPdfDocument::SetPaperHandling ( wxPdfPaperHandling  paperHandling)
virtualinherited

Defines the paper handling when printing (simplex / duplex).

The paper handling option that shall be used when printing the file from the print dialog.

Parameters
paperHandlingCan be one of the following values:
  • wxPDF_PAPERHANDLING_DEFAULT: use the default of the viewer app
  • wxPDF_PAPERHANDLING_SIMPLEX: print single-sided
  • wxPDF_PAPERHANDLING_DUPLEX_FLIP_SHORT_EDGE: duplex and flip at the short edge of the sheet
  • wxPDF_PAPERHANDLING_DUPLEX_FLIP_LONG_EDGE: duplex and flip at the long edge of the sheet

◆ SetPdfA1Conformance()

void wxPdfDocument::SetPdfA1Conformance ( bool  enable)
inherited

Set PDF/A-1b conformance.

Sets the document conformance to PDF/A-1 Level B

Parameters
enableflag whether PDF/A-1b conformance should be enabled
Note
It is the user's responsibility to use only PDF features that in fact do conform with PDF/A-1b, (i.e., all fonts embedded, no transparency/alpha channel, no document protection)

◆ SetProtection()

bool wxPdfDocument::SetProtection ( int  permissions,
const wxString &  userPassword = wxEmptyString,
const wxString &  ownerPassword = wxEmptyString,
wxPdfEncryptionMethod  encryptionMethod = wxPDF_ENCRYPTION_AESV3R6,
int  keyLength = 0 
)
virtualinherited

Set permissions as well as user and owner passwords.

Parameters
permissionsflag indicating permissions. Flags from the following list may be combined as needed If a value is present it means that the permission is granted
userPassworduser password if applicable. If a user password is set, user will be prompted before document is opened
ownerPasswordowner password.if applicable If an owner password is set, the document can be opened in privilege mode with no restriction if that password is entered
encryptionMethodselects the encryption method. Possible values are:
  • wxPDF_ENCRYPTION_RC4V1 RC4 method, version 1, with 40 bit encryption key
  • wxPDF_ENCRYPTION_RC4V2 RC4 method, version 2, with 40..128 bit encryption key
  • wxPDF_ENCRYPTION_AESV2 AES method, with 128 bit encryption key
  • wxPDF_ENCRYPTION_AESV3 AES method, with 256 bit encryption key
  • wxPDF_ENCRYPTION_AESV3R6 AES method, with 256 bit encryption key (PDF 2.0, default)
keyLengthLength of the key used for encryption (default: 0) For encryption method wxPDF_ENCRYPTION_RC4V1 the key length is always 40 bits. For encryption method wxPDF_ENCRYPTION_RC4V2 the key length has to be in the range 40..128 and has to be dividable by 8; values outside this range are clamped automatically. For encryption methods wxPDF_ENCRYPTION_AESV2 the key length is always 128 bits. For encryption methods wxPDF_ENCRYPTION_AESV3 and wxPDF_ENCRYPTION_AESV3R6 the key length is always 256 bits.
Returns
true, if the provided passwords are valid, false otherwise.

◆ SetRightMargin()

void wxPdfDocument::SetRightMargin ( double  margin)
virtualinherited

Defines the right margin.

The method can be called before creating the first page.

Parameters
marginThe margin.
See also
SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins()

◆ SetScaleFactor()

void wxPdfDocument::SetScaleFactor ( const wxString &  unit)
protectedinherited

Set internal scale factor.

Parameters
unitUnit string ("pt", "mm", "cm", "in")

◆ SetSourceFile()

int wxPdfDocument::SetSourceFile ( const wxString &  filename,
const wxString &  password = wxEmptyString 
)
virtualinherited

Sets a source file for the external template feature.

Selects the source for the external template feature. A parser is setup for importing pages from the PDF document. Although wxPdfDocument usually creates PDF documents conforming to version 1.3 of the PDF standard, parsing of documents conforming to versions up to 1.6 is supported. If pages are aimported from documents conforming to a higher version than 1.3 the version used by wxPdDocument is updated accordingly.

Parameters
filenamea valid filename
passworda valid user or owner password if the PDF document is encrypted
Returns
the number of available pages, or 0 if the document could not be opened
See also
GetSourceInfo(), ImportPage(), UseTemplate()
Attention
Access permissions for printing, copying and extracting text or graphics are required. If a PDF document does not have these access permissions, it cannot be used as a source for the external template feature.

◆ SetSubject()

void wxPdfDocument::SetSubject ( const wxString &  subject)
virtualinherited

Defines the subject of the document.

Parameters
subjectThe subject.
See also
SetAuthor(), SetCreator(), SetKeywords(), SetTitle()

◆ SetSystemFontFallback()

void wxPdfDocument::SetSystemFontFallback ( bool  enable)
virtualinherited

Enables or disables the search for fallback fonts among the installed system fonts.

If enabled, characters that neither the current font nor any font added with AddFallbackFont() can show are looked up among the fonts installed on the system using wxPdfFontManager::FindFallbackFont(). Fonts found this way are registered with the font manager and embedded in the document like any other font.

Parameters
enabletrue to enable the system font search, false to disable it
Note
Disabled by default. The result depends on the fonts installed on the machine creating the PDF; use AddFallbackFont() for reproducible output.

◆ SetTagged()

void wxPdfDocument::SetTagged ( bool  tagged = true)
inherited

Enable or disable tagged PDF output.

A tagged PDF document carries a logical structure tree in addition to its visual content. Assistive technology such as screen readers uses it to present the document in a meaningful reading order, to announce headings, figures and formulas, and to read alternate descriptions instead of drawings. It is a prerequisite for accessible PDF (PDF/UA, ISO 14289).

When tagging is enabled:

  • every drawing command issued between BeginTag() and EndTag() becomes content of that structure element;
  • content drawn outside of any structure element, content drawn between BeginArtifact() and EndArtifact(), and everything drawn by Header() and Footer() is marked as an artifact, i.e. as decoration that assistive technology skips;
  • the document catalog gets a /MarkInfo and a /StructTreeRoot entry, and the PDF version is raised to at least 1.7.

Tagging should be enabled before the first page is added. While tagging is disabled (the default), all tagging methods are no-ops and the generated PDF is unchanged, so applications can call them unconditionally.

For a document to be accessible, applications should in addition set a document title (SetTitle()) and display it (SetViewerPreferences() with wxPDF_VIEWER_DISPLAYDOCTITLE), set the document language (SetLanguage()), embed all fonts, and give every Figure and Formula an alternate text.

Note
Tagging content inside templates (BeginTemplate()/EndTemplate()) is not supported: the structure elements are recorded, but the template content is not linked to them. Using a template inside a structure element is fine; the template then belongs to that element as a whole. Annotations and links are not (yet) added to the structure tree.
Parameters
taggedflag whether tagged PDF should be produced
See also
BeginTag(), EndTag(), BeginFormula(), BeginArtifact(), SetLanguage()

◆ SetTemplateBBox()

void wxPdfDocument::SetTemplateBBox ( int  templateId,
double  x,
double  y,
double  width,
double  height 
)
virtualinherited

Sets the bounding box of a template.

As long as a template hasn't been used it is possible to change the bounding box of the template. This may be useful for pages imported from an external PDF document allowing to set the visible portion of the template. Note: Setting the bounding box influences only the visible area of the template, not the real size it occupies.

Parameters
templateIdA valid template ID
xThe x coordinate of the lower left corner
yThe y coordinate of the lower left corner
widthThe width of the template
heightThe height of the template
See also
GetTemplateBBox(), BeginTemplate(), ImportPage()

◆ SetTextColour() [1/6]

void wxPdfDocument::SetTextColour ( const unsigned char  grayscale)
virtualinherited

Defines the colour used for text.

It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
grayscaleindicates the gray level. Value between 0 and 255
See also
SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell()

◆ SetTextColour() [2/6]

void wxPdfDocument::SetTextColour ( const unsigned char  red,
const unsigned char  green,
const unsigned char  blue 
)
virtualinherited

Defines the colour used for text.

It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
redindicates the red level. Value between 0 and 255
greenindicates the green level. Value between 0 and 255
blueindicates the blue level. Value between 0 and 255
See also
SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell()

◆ SetTextColour() [3/6]

void wxPdfDocument::SetTextColour ( const wxColour &  colour)
virtualinherited

Defines the colour used for text.

It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
colourdefines a colour composed of a red, green and blue component
See also
SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell()

◆ SetTextColour() [4/6]

void wxPdfDocument::SetTextColour ( const wxPdfColour &  colour)
virtualinherited

Defines the colour used for text.

It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
colourdefines a colour using the class wxPdfColour
See also
SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell()

◆ SetTextColour() [5/6]

void wxPdfDocument::SetTextColour ( const wxString &  name,
double  tint = 100 
)
virtualinherited

Defines the spot colour used for text.

It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
namethe name of the spot colour
tintindicates the tint level. Value between 0 and 100. Default: 100.
See also
SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell()

◆ SetTextColour() [6/6]

void wxPdfDocument::SetTextColour ( double  cyan,
double  magenta,
double  yellow,
double  black 
)
virtualinherited

Defines the colour used for text.

It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters
cyanindicates the cyan level. Value between 0 and 100
magentaindicates the magenta level. Value between 0 and 100
yellowindicates the yellow level. Value between 0 and 100
blackindicates the black level. Value between 0 and 100
See also
SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell()

◆ SetTextPattern()

void wxPdfDocument::SetTextPattern ( const wxString &  name)
virtualinherited

Defines the pattern used for text output.

The given pattern is used for text output instead of a colour. The method can be called before the first page is created and the value is retained from page to page.

Parameters
namethe name of the pattern
See also
SetDrawPattern()

◆ SetTextRenderMode()

void wxPdfDocument::SetTextRenderMode ( wxPdfTextRenderMode  mode = wxPDF_TEXT_RENDER_FILL)
virtualinherited

Sets the text render mode.

Parameters
modethe text render mode

◆ SetTitle()

void wxPdfDocument::SetTitle ( const wxString &  title)
virtualinherited

Defines the title of the document.

Parameters
titleThe title.
Example
pdf.SetTitle(wxS("20000 Leagues Under the Seas"));
pdf.SetAuthor(wxS("Jules Verne"));
pdf.AddPage();
// ... add content ...
pdf.SaveAsFile(wxS("book.pdf"));
virtual void SetTitle(const wxString &title)
Defines the title of the document.
Definition: pdfdocument.cpp:2296
virtual void SetAuthor(const wxString &author)
Defines the author of the document.
Definition: pdfdocument.cpp:2310
See also
SetAuthor(), SetCreator(), SetKeywords(), SetSubject()

◆ SetTopMargin()

void wxPdfDocument::SetTopMargin ( double  margin)
virtualinherited

Defines the top margin.

The method can be called before creating the first page.

Parameters
marginThe margin.
See also
SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()

◆ SetViewerPreferences()

void wxPdfDocument::SetViewerPreferences ( int  preferences = 0)
virtualinherited

Defines the viewer preferences.

Parameters
preferencesA set of viewer preferences options.
  • wxPDF_VIEWER_HIDETOOLBAR: Hide tool bar
  • wxPDF_VIEWER_HIDEMENUBAR: Hide menu bar
  • wxPDF_VIEWER_HIDEWINDOWUI: Hide user interface
  • wxPDF_VIEWER_FITWINDOW: Fit window to page size
  • wxPDF_VIEWER_CENTERWINDOW: Center window on screen
  • wxPDF_VIEWER_DISPLAYDOCTITLE: Display document title in title bar
  • wxPDF_VIEWER_NOPRINTSCALING: Set page scaling to none when printing

◆ SetX()

void wxPdfDocument::SetX ( double  x)
virtualinherited

Defines the abscissa of the current position.

If the passed value is negative, it is relative to the right of the page.

Parameters
xThe value of the abscissa.
See also
GetX(), GetY(), SetY(), SetXY()

◆ SetXY()

void wxPdfDocument::SetXY ( double  x,
double  y 
)
virtualinherited

Defines the abscissa and ordinate of the current position.

If the passed values are negative, they are relative respectively to the right and bottom of the page.

Parameters
xThe value of the abscissa
yThe value of the ordinate
See also
SetX(), SetY()

◆ SetY()

void wxPdfDocument::SetY ( double  y)
virtualinherited

Moves the current abscissa back to the left margin and sets the ordinate.

If the passed value is negative, it is relative to the bottom of the page.

Parameters
yThe value of the ordinate.
See also
GetX(), GetY(), SetY(), SetXY()

◆ Shape()

void wxPdfDocument::Shape ( const wxPdfShape &  shape,
int  style = wxPDF_STYLE_DRAW 
)
virtualinherited

Draws a shape.

Parameters
shapeshape to be drawn
styleStyle of rendering. Possible values are:
  • wxPDF_STYLE_DRAW (default)
  • wxPDF_STYLE_FILL: fill
  • wxPDF_STYLE_FILLDRAW: draw and fill
  • wxPDF_STYLE_DRAWCLOSE: close path and draw (can be combined with wxPDF_STYLE_FILL
Example
wxPdfShape shape;
shape.MoveTo(125, 130);
shape.LineTo(150, 130);
shape.LineTo(150, 150);
shape.ClosePath();
shape.MoveTo(125, 175);
shape.CurveTo(150, 145, 190, 155, 180, 140);
void LineTo(double x, double y)
Add line segment to the shape.
Definition: pdfgraphics.cpp:162
void ClosePath()
Close (sub)path of the shape.
Definition: pdfgraphics.cpp:198
#define wxPDF_STYLE_DRAWCLOSE
Close and draw the path.
Definition: pdfproperties.h:40
See also
ShapedText(), ClippingPath()

◆ ShapedText()

void wxPdfDocument::ShapedText ( const wxPdfShape &  shape,
const wxString &  text,
wxPdfShapedTextMode  mode = wxPDF_SHAPEDTEXTMODE_STRETCHTOFIT 
)
virtualinherited

Prints a text string along a path defined by a shape.

Parameters
shapeshape defining a path along which the text is printed
texttext string to be printed
modeflag how to handle the text string
  • wxPDF_SHAPEDTEXTMODE_ONETIME: the text should be printed at most one time depending on the path length
  • wxPDF_SHAPEDTEXTMODE_STRETCHTOFIT: the text should be stretched to fit exactly along the given path (default)
  • wxPDF_SHAPEDTEXTMODE_REPEAT: the text should be repeated if the text length is shorter than the path length
Example
// Text stretched along a Bézier curve
wxPdfShape shape;
shape.MoveTo(25, 40);
shape.CurveTo(50, 55, 90, 45, 80, 75);
pdf.Curve(25, 40, 50, 55, 90, 45, 80, 75, wxPDF_STYLE_DRAW);
pdf.ShapedText(shape, wxS("Text along a curved path"));
// Repeated text along a longer path
wxPdfShape shape2;
shape2.MoveTo(125, 40);
shape2.CurveTo(150, 55, 190, 45, 180, 75);
pdf.ShapedText(shape2, wxS("Repeat! "), wxPDF_SHAPEDTEXTMODE_REPEAT);
@ wxPDF_SHAPEDTEXTMODE_REPEAT
Repeat shaped text.
Definition: pdfproperties.h:298
See also
Shape(), Curve()

◆ ShowText()

void wxPdfDocument::ShowText ( const wxString &  txt)
protectedinherited

Show text string, with kerning if requested.

If font fallback is enabled and the current font lacks glyphs for some characters, the text is split into runs and each run is shown with an appropriate font.

See also
AddFallbackFont()

◆ Skew() [1/2]

bool wxPdfDocument::Skew ( double  xAngle,
double  yAngle 
)
virtualinherited

Performs a skewing in both X and Y directions with the current position as the skewing center.

Parameters
xAngleangle in degrees between -90 (skew to the left) and 90 (skew to the right)
yAngleangle in degrees between -90 (skew to the bottom) and 90 (skew to the top)
See also
StartTransform(), StopTransform()

◆ Skew() [2/2]

bool wxPdfDocument::Skew ( double  xAngle,
double  yAngle,
double  x,
double  y 
)
virtualinherited

Performs a skewing in both X and Y directions.

Parameters
xAngleangle in degrees between -90 (skew to the left) and 90 (skew to the right)
yAngleangle in degrees between -90 (skew to the bottom) and 90 (skew to the top)
xabscissa of the skewing center. default is current x position
yordinate of the skewing center. default is current y position
See also
StartTransform(), StopTransform()

◆ SkewX() [1/2]

bool wxPdfDocument::SkewX ( double  xAngle)
virtualinherited

Performs a skewing in X direction only with the current position as the skewing center.

Parameters
xAngleangle in degrees between -90 (skew to the left) and 90 (skew to the right)
See also
StartTransform(), StopTransform()

◆ SkewX() [2/2]

bool wxPdfDocument::SkewX ( double  xAngle,
double  x,
double  y 
)
virtualinherited

Performs a skewing in both X direction only.

Parameters
xAngleangle in degrees between -90 (skew to the left) and 90 (skew to the right)
xabscissa of the skewing center. default is current x position
yordinate of the skewing center. default is current y position
Example
// Skew a rectangle 30 degrees along the X axis from its lower-left corner (125, 60)
pdf.StartTransform();
pdf.SkewX(30, 125, 60);
pdf.Rect(125, 50, 40, 10, wxPDF_STYLE_DRAW);
pdf.StopTransform();
See also
StartTransform(), StopTransform()

◆ SkewY() [1/2]

bool wxPdfDocument::SkewY ( double  yAngle)
virtualinherited

Performs a skewing in Y direction only with the current position as the skewing center.

Parameters
yAngleangle in degrees between -90 (skew to the bottom) and 90 (skew to the top)
See also
StartTransform(), StopTransform()

◆ SkewY() [2/2]

bool wxPdfDocument::SkewY ( double  yAngle,
double  x,
double  y 
)
virtualinherited

Performs a skewing in Y direction only.

Parameters
yAngleangle in degrees between -90 (skew to the bottom) and 90 (skew to the top)
xabscissa of the skewing center. default is current x position
yordinate of the skewing center. default is current y position
See also
StartTransform(), StopTransform()

◆ SplitTextByFont()

bool wxPdfDocument::SplitTextByFont ( const wxString &  txt,
std::vector< wxPdfFontFallbackRun > &  runs 
)
protectedinherited

Split a text into runs that can each be rendered with a single font.

Every character the current font can show stays with the current font. Other characters are assigned to the first fallback font containing them.

Parameters
txtthe text to split
runsreceives the runs
Returns
true if at least one run uses a fallback font

◆ StarPolygon()

void wxPdfDocument::StarPolygon ( double  x0,
double  y0,
double  r,
int  nv,
int  ng,
double  angle = 0,
bool  circle = false,
int  style = wxPDF_STYLE_DRAW,
int  circleStyle = wxPDF_STYLE_DRAW,
const wxPdfLineStyle &  circleLineStyle = wxPdfLineStyle(),
const wxPdfColour &  circleFillColour = wxPdfColour() 
)
virtualinherited

Draws a star polygon.

Parameters
x0Abscissa of Center point
y0Ordinate of Center point
rRadius of circumscribed circle
nvNumber of vertices
ngNumber of gaps (ng % nv = 1 => regular polygon)
angleOrientation angle (anti-clockwise)
circleFlag whether to draw circumscribed circle or not
styleStyle of polygon (draw and/or fill)
circleStyleStyle of circumscribed circle (draw and/or fill) (if draw)
circleLineStyleLine style for circumscribed circle. (if draw)
circleFillColourFill colour for circumscribed circle. (if draw fill circle)
Example
// 20-pointed star with every 3rd vertex connected, filled
pdf.SetFillColour(wxColour(220, 220, 220));
pdf.StarPolygon(20, 230, 15, 20, 3, 0, 1, wxPDF_STYLE_FILL);
// 5-pointed star with circumscribed circle
pdf.StarPolygon(55, 230, 15, 12, 5);
See also
Polygon(), RegularPolygon()

◆ StartTransform()

void wxPdfDocument::StartTransform ( )
virtualinherited

Enters a transformation environment.

Before applying any transformation this method should be invoked. All transformation method invoke it implicitly if necessary. All open transformation environments are closed implicitly on page end.

Example
// Draw a rectangle, then draw it again scaled 150% from its lower-left corner
pdf.Rect(50, 20, 40, 10, wxPDF_STYLE_DRAW);
pdf.StartTransform();
pdf.ScaleXY(150, 50, 30);
pdf.Rect(50, 20, 40, 10, wxPDF_STYLE_DRAW);
pdf.StopTransform();
See also
StopTransform()

◆ StopTransform()

void wxPdfDocument::StopTransform ( )
virtualinherited

Leaves a transformation environment.

This method should be invoked to cancel a transformation environment opened by StartTransform. All open transformation environments are closed implicitly on page end.

See also
StartTransform()

◆ Text()

void wxPdfDocument::Text ( double  x,
double  y,
const wxString &  txt 
)
virtualinherited

Prints a character string.

The origin is on the left of the first character, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use Cell(), MultiCell() or Write() which are the standard methods to print text.

Parameters
xAbscissa of the origin
yOrdinate of the origin
txtString to print
See also
SetFont(), SetTextColour(), Cell(), MultiCell(), Write()

◆ TextBox()

int wxPdfDocument::TextBox ( double  w,
double  h,
const wxString &  txt,
int  halign = wxPDF_ALIGN_JUSTIFY,
int  valign = wxPDF_ALIGN_TOP,
int  border = 0,
int  fill = 0 
)
virtualinherited

This method counts the number of lines a text will occupy in respect to a given maximal width.

Parameters
wWidth of cells. If 0, they extend up to the right margin of the page.
hHeight of cells.
txtString to print
halignAllows to center or align the text. Possible values are:
  • wxPDF_ALIGN_LEFT align the text at the left margin
  • wxPDF_ALIGN_CENTER center the text
  • wxPDF_ALIGN_RIGHT align the text at the right margin
  • wxPDF_ALIGN_JUSTIFY justify the text (default)
valignAllows to vertical align the text. Possible values are:
  • wxPDF_ALIGN_TOP align the text at the top of the box
  • wxPDF_ALIGN_MIDDLE center the text vertically in the box
  • wxPDF_ALIGN_BOTTOM align the text at the bottom of the box
borderIndicates if borders must be drawn around the text box. The value can be
  • wxPDF_BORDER_NONE no border
  • wxPDF_BORDER_LEFT left border
  • wxPDF_BORDER_RIGHT right border
  • wxPDF_BORDER_TOP top border
  • wxPDF_BORDER_BOTTOM bottom border
  • wxPDF_BORDER_FRAME border on all sides
or a combination of them.
fillIndicates if the cell background must be painted (1) or transparent (0). Default value: 0.

◆ TextField() [1/2]

void wxPdfDocument::TextField ( const wxString &  name,
double  width,
double  height,
const wxString &  value = wxEmptyString,
bool  multiline = false 
)
virtualinherited

Adds a text field at the current position.

Adds a text field to the list of form fields at the current position

Parameters
namefield name of the text field
widthwidth of the text field
heightheight of the text field
valuedefault value of the text field
multilineflag whether the text field is a multiline field or not

◆ TextField() [2/2]

void wxPdfDocument::TextField ( const wxString &  name,
double  x,
double  y,
double  width,
double  height,
const wxString &  value = wxEmptyString,
bool  multiline = false 
)
virtualinherited

Adds a text field.

Adds a text field to the list of form fields

Parameters
namefield name of the text field
xabscissa of the text field position
yordinate of the text field position
widthwidth of the text field
heightheight of the text field
valuedefault value of the text field
multilineflag whether the text field is a multiline field or not

◆ Transform()

void wxPdfDocument::Transform ( double  a,
double  b,
double  c,
double  d,
double  tx,
double  ty 
)
virtualinherited

Performs a transformation.

Applies a transformation matrix to the current coordinate system.

Parameters
aelement 1,1 of the matrix
belement 1,2 of the matrix
celement 2,1 of the matrix
delement 2,2 of the matrix
txhorizontal translation
tyvertical translation
See also
StartTransform(), StopTransform()

◆ Translate()

void wxPdfDocument::Translate ( double  tx,
double  ty 
)
virtualinherited

Moves the origin.

Parameters
txmovement to the right
tymovement to the bottom
Example
// Draw a rectangle shifted 10 right and 5 down
pdf.StartTransform();
pdf.Translate(10, 5);
pdf.Rect(125, 20, 40, 10, wxPDF_STYLE_DRAW);
pdf.StopTransform();
See also
StartTransform(), StopTransform()

◆ TranslateX()

void wxPdfDocument::TranslateX ( double  tx)
virtualinherited

Moves the X origin.

Parameters
txmovement to the right
See also
StartTransform(), StopTransform()

◆ TranslateY()

void wxPdfDocument::TranslateY ( double  ty)
virtualinherited

Moves the Y origin.

Parameters
tymovement to the bottom
See also
StartTransform(), StopTransform()

◆ UnsetClipping()

void wxPdfDocument::UnsetClipping ( )
virtualinherited

Remove clipping area.

Once you have finished using clipping, you must remove it with UnsetClipping().

See also
ClippingText(), ClippingRect(), ClippingEllipse(), ClippingPolygon(), ClippingPath()

◆ UseTemplate() [1/2]

void wxPdfDocument::UseTemplate ( int  templateId)
virtualinherited

Uses a template in current page or in another template.

Uses the specified template just like an image in the current page or in another template at the current position with default size.

The width or height is calculated using GetTemplateSize internally.

Parameters
templateIdA valid template ID
See also
BeginTemplate(), EndTemplate(), ImportPage()

◆ UseTemplate() [2/2]

void wxPdfDocument::UseTemplate ( int  templateId,
double  x,
double  y,
double  width = 0,
double  height = 0 
)
virtualinherited

Uses a template in current page or in another template.

Uses the specified template just like an image in the current page or in another template.

Width and height parameters are optional. The width or height is calculated using GetTemplateSize internally. By default the size as defined by BeginTemplate is used.

Parameters
templateIdA valid template ID
xThe x coordinate
yThe y coordinate
widthThe new width of the template
heightThe new height of the template
See also
BeginTemplate(), EndTemplate(), ImportPage()
Attention
The template may be displayed distorted, if both width and height are given with values > 0 and do not correspond to the dimensions of the template.

◆ Write()

void wxPdfDocument::Write ( double  h,
const wxString &  txt,
const wxPdfLink &  link = wxPdfLink(-1) 
)
virtualinherited

This method prints text from the current position.

When the right margin is reached (or the
character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text. It is possible to put a link on the text.

Parameters
hLine height
txtString to print
linkURL or identifier returned by AddLink()
See also
SetFont(), SetTextColour(), AddLink(), MultiCell(), SetAutoPageBreak()

◆ WriteCell()

void wxPdfDocument::WriteCell ( double  h,
const wxString &  txt,
int  border = wxPDF_BORDER_NONE,
int  fill = 0,
const wxPdfLink &  link = wxPdfLink(-1) 
)
virtualinherited

This method prints text with cell attributes from the current position.

When the right margin is reached (or the
character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text. It is possible to put a link on the text.

Parameters
hLine height
txtString to print
borderIndicates if borders must be drawn around the cell. The value can be
  • wxPDF_BORDER_NONE no border
  • wxPDF_BORDER_LEFT left border
  • wxPDF_BORDER_RIGHT right border
  • wxPDF_BORDER_TOP top border
  • wxPDF_BORDER_BOTTOM bottom border
  • wxPDF_BORDER_FRAME border on all sides
or a combination of them.
fillIndicates if the cell background must be painted (1) or transparent (0). Default value: 0.
linkURL or identifier returned by AddLink()
See also
SetFont(), SetTextColour(), AddLink(), MultiCell(), SetAutoPageBreak()

◆ WriteGlyphArray()

bool wxPdfDocument::WriteGlyphArray ( wxPdfArrayDouble &  x,
wxPdfArrayDouble &  y,
wxPdfArrayUint32 &  glyphs 
)
virtualinherited

Prints an array of glyphs identified by glyph numbers from the current position.

The glyphs are positioned according to the given offsets in horizontal (x) and vertical (y) direction.

Note
This method only works for dynamically loaded TrueType and OpenType Unicode fonts.

◆ WriteXml()

void wxPdfDocument::WriteXml ( const wxString &  str)
virtualinherited

Prints a string containing simple XML markup.

Output starts at the current position.

Parameters
strstring containing text with simple XML markup
Example
// Named anchor at the top of the page
pdf.WriteXml(wxS("<a name=\"top\">Top of page</a><br/>"));
// Hyperlink that jumps to the anchor
pdf.WriteXml(wxS("<a href=\"#top\">Back to top</a><br/>"));
// Styled paragraph: bold, italic, superscript, underline, strikethrough
pdf.WriteXml(wxS("<p align=\"justify\">H<sub>2</sub>O is <b>water</b>. "
"<u><s>Striked</s> and underlined</u>.</p>"));
// Ordered list with Roman numerals starting at 100
pdf.WriteXml(wxS("<ol type=\"i\" start=\"100\"><li>Alpha</li><li>Beta</li></ol>"));
// Simple bordered table
pdf.WriteXml(wxS("<table border=\"1\"><tbody><tr>"
"<td>Cell 1</td><td>Cell 2</td>"
"</tr></tbody></table>"));
See also
Styling text using a simple markup language

The documentation for this class was generated from the following file: