1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: pdfdocument.h 3 // Purpose: 4 // Author: Ulrich Telle 5 // Created: 2005-08-04 6 // Copyright: (c) Ulrich Telle 7 // Licence: wxWindows licence 8 /////////////////////////////////////////////////////////////////////////////// 9 10 /// \file pdfdocument.h Interface of the wxPdfDocument class 11 12 #ifndef _PDF_DOCUMENT_H_ 13 #define _PDF_DOCUMENT_H_ 14 15 // wxWidgets headers 16 #include <wx/dynarray.h> 17 #include <wx/hashmap.h> 18 #include <wx/mstream.h> 19 #include <wx/string.h> 20 #include <wx/xml/xml.h> 21 22 // wxPdfDocument headers 23 #include "wx/pdfdocdef.h" 24 #include "wx/pdfarraytypes.h" 25 #include "wx/pdfarraydouble.h" 26 #include "wx/pdfcolour.h" 27 #include "wx/pdfencrypt.h" 28 #include "wx/pdfimage.h" 29 #include "wx/pdflinestyle.h" 30 #include "wx/pdflinks.h" 31 #include "wx/pdfproperties.h" 32 #include "wx/pdfdoc_version.h" 33 34 #define wxPDF_PRODUCER wxS(PDFDOC_VERSION_STRING) 35 36 #define wxPDF_EPSILON 1e-6 37 38 class WXDLLIMPEXP_FWD_PDFDOC wxPdfCoonsPatchMesh; 39 40 class WXDLLIMPEXP_FWD_PDFDOC wxPdfFont; 41 class WXDLLIMPEXP_FWD_PDFDOC wxPdfFontDescription; 42 class WXDLLIMPEXP_FWD_PDFDOC wxPdfFontDetails; 43 44 class WXDLLIMPEXP_FWD_PDFDOC wxPdfExtGState; 45 class WXDLLIMPEXP_FWD_PDFDOC wxPdfGradient; 46 class WXDLLIMPEXP_FWD_PDFDOC wxPdfInfo; 47 48 class WXDLLIMPEXP_FWD_PDFDOC wxPdfShape; 49 50 class WXDLLIMPEXP_FWD_PDFDOC wxPdfSpotColour; 51 class WXDLLIMPEXP_FWD_PDFDOC wxPdfPattern; 52 53 class WXDLLIMPEXP_FWD_PDFDOC wxPdfCellContext; 54 class WXDLLIMPEXP_FWD_PDFDOC wxPdfTable; 55 class WXDLLIMPEXP_FWD_PDFDOC wxPdfIndirectObject; 56 class WXDLLIMPEXP_FWD_PDFDOC wxPdfAnnotationWidget; 57 class WXDLLIMPEXP_FWD_PDFDOC wxPdfTemplate; 58 class WXDLLIMPEXP_FWD_PDFDOC wxPdfParser; 59 class WXDLLIMPEXP_FWD_PDFDOC wxPdfObject; 60 61 class WXDLLIMPEXP_FWD_PDFDOC wxPdfArrayLayer; 62 class WXDLLIMPEXP_FWD_PDFDOC wxPdfOcg; 63 class WXDLLIMPEXP_FWD_PDFDOC wxPdfLayer; 64 class WXDLLIMPEXP_FWD_PDFDOC wxPdfLayerMembership; 65 class WXDLLIMPEXP_FWD_PDFDOC wxPdfLayerGroup; 66 67 /// Hashmap class for offset values 68 WX_DECLARE_HASH_MAP_WITH_DECL(long, int, wxIntegerHash, wxIntegerEqual, wxPdfOffsetHashMap, class WXDLLIMPEXP_PDFDOC); 69 70 /// Hashmap class for document pages 71 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxMemoryOutputStream*, wxIntegerHash, wxIntegerEqual, wxPdfPageHashMap, class WXDLLIMPEXP_PDFDOC); 72 73 /// Hashmap class for document pages 74 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxSize, wxIntegerHash, wxIntegerEqual, wxPdfPageSizeMap, class WXDLLIMPEXP_PDFDOC); 75 76 /// Hashmap class for boolean values 77 WX_DECLARE_HASH_MAP_WITH_DECL(long, bool, wxIntegerHash, wxIntegerEqual, wxPdfBoolHashMap, class WXDLLIMPEXP_PDFDOC); 78 79 /// Hashmap class for double values 80 WX_DECLARE_HASH_MAP_WITH_DECL(long, double, wxIntegerHash, wxIntegerEqual, wxPdfDoubleHashMap, class WXDLLIMPEXP_PDFDOC); 81 82 /// Hashmap class for document links 83 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxPdfLink*, wxIntegerHash, wxIntegerEqual, wxPdfLinkHashMap, class WXDLLIMPEXP_PDFDOC); 84 85 /// Hashmap class for page links 86 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxArrayPtrVoid*, wxIntegerHash, wxIntegerEqual, wxPdfPageLinksMap, class WXDLLIMPEXP_PDFDOC); 87 88 /// Hashmap class for document annotations 89 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxArrayPtrVoid*, wxIntegerHash, wxIntegerEqual, wxPdfAnnotationsMap, class WXDLLIMPEXP_PDFDOC); 90 91 /// Hashmap class for document annotations 92 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxArrayPtrVoid*, wxIntegerHash, wxIntegerEqual, wxPdfFormAnnotsMap, class WXDLLIMPEXP_PDFDOC); 93 94 /// Hashmap class for form fields 95 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxPdfIndirectObject*, wxIntegerHash, wxIntegerEqual, wxPdfFormFieldsMap, class WXDLLIMPEXP_PDFDOC); 96 97 /// Hashmap class for templates 98 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxPdfTemplate*, wxIntegerHash, wxIntegerEqual, wxPdfTemplatesMap, class WXDLLIMPEXP_PDFDOC); 99 100 /// Hashmap class for font encoding differences 101 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxString*, wxIntegerHash, wxIntegerEqual, wxPdfStringHashMap, class WXDLLIMPEXP_PDFDOC); 102 103 /// Hashmap class for extended graphics states 104 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxPdfExtGState*, wxIntegerHash, wxIntegerEqual, wxPdfExtGStateMap, class WXDLLIMPEXP_PDFDOC); 105 WX_DECLARE_HASH_MAP_WITH_DECL(long, int, wxIntegerHash, wxIntegerEqual, wxPdfExtGSLookupMap, class WXDLLIMPEXP_PDFDOC); 106 107 /// Hashmap class for gradients 108 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxPdfGradient*, wxIntegerHash, wxIntegerEqual, wxPdfGradientMap, class WXDLLIMPEXP_PDFDOC); 109 110 /// Hashmap class for optional content groups 111 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxPdfOcg*, wxIntegerHash, wxIntegerEqual, wxPdfOcgMap, class WXDLLIMPEXP_PDFDOC); 112 113 /// Hashmap class for optional content groups 114 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxPdfLayerGroup*, wxIntegerHash, wxIntegerEqual, wxPdfLayerRGMap, class WXDLLIMPEXP_PDFDOC); 115 116 /// Hashmap class for file attachments 117 WX_DECLARE_HASH_MAP_WITH_DECL(long, wxArrayString*, wxIntegerHash, wxIntegerEqual, wxPdfAttachmentMap, class WXDLLIMPEXP_PDFDOC); 118 119 /// Hashmap class for core fonts 120 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(int, wxPdfCoreFontMap, class WXDLLIMPEXP_PDFDOC); 121 122 /// Hashmap class for core fonts 123 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(int, wxPdfNamedLinksMap, class WXDLLIMPEXP_PDFDOC); 124 125 /// Hash map class for used/embedded fonts 126 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPdfFontDetails*, wxPdfFontHashMap, class WXDLLIMPEXP_PDFDOC); 127 128 /// Hash map class for embedded images 129 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPdfImage*, wxPdfImageHashMap, class WXDLLIMPEXP_PDFDOC); 130 131 /// Hash map class for spot colours 132 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPdfSpotColour*, wxPdfSpotColourMap, class WXDLLIMPEXP_PDFDOC); 133 134 /// Hash map class for spot colours 135 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPdfPattern*, wxPdfPatternMap, class WXDLLIMPEXP_PDFDOC); 136 137 /// Hash map class for spot colours 138 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPdfIndirectObject*, wxPdfRadioGroupMap, class WXDLLIMPEXP_PDFDOC); 139 140 /// Hash map class for parsers 141 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPdfParser*, wxPdfParserMap, class WXDLLIMPEXP_PDFDOC); 142 143 /// Class representing a PDF document. 144 #if WXPDFDOC_INHERIT_WXOBJECT 145 class WXDLLIMPEXP_PDFDOC wxPdfDocument : public wxObject 146 #else 147 class WXDLLIMPEXP_PDFDOC wxPdfDocument 148 #endif 149 { 150 public: 151 /// Constructor 152 /** 153 * \param orientation Defines the default page orientation. Possible values are: 154 * \li wxPORTRAIT portrait layout (default) 155 * \li wxLANDSCAPE landscape layout 156 * 157 * \param unit Defines the user units. Possible values are: 158 * \li "mm" millimeter (1 mm = 0.0394 in = 2.833 pt = 0.1 cm) (default) 159 * \li "cm" centimeter (1 cm = 0.394 in = 28.33 pt = 10 mm) 160 * \li "pt" points (1 pt = 1/72 in = 0.0353 cm = 0.353 mm) 161 * \li "in" inch (1 in = 72 pt = 2.54 cm = 25.4 mm) 162 * \param format Defines the page format. All known wxWidgets paper types are allowed. (Default: wxPAPER_A4) 163 */ 164 wxPdfDocument(int orientation = wxPORTRAIT, 165 const wxString& unit = wxString(wxS("mm")), 166 wxPaperSize format = wxPAPER_A4); 167 168 wxPdfDocument(int orientation, double pageWidth, double pageHeight, 169 const wxString& unit = wxString(wxS("mm"))); 170 171 virtual ~wxPdfDocument(); 172 173 /// Set permissions as well as user and owner passwords. 174 /** 175 * \param permissions flag indicating permissions. 176 * Flags from the following list may be combined as needed 177 * If a value is present it means that the permission is granted 178 * \param userPassword user password if applicable. 179 * If a user password is set, user will be prompted before document is opened 180 * \param ownerPassword owner password.if applicable 181 * If an owner password is set, the document can be opened 182 * in privilege mode with no restriction if that password is entered 183 * \param encryptionMethod selects the encryption method. Possible values are: 184 * \li wxPDF_ENCRYPTION_RC4V1 RC4 method, version 1, with 40 bit encryption key (default) 185 * \li wxPDF_ENCRYPTION_RC4V2 RC4 method, version 2, with 40..128 bit encryption key 186 * \li wxPDF_ENCRYPTION_AESV2 AES method, with 128 bit encryption key 187 * \param keyLength Length of the key used for encryption (Default: 0) 188 * The default value selects the standard encryption method revision 2 with a key length of 40 bits. 189 * Specifying a value > 0 selects the standard encryption method revision 3 with the given key length, 190 * the key length has to be in the range 40..128 and has to be dividable by 8. 191 * The key length is adjusted accordingly if these conditions are not met. 192 * NOTE: Adobe Reader supports only 40- and 128-bit encryption keys. 193 */ 194 virtual void SetProtection(int permissions, 195 const wxString& userPassword = wxEmptyString, 196 const wxString& ownerPassword = wxEmptyString, 197 wxPdfEncryptionMethod encryptionMethod = wxPDF_ENCRYPTION_RC4V1, 198 int keyLength = 0); 199 200 /// Set the image scale. 201 /** 202 * \param[in] scale image scale. 203 */ 204 virtual void SetImageScale(double scale); 205 206 /// Returns the image scale. 207 /** 208 * \return image scale. 209 */ 210 virtual double GetImageScale(); 211 212 /// Returns the page width in units. 213 /** 214 * \return int page width. 215 */ 216 virtual double GetPageWidth(); 217 218 /// Returns the page height in units. 219 /** 220 * \return int page height. 221 */ 222 virtual double GetPageHeight(); 223 224 /// Returns the page break margin. 225 /** 226 * \return int page break margin. 227 */ 228 virtual double GetBreakMargin(); 229 230 /// Returns the scale factor (number of points in user unit). 231 /** 232 * \return int scale factor. 233 */ 234 virtual double GetScaleFactor(); 235 236 /// Defines the left, top and right margins. 237 /** 238 * By default, they equal 1 cm. 239 * Call this method to change them. 240 * \param left Left margin. 241 * \param top Top margin. 242 * \param right Right margin. Default value is the left one. 243 * \see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak() 244 */ 245 virtual void SetMargins(double left, double top, double right = -1); 246 247 /// Defines the left margin. 248 /** 249 * The method can be called before creating the first page. 250 * If the current abscissa gets out of page, it is brought back to the margin. 251 * \param margin The margin. 252 * \see SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() 253 */ 254 virtual void SetLeftMargin(double margin); 255 256 /// Returns the left margin. 257 /** 258 * \return double left margin. 259 */ 260 virtual double GetLeftMargin(); 261 262 /// Defines the top margin. 263 /** 264 * The method can be called before creating the first page. 265 * \param margin The margin. 266 * \see SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() 267 */ 268 virtual void SetTopMargin(double margin); 269 270 /// Returns the top margin. 271 /** 272 * \return double top margin. 273 */ 274 virtual double GetTopMargin(); 275 276 /// Defines the right margin. 277 /** 278 * The method can be called before creating the first page. 279 * \param margin The margin. 280 * \see SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins() 281 */ 282 virtual void SetRightMargin(double margin); 283 284 /// Returns the right margin. 285 /** 286 * \return double right margin. 287 */ 288 virtual double GetRightMargin(); 289 290 /// Defines the cell margin. 291 /** 292 * The method can be called before creating the first page. 293 * \param margin The margin. 294 */ 295 virtual void SetCellMargin(double margin); 296 297 /// Returns the cell margin. 298 /** 299 * \return double cell margin. 300 */ 301 virtual double GetCellMargin(); 302 303 /// Sets the height of a text line 304 /** 305 * \param height The line height. 306 */ 307 virtual void SetLineHeight(double height); 308 309 /// Returns the height of a text line 310 /** 311 * \return double line height 312 */ 313 virtual double GetLineHeight(); 314 315 /// Enables or disables the automatic page breaking mode. 316 /** 317 * When enabling, the second parameter 318 * is the distance from the bottom of the page that defines the triggering limit. 319 * By default, the mode is on and the margin is 2 cm. 320 * \param autoPageBreak Boolean indicating if mode should be on or off. 321 * \param margin Distance from the bottom of the page. 322 * \see Cell(), MultiCell(), AcceptPageBreak() 323 */ 324 virtual void SetAutoPageBreak(bool autoPageBreak, double margin = 0); 325 326 /// Defines the way the document is to be displayed by the viewer. 327 /** 328 * The zoom level can be set:pages can be displayed entirely on screen, occupy the full width 329 * of the window, use real size, be scaled by a specific zooming factor or use viewer default 330 * (configured in the Preferences menu of Acrobat). The page layout can be specified too: 331 * single at once, continuous display, two columns or viewer default. By default, documents 332 * use the full width mode with continuous display. 333 * \param zoom The zoom to use. It can be one of the following string values or a number 334 * indicating the zooming factor to use. 335 * \li wxPDF_ZOOM_FULLPAGE: displays the entire page on screen 336 * \li wxPDF_ZOOM_FULLWIDTH: uses maximum width of window 337 * \li wxPDF_ZOOM_REAL: uses real size (equivalent to 100% zoom) 338 * \li wxPDF_ZOOM_DEFAULT: uses viewer default mode 339 * \li wxPDF_ZOOM_FACTOR: uses viewer default mode 340 * \param layout The page layout. Possible values are: 341 * \li wxPDF_LAYOUT_SINGLE: displays one page at once 342 * \li wxPDF_LAYOUT_CONTINUOUS: displays pages continuously (default) 343 * \li wxPDF_LAYOUT_TWO: displays two pages on two columns 344 * \li wxPDF_LAYOUT_DEFAULT: uses viewer default mode 345 * \param zoomFactor specifies the zoom factor in percent if layout is wxPDF_ZOOM_FACTOR 346 */ 347 virtual void SetDisplayMode(wxPdfZoom zoom, 348 wxPdfLayout layout = wxPDF_LAYOUT_CONTINUOUS, 349 double zoomFactor = 100.); 350 351 /// Enable or disable kerning. 352 /** 353 * When enabled, kerning is applied to text output. 354 * Kerning is disabled by default. 355 * \param kerning Boolean indicating if kerning should be enabled. 356 */ 357 virtual void SetKerning(bool kerning); 358 359 /// Activates or deactivates page compression. 360 /** 361 * When activated, the internal representation of each 362 * page is compressed, which leads to a compression ratio of about 2 for the resulting document. 363 * Compression is on by default. 364 * \param compress Boolean indicating if compression must be enabled. 365 */ 366 virtual void SetCompression(bool compress); 367 368 /// Defines the viewer preferences. 369 /** 370 * \param preferences A set of viewer preferences options. 371 * \li wxPDF_VIEWER_HIDETOOLBAR: Hide tool bar 372 * \li wxPDF_VIEWER_HIDEMENUBAR: Hide menu bar 373 * \li wxPDF_VIEWER_HIDEWINDOWUI: Hide user interface 374 * \li wxPDF_VIEWER_FITWINDOW: Fit window to page size 375 * \li wxPDF_VIEWER_CENTERWINDOW: Center window on screen 376 * \li wxPDF_VIEWER_DISPLAYDOCTITLE: Display document title in title bar 377 */ 378 virtual void SetViewerPreferences(int preferences = 0); 379 380 /// Defines the title of the document. 381 /** 382 * \param title The title. 383 * \see SetAuthor(), SetCreator(), SetKeywords(), SetSubject() 384 */ 385 virtual void SetTitle(const wxString& title); 386 387 /// Defines the subject of the document. 388 /** 389 * \param subject The subject. 390 * \see SetAuthor(), SetCreator(), SetKeywords(), SetTitle() 391 */ 392 virtual void SetSubject(const wxString& subject); 393 394 /// Defines the author of the document. 395 /** 396 * \param author The name of the author. 397 * \see SetCreator(), SetKeywords(), SetSubject(), SetTitle() 398 */ 399 virtual void SetAuthor(const wxString& author); 400 401 /// Associates keywords with the document, 402 /** 403 * Generally keywords are in the form 'keyword1 keyword2 ...'. 404 * \param keywords The list of keywords. 405 * \see SetAuthor(), SetCreator(), SetSubject(), SetTitle() 406 */ 407 virtual void SetKeywords(const wxString& keywords); 408 409 /// Defines the creator of the document. 410 /** 411 * This is typically the name of the application that generates the PDF. 412 * \param creator The name of the creator. 413 * \see SetAuthor(), SetKeywords(), SetSubject(), SetTitle() 414 */ 415 virtual void SetCreator(const wxString& creator); 416 417 /// Defines the creation timestamp of the document. 418 /** 419 * Optionally the creation date can be specified with this method. 420 * If this method is not called the default is the current date and time. 421 * \param creationDate The date and time to be used as the creation timestamp. 422 * \see SetAuthor(), SetKeywords(), SetSubject(), SetTitle() 423 */ 424 virtual void SetCreationDate(const wxDateTime& creationDate); 425 426 /// Defines an alias for the total number of pages. 427 /** 428 * It will be substituted as the document is closed. 429 * \param alias The alias. Default value: {nb}. 430 * \see PageNo(), Footer() 431 */ 432 virtual void AliasNbPages(const wxString& alias = wxString(wxS("{nb}"))); 433 434 /// This method begins the generation of the PDF document. 435 /** 436 * It is not necessary to call it explicitly 437 * because AddPage() does it automatically. 438 * Note: no page is created by this method 439 * \see AddPage(), Close() 440 */ 441 virtual void Open(); 442 443 /// Terminates the PDF document. 444 /** 445 * It is not necessary to call this method explicitly because SaveAsFile() 446 * does it automatically. If the document contains no page, AddPage() is called to prevent from getting 447 * an invalid document. 448 * \see Open(), SaveAsFile() 449 */ 450 virtual void Close(); 451 452 /// Adds a new page to the document. 453 /** 454 * If a page is already present, the Footer() method is called first 455 * to output the footer. Then the page is added, the current position set to the top-left corner according 456 * to the left and top margins, and Header() is called to display the header. 457 * The font which was set before calling is automatically restored. There is no need to call SetFont() 458 * again if you want to continue with the same font. The same is true for colours and line width. 459 * The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards. 460 * \param orientation Page orientation. Possible values are: 461 * \li wxPORTRAIT 462 * \li wxLANDSCAPE 463 * The default value is the one passed to the constructor. 464 * \see FPDF(), Header(), Footer(), SetMargins() 465 */ 466 virtual void AddPage(int orientation = -1); 467 468 virtual void AddPage(int orientation, wxPaperSize format); 469 470 virtual void AddPage(int orientation, double pageWidth, double pageHeight); 471 472 /// This method is used to render the page header. 473 /** 474 * It is automatically called by AddPage() and should not be called directly by the application. 475 * The implementation in wxPdfDocument is empty, so you have to subclass it and override the method 476 * if you want a specific processing. 477 * \see Footer() 478 */ 479 virtual void Header(); 480 481 /// This method is used to render the page footer. 482 /** 483 * It is automatically called by AddPage() and Close() and should not be called directly by 484 * the application. The implementation in wxPdfDocument is empty, so you have to subclass it 485 * and override the method if you want a specific processing. 486 * \see Header() 487 */ 488 virtual void Footer(); 489 490 /// Returns whether footer output is in progress 491 /** 492 * \return true if footer output is in progress, false otherwise 493 * \see Header() 494 */ 495 virtual bool IsInFooter(); 496 497 /// Returns the current page number. 498 /** 499 * \return page number 500 * \see AliasNbPages() 501 */ 502 virtual int PageNo(); 503 504 /// Add spot colour 505 /** 506 * Add a spot colour which can be referenced in colour setting methods 507 * \param name the name of the spot colour (case sensitive) 508 * \param cyan indicates the cyan level. Value between 0 and 100 509 * \param magenta indicates the magenta level. Value between 0 and 100 510 * \param yellow indicates the yellow level. Value between 0 and 100 511 * \param black indicates the black level. Value between 0 and 100 512 * \see SetDrawColour(), SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell() 513 */ 514 virtual void AddSpotColour(const wxString& name, double cyan, double magenta, double yellow, double black); 515 516 /// Add an image pattern 517 /** 518 * Add a pattern which can be reference in draw or fill pattern methods 519 * \param patternName the name of the pattern (case sensitive) 520 * \param image the image to use for the pattern 521 * \param width the display width 522 * \param height the display height 523 */ 524 virtual bool AddPattern(const wxString& patternName, const wxImage& image, double width, double height); 525 526 /// Defines the colour used for all drawing operations. 527 /** 528 * Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB 529 * components or gray scale. The method can be called before the first page is created and the value 530 * is retained from page to page. 531 * \param grayscale indicates the gray level. Value between 0 and 255 532 * \see SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell() 533 */ 534 virtual void SetDrawColour(const unsigned char grayscale); 535 536 /// Defines the colour used for all drawing operations. 537 /** 538 * Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB 539 * components or gray scale. The method can be called before the first page is created and the value 540 * is retained from page to page. 541 * \param colour defines a colour composed of a red, green and blue component 542 * \see SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell() 543 */ 544 virtual void SetDrawColour(const wxColour& colour); 545 546 /// Defines the colour used for all drawing operations. 547 /** 548 * Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB 549 * components or gray scale. The method can be called before the first page is created and the value 550 * is retained from page to page. 551 * \param colour defines a colour using the class wxPdfColour 552 * \see SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell() 553 */ 554 virtual void SetDrawColour(const wxPdfColour& colour); 555 556 /// Defines the colour used for all drawing operations. 557 /** 558 * Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB 559 * components or gray scale. The method can be called before the first page is created and the value 560 * is retained from page to page. 561 * \param red indicates the red level. Value between 0 and 255 562 * \param green indicates the green level. Value between 0 and 255 563 * \param blue indicates the blue level. Value between 0 and 255 564 * \see SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell() 565 */ 566 virtual void SetDrawColour(const unsigned char red, const unsigned char green, const unsigned char blue); 567 568 /// Defines the colour used for all drawing operations. 569 /** 570 * Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB 571 * components or gray scale. The method can be called before the first page is created and the value 572 * is retained from page to page. 573 * \param cyan indicates the cyan level. Value between 0 and 100 574 * \param magenta indicates the magenta level. Value between 0 and 100 575 * \param yellow indicates the yellow level. Value between 0 and 100 576 * \param black indicates the black level. Value between 0 and 100 577 * \see SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell() 578 */ 579 virtual void SetDrawColour(double cyan, double magenta, double yellow, double black); 580 581 /// Defines the <b>spot colour</b> used for all drawing operations. 582 /** 583 * Affected drawing operations are: lines, rectangles and cell borders. It can be expressed in RGB 584 * components or gray scale. The method can be called before the first page is created and the value 585 * is retained from page to page. 586 * \param name the name of the spot colour 587 * \param tint indicates the tint level. Value between 0 and 100. Default: 100. 588 * \see SetFillColour(), SetTextColour(), Line(), Rect(), Cell(), MultiCell() 589 */ 590 virtual void SetDrawColour(const wxString& name, double tint = 100); 591 592 /// Defines the <b>pattern</b> used for all drawing operations. 593 /** 594 * The given pattern is used for all drawing operations instead of a colour. 595 * Affected drawing operations are: lines, rectangles and cell borders. 596 * The method can be called before the first page is created and the value 597 * is retained from page to page. 598 * \param name the name of the pattern 599 * \see SetFillPattern() 600 */ 601 virtual void SetDrawPattern(const wxString& name); 602 603 /// Gets the colour used for all drawing operations. 604 /** 605 * \see SetDrawColour() 606 */ 607 virtual const wxPdfColour GetDrawColour(); 608 609 /// Defines the colour used for all filling operations. 610 /** 611 * Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB 612 * components or gray scale. The method can be called before the first page is created and the value is 613 * retained from page to page. 614 * \param grayscale indicates the gray level. Value between 0 and 255 615 * \see SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell() 616 */ 617 virtual void SetFillColour(const unsigned char grayscale); 618 619 /// Defines the colour used for all filling operations. 620 /** 621 * Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB 622 * components or gray scale. The method can be called before the first page is created and the value is 623 * retained from page to page. 624 * \param colour defines a colour composed of a red, green and blue component 625 * \see SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell() 626 */ 627 virtual void SetFillColour(const wxColour& colour); 628 629 /// Defines the colour used for all filling operations. 630 /** 631 * Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB 632 * components or gray scale. The method can be called before the first page is created and the value is 633 * retained from page to page. 634 * \param colour defines a colour using the class wxPdfColour 635 * \see SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell() 636 */ 637 virtual void SetFillColour(const wxPdfColour& colour); 638 639 /// Defines the colour used for all filling operations. 640 /** 641 * Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB 642 * components or gray scale. The method can be called before the first page is created and the value is 643 * retained from page to page. 644 * \param red indicates the red level. Value between 0 and 255 645 * \param green indicates the green level. Value between 0 and 255 646 * \param blue indicates the blue level. Value between 0 and 255 647 * \see SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell() 648 */ 649 virtual void SetFillColour(const unsigned char red, const unsigned char green, const unsigned char blue); 650 651 /// Defines the colour used for all filling operations. 652 /** 653 * Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB 654 * components or gray scale. The method can be called before the first page is created and the value is 655 * retained from page to page. 656 * \param cyan indicates the cyan level. Value between 0 and 100 657 * \param magenta indicates the magenta level. Value between 0 and 100 658 * \param yellow indicates the yellow level. Value between 0 and 100 659 * \param black indicates the black level. Value between 0 and 100 660 * \see SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell() 661 */ 662 virtual void SetFillColour(double cyan, double magenta, double yellow, double black); 663 664 /// Defines the <b>spot colour</b> used for all filling operations. 665 /** 666 * Affected filling operations are: filled rectangles and cell backgrounds. It can be expressed in RGB 667 * components or gray scale. The method can be called before the first page is created and the value is 668 * retained from page to page. 669 * \param name is the name of the spot colour 670 * \param tint indicates the tint level. Value between 0 and 100. Default: 100. 671 * \see SetDrawColour(), SetTextColour(), Rect(), Cell(), MultiCell() 672 */ 673 virtual void SetFillColour(const wxString& name, double tint = 100); 674 675 /// Defines the <b>pattern</b> used for all filling operations. 676 /** 677 * The given pattern is used for all filling operations instead of a colour. 678 * Affected filling operations are: filled rectangles and cell backgrounds. 679 * The method can be called before the first page is created and the value 680 * is retained from page to page. 681 * \param name the name of the pattern 682 * \see SetDrawPattern() 683 */ 684 virtual void SetFillPattern(const wxString& name); 685 686 /// Gets the named pattern as a colour. 687 /** 688 * \param patternName the name of the pattern 689 * \see SetDrawPattern(), SetFillPattern(), AddPattern() 690 */ 691 virtual const wxPdfColour GetPatternColour(const wxString& patternName); 692 693 /// Gets the colour used for all filling operations. 694 /** 695 * \see SetFillColour() 696 */ 697 virtual const wxPdfColour GetFillColour(); 698 699 /// Defines the colour used for text. 700 /** 701 * It can be expressed in RGB components or gray scale. The method can be called before the first page is 702 * created and the value is retained from page to page. 703 * \param grayscale indicates the gray level. Value between 0 and 255 704 * \see SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell() 705 */ 706 virtual void SetTextColour(const unsigned char grayscale); 707 708 /// Defines the colour used for text. 709 /** 710 * It can be expressed in RGB components or gray scale. The method can be called before the first page is 711 * created and the value is retained from page to page. 712 * \param colour defines a colour composed of a red, green and blue component 713 * \see SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell() 714 */ 715 virtual void SetTextColour(const wxColour& colour); 716 717 /// Defines the colour used for text. 718 /** 719 * It can be expressed in RGB components or gray scale. The method can be called before the first page is 720 * created and the value is retained from page to page. 721 * \param colour defines a colour using the class wxPdfColour 722 * \see SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell() 723 */ 724 virtual void SetTextColour(const wxPdfColour& colour); 725 726 /// Defines the colour used for text. 727 /** 728 * It can be expressed in RGB components or gray scale. The method can be called before the first page is 729 * created and the value is retained from page to page. 730 * \param red indicates the red level. Value between 0 and 255 731 * \param green indicates the green level. Value between 0 and 255 732 * \param blue indicates the blue level. Value between 0 and 255 733 * \see SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell() 734 */ 735 virtual void SetTextColour(const unsigned char red, const unsigned char green, const unsigned char blue); 736 737 /// Defines the colour used for text. 738 /** 739 * It can be expressed in RGB components or gray scale. The method can be called before the first page is 740 * created and the value is retained from page to page. 741 * \param cyan indicates the cyan level. Value between 0 and 100 742 * \param magenta indicates the magenta level. Value between 0 and 100 743 * \param yellow indicates the yellow level. Value between 0 and 100 744 * \param black indicates the black level. Value between 0 and 100 745 * \see SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell() 746 */ 747 virtual void SetTextColour(double cyan, double magenta, double yellow, double black); 748 749 /// Defines the <b>spot colour</b> used for text. 750 /** 751 * It can be expressed in RGB components or gray scale. The method can be called before the first page is 752 * created and the value is retained from page to page. 753 * \param name the name of the spot colour 754 * \param tint indicates the tint level. Value between 0 and 100. Default: 100. 755 * \see SetDrawColour(), SetFillColour(), Text(), Cell(), MultiCell() 756 */ 757 virtual void SetTextColour(const wxString& name, double tint = 100); 758 759 /// Defines the <b>pattern</b> used for text output. 760 /** 761 * The given pattern is used for text output instead of a colour. 762 * The method can be called before the first page is created and the value 763 * is retained from page to page. 764 * \param name the name of the pattern 765 * \see SetDrawPattern() 766 */ 767 virtual void SetTextPattern(const wxString& name); 768 769 /// Gets the colour used for text output. 770 /** 771 * \see SetTextColour() 772 */ 773 virtual const wxPdfColour GetTextColour(); 774 775 /// Sets the text render mode 776 /** 777 * \param mode the text render mode 778 */ 779 virtual void SetTextRenderMode(wxPdfTextRenderMode mode = wxPDF_TEXT_RENDER_FILL); 780 781 /// Returns the text render mode 782 /** 783 */ 784 virtual wxPdfTextRenderMode GetTextRenderMode() const; 785 786 /// Returns the length of a string in user unit. 787 /** 788 * A font must be selected. 789 * \param s The string whose length is to be computed 790 * \return int 791 */ 792 virtual double GetStringWidth(const wxString& s); 793 794 /// Defines the line width. 795 /** 796 * By default, the value equals 0.2 mm. The method can be called before the first page is created 797 * and the value is retained from page to page. 798 * \param width The width. 799 * \see Line(), Rect(), Cell(), MultiCell() 800 */ 801 virtual void SetLineWidth(double width); 802 803 /// Gets the current line width. 804 /** 805 * \return current line width 806 * \see Line(), Rect(), Cell(), MultiCell() 807 */ 808 virtual double GetLineWidth(); 809 810 /// Sets line style 811 /** 812 * \param linestyle: Line style. \see wxPdfLineStale 813 */ 814 virtual void SetLineStyle(const wxPdfLineStyle& linestyle); 815 816 /// Get current line style 817 /** 818 * \return current line style. 819 */ 820 virtual const wxPdfLineStyle& GetLineStyle(); 821 822 /// Set the filling rule 823 /** 824 * \param rule The filling rule to be used in complex filling operations. Possible values are: 825 * \li wxWINDING_RULE (default) 826 * \li wxODDEVEN_RULE 827 */ 828 virtual void SetFillingRule(int rule = wxWINDING_RULE); 829 830 /// Get the current filling rule 831 /** 832 * \return the current filling rule 833 */ 834 virtual int GetFillingRule(); 835 836 /// Draws a line between two points. 837 /** 838 * \param x1 Abscissa of first point 839 * \param y1 Ordinate of first point 840 * \param x2 Abscissa of second point 841 * \param y2 Ordinate of second point 842 * \see SetLineWidth(), SetDrawColour() 843 */ 844 virtual void Line(double x1, double y1, double x2, double y2); 845 846 /// Draws an arrow line between two points. 847 /** 848 * \param x1 Abscissa of first point 849 * \param y1 Ordinate of first point 850 * \param x2 Abscissa of second point 851 * \param y2 Ordinate of second point 852 * \param linewidth line width 853 * \param height height of the arrow head 854 * \param width width of the arrow head 855 * \see SetLineWidth(), SetDrawColour(), SetFillColour() 856 */ 857 virtual void Arrow(double x1, double y1, double x2, double y2, double linewidth, double height, double width); 858 859 /// Outputs a rectangle. 860 /** 861 * It can be drawn (border only), filled (with no border) or both. 862 * \param x Abscissa of upper-left corner 863 * \param y Ordinate of upper-left corner 864 * \param w Width 865 * \param h Height 866 * \param style Style of rendering. Possible values are: 867 * \li wxPDF_STYLE_DRAW (default) 868 * \li wxPDF_STYLE_FILL: fill 869 * \li wxPDF_STYLE_FILLDRAW: draw and fill 870 * \see SetLineWidth(), SetDrawColour(), SetFillColour() 871 */ 872 virtual void Rect(double x, double y, double w, double h, int style = wxPDF_STYLE_DRAW); 873 874 /// Draws a rounded rectangle 875 /** 876 * \param x Abscissa of upper-left corner 877 * \param y Ordinate of upper-left corner 878 * \param w Width 879 * \param h Height 880 * \param r: Radius of the rounded corners 881 * \param roundCorner: Draws rounded corner or not. 882 * \li wxPDF_CORNER_NONE no rounded corners 883 * \li wxPDF_CORNER_TOP_LEFT top left corner 884 * \li wxPDF_CORNER_TOP_RIGHT top right corner 885 * \li wxPDF_CORNER_BOTTOM_LEFT bottom left corner 886 * \li wxPDF_CORNER_BOTTOM_RIGHT bottom right corner 887 * \li wxPDF_CORNER_ALL all corners 888 * \param style: Style of rectangle (draw and/or fill) 889 */ 890 virtual void RoundedRect(double x, double y, double w, double h, 891 double r, int roundCorner = wxPDF_CORNER_ALL, int style = wxPDF_STYLE_DRAW); 892 893 /// Draws a Bezier curve 894 /** 895 * A Bezier curve is tangent to the line between the control points at either end of the curve. 896 * \param x0: Abscissa of start point 897 * \param y0: Ordinate of start point 898 * \param x1: Abscissa of control point 1 899 * \param y1: Ordinate of control point 1 900 * \param x2: Abscissa of control point 2 901 * \param y2: Ordinate of control point 2 902 * \param x3: Abscissa of end point 903 * \param y3: Ordinate of end point 904 * \param style: Style of rectangle (draw and/or fill) 905 */ 906 virtual void Curve(double x0, double y0, double x1, double y1, 907 double x2, double y2, double x3, double y3, 908 int style = wxPDF_STYLE_DRAW); 909 910 /// Draws an ellipse 911 /** 912 * \param x0: Abscissa of Center point 913 * \param y0: Ordinate of Center point 914 * \param rx: Horizontal radius 915 * \param ry: Vertical radius (if ry = 0, draws a circle) 916 * \param angle: Orientation angle (anti-clockwise) 917 * \param astart: Start angle 918 * \param afinish: Finish angle 919 * \param style: Style of rectangle (draw and/or fill) 920 * \param nSeg: Ellipse is made up of nSeg Bezier curves 921 * \param doSector: connect end points of elliptic arc with center point 922 */ 923 virtual void Ellipse(double x0, double y0, double rx, double ry = 0, 924 double angle = 0, double astart = 0, double afinish = 360, 925 int style = wxPDF_STYLE_DRAW, int nSeg = 8, bool doSector = false); 926 927 /// Draws a circle 928 /** 929 * \param x0: Abscissa of Center point 930 * \param y0: Ordinate of Center point 931 * \param r: Radius 932 * \param astart: Start angle 933 * \param afinish: Finish angle 934 * \param style: Style of rectangle (draw and/or fill) 935 * \param nSeg: Circle is made up of nSeg Bezier curves 936 */ 937 virtual void Circle(double x0, double y0, double r, 938 double astart = 0, double afinish = 360, 939 int style = wxPDF_STYLE_DRAW, int nSeg = 8); 940 941 /// Draws a sector 942 /** 943 * \param x0: Abscissa of Center point 944 * \param y0: Ordinate of Center point 945 * \param r: Radius 946 * \param astart: Start angle 947 * \param afinish: Finish angle 948 * \param style: Style of rectangle (draw and/or fill, default: fill&draw) 949 * \param clockwise: indicates whether to go clockwise (default: true) 950 * \param origin: origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock; default: 90) 951 */ 952 virtual void Sector(double x0, double y0, double r, double astart, double afinish, 953 int style = wxPDF_STYLE_FILLDRAW, bool clockwise = true, double origin = 90.); 954 955 /// Draws a polygon 956 /** 957 * \param x Array with abscissa values 958 * \param y Array with ordinate values 959 * \param style: Style of polygon (draw and/or fill) 960 */ 961 virtual void Polygon(const wxPdfArrayDouble& x, const wxPdfArrayDouble& y, 962 int style = wxPDF_STYLE_DRAW); 963 964 /// Draws a regular polygon 965 /** 966 * \param x0: Abscissa of Center point 967 * \param y0: Ordinate of Center point 968 * \param r: Radius of circumscribed circle 969 * \param ns: Number of sides 970 * \param angle: Orientation angle (anti-clockwise) 971 * \param circle: Flag whether to draw circumscribed circle or not 972 * \param style: Style of polygon (draw and/or fill) 973 * \param circleStyle: Style of circumscribed circle (draw and/or fill) (if draw) 974 * \param circleLineStyle: Line style for circumscribed circle. (if draw) 975 * \param circleFillColour: Fill colour for circumscribed circle. (if draw fill circle) 976 */ 977 virtual void RegularPolygon(double x0, double y0, double r, int ns, double angle = 0, bool circle = false, 978 int style = wxPDF_STYLE_DRAW, 979 int circleStyle = wxPDF_STYLE_DRAW, 980 const wxPdfLineStyle& circleLineStyle = wxPdfLineStyle(), 981 const wxPdfColour& circleFillColour = wxPdfColour()); 982 983 /// Draws a star polygon 984 /** 985 * \param x0: Abscissa of Center point 986 * \param y0: Ordinate of Center point 987 * \param r: Radius of circumscribed circle 988 * \param nv: Number of vertices 989 * \param ng: Number of gaps (ng % nv = 1 => regular polygon) 990 * \param angle: Orientation angle (anti-clockwise) 991 * \param circle: Flag whether to draw circumscribed circle or not 992 * \param style: Style of polygon (draw and/or fill) 993 * \param circleStyle: Style of circumscribed circle (draw and/or fill) (if draw) 994 * \param circleLineStyle: Line style for circumscribed circle. (if draw) 995 * \param circleFillColour: Fill colour for circumscribed circle. (if draw fill circle) 996 */ 997 virtual void StarPolygon(double x0, double y0, double r, int nv, int ng, double angle = 0, bool circle = false, 998 int style = wxPDF_STYLE_DRAW, 999 int circleStyle = wxPDF_STYLE_DRAW, 1000 const wxPdfLineStyle& circleLineStyle = wxPdfLineStyle(), 1001 const wxPdfColour& circleFillColour = wxPdfColour()); 1002 1003 /// Draws a Bezier spline through a list of points 1004 /** 1005 * \param x Array with abscissa values 1006 * \param y Array with ordinate values 1007 * \param style: Style of the spline (draw and/or fill) 1008 */ 1009 virtual void BezierSpline(const wxPdfArrayDouble& x, const wxPdfArrayDouble& y, int style); 1010 1011 /// Draws a closed Bezier spline through a list of points 1012 /** 1013 * \param x Array with abscissa values 1014 * \param y Array with ordinate values 1015 * \param style: Style of the spline (draw and/or fill) 1016 */ 1017 virtual void ClosedBezierSpline(const wxPdfArrayDouble& x, const wxPdfArrayDouble& y, int style); 1018 1019 /// Draws a shape 1020 /** 1021 * \param shape: shape to be drawn 1022 * \param style Style of rendering. Possible values are: 1023 * \li wxPDF_STYLE_DRAW (default) 1024 * \li wxPDF_STYLE_FILL: fill 1025 * \li wxPDF_STYLE_FILLDRAW: draw and fill 1026 * \li wxPDF_STYLE_DRAWCLOSE: close path and draw (can be combined with wxPDF_STYLE_FILL 1027 */ 1028 virtual void Shape(const wxPdfShape& shape, int style = wxPDF_STYLE_DRAW); 1029 1030 /// Performs a rotation around a given center. 1031 /** 1032 * \param angle angle in degrees. 1033 * \param x abscissa of the rotation center. Default value: current position. 1034 * \param y ordinate of the rotation center. Default value: current position. 1035 * 1036 * The rotation affects all elements which are printed after the method call 1037 * (with the exception of the clickable areas). 1038 * 1039 * Remarks: 1040 * \li Only the display is altered. The GetX() and GetY() methods are not affected, 1041 * nor the automatic page break mechanism. 1042 * \li Rotation is not kept from page to page. Each page begins with a null rotation. 1043 */ 1044 virtual void Rotate(double angle, double x = -1, double y = -1); 1045 1046 /// Sets the font embedding mode 1047 /** 1048 * If other fonts than the 14 Adobe core fonts are used in a document, they are usually 1049 * embedded into the PDF file, often resulting in rather large PDF files. This is 1050 * especially true for Unicode fonts with thousands of glyphs. To reduce the size of 1051 * the resulting PDF file fonts may be subsetted, that is, only those glyphs actually 1052 * used in the document are embedded. 1053 * 1054 * Currently wxPdfDocument supports font subsetting for TrueType Unicode fonts only. 1055 * 1056 * \param fontSubsetting Boolean indicating whether font subsetting should be used or not. 1057 */ 1058 virtual void SetFontSubsetting(bool fontSubsetting = true) { m_fontSubsetting = fontSubsetting; } 1059 1060 /// Returns the font embedding mode 1061 /** 1062 * \return true if font subsetting is enabled, false otherwise 1063 */ GetFontSubsetting()1064 virtual bool GetFontSubsetting() const { return m_fontSubsetting; } 1065 1066 /// Imports a TrueType, TrueTypeUnicode or Type1 font and makes it available. 1067 /** 1068 * It is necessary to generate a font definition file first with the makefont utility. 1069 * The definition file (and the font file itself when embedding) must be present either 1070 * in the subdirectory 'fonts' of the current working directory or in the one indicated 1071 * by WXPDF_FONTPATH if this environment variable is defined. 1072 * \param family Font family. The name can be chosen arbitrarily. If it is a standard family name, 1073 * it will override the corresponding font. 1074 * \param style Font style. Possible values are (case insensitive): 1075 * \li empty string: regular (default) 1076 * \li B: bold 1077 * \li I: italic 1078 * \li BI or IB: bold italic 1079 * \param file The font definition file. By default, the name is built from the family and style, 1080 * in lower case with no space. 1081 * \see SetFont() 1082 * \deprecated use the wxPdfFontManager to register fonts for use in creating PDF documents 1083 */ 1084 virtual bool AddFont(const wxString& family, 1085 const wxString& style = wxEmptyString, 1086 const wxString& file = wxEmptyString); 1087 1088 /// Imports a CJK (Chinese, Japanese or Korean) font and makes it available. 1089 /** 1090 * It is necessary to generate a font definition file first with the makefont utility. 1091 * The definition file (and the font file itself when embedding) must be present either 1092 * in the current directory or in the one indicated by WXPDF_FONTPATH if the constant is 1093 * defined. 1094 * \param family Font family. The name can be chosen arbitrarily. If it is a standard family name, 1095 * it will override the corresponding font. 1096 * 1097 * All font styles (regular, bold, italic and bold-italic) are made available 1098 * The font definition file name is built from the family in lower case with no space. 1099 * There are several predefined font definition files available: 1100 * \li BIG5 Chinese (traditional) 1101 * \li BIG5-HW Chinese (traditional) half-width ASCII characters 1102 * \li GB Chinese (simplified) 1103 * \li GB-HW Chinese (simplified) half-width ASCII characters 1104 * \li SJIS Japanese 1105 * \li SJIS-HW Japanese, half-width ASCII characters 1106 * \li UHC Korean 1107 * \li UHC-HW Korean, half-width ASCII characters 1108 * 1109 * These fonts require that the Adobe CJK font support is installed 1110 * \see SetFont() 1111 * \deprecated use the wxPdfFontManager to register fonts for use in creating PDF documents 1112 */ 1113 #if wxUSE_UNICODE 1114 virtual bool AddFontCJK(const wxString& family); 1115 #else AddFontCJK(const wxString & family)1116 virtual bool AddFontCJK(const wxString& family) 1117 { 1118 wxUnusedVar(family); 1119 return false; 1120 } 1121 #endif 1122 1123 /// Sets the font used to print character strings. 1124 /** 1125 * It is mandatory to call a variant of this method at least once before printing text or the 1126 * resulting document would not be valid. 1127 * The font can be either a standard one or a font added via the AddFont() method. 1128 * Standard fonts use Windows encoding cp1252 (Western Europe). 1129 * The method can be called before the first page is created and the font is retained from page to page. 1130 * If you just wish to change the current font size, it is simpler to call SetFontSize(). 1131 * 1132 * \param family Family font. It can be either a name defined by AddFont() or one of the standard 1133 * families (case insensitive): 1134 * \li Courier (fixed-width) 1135 * \li Helvetica or Arial (synonymous; sans serif) 1136 * \li Times (serif) 1137 * \li Symbol (symbolic) 1138 * \li ZapfDingbats (symbolic) 1139 * 1140 * It is also possible to pass an empty string. In that case, the current family is retained. 1141 * \param style Font style. Possible values are (case insensitive): 1142 * \li empty string: regular (default) 1143 * \li B: bold 1144 * \li I: italic 1145 * \li BI or IB: bold italic 1146 * \li U: underline 1147 * or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats 1148 * \param size Font size in points. The default value is the current size. If no size has been 1149 * specified since the beginning of the document, the value taken is 12 1150 * \see AddFont(), SetFontSize(), Cell(), MultiCell(), Write() 1151 */ 1152 virtual bool SetFont(const wxString& family, 1153 const wxString& style = wxEmptyString, 1154 double size = 0); 1155 1156 /// Sets the font used to print character strings. 1157 /** 1158 * It is mandatory to call a variant of this method at least once before printing text or the 1159 * resulting document would not be valid. 1160 * The font can be either a standard one or a font added via the AddFont() method. 1161 * Standard fonts use Windows encoding cp1252 (Western Europe). 1162 * The method can be called before the first page is created and the font is retained from page to page. 1163 * If you just wish to change the current font size, it is simpler to call SetFontSize(). 1164 * 1165 * \param family Family font. It can be either a name defined by AddFont() or one of the standard 1166 * families (case insensitive): 1167 * \li Courier (fixed-width) 1168 * \li Helvetica or Arial (synonymous; sans serif) 1169 * \li Times (serif) 1170 * \li Symbol (symbolic) 1171 * \li ZapfDingbats (symbolic) 1172 * 1173 * It is also possible to pass an empty string. In that case, the current family is retained. 1174 * \param style Font style. Possible values are (case insensitive): 1175 * \li wxPDF_FONTSTYLE_REGULAR : regular (default) 1176 * \li wxPDF_FONTSTYLE_ITALIC : italic 1177 * \li wxPDF_FONTSTYLE_BOLD : bold 1178 * \li wxPDF_FONTSTYLE_UNDERLINE : underline 1179 * \li wxPDF_FONTSTYLE_OVERLINE : overline 1180 * \li wxPDF_FONTSTYLE_STRIKEOUT : strike through 1181 * or any combination. 1182 * \param size Font size in points. The default value is the current size. If no size has been 1183 * specified since the beginning of the document, the value taken is 12 1184 * \see AddFont(), SetFontSize(), Cell(), MultiCell(), Write() 1185 */ 1186 virtual bool SetFont(const wxString& family, int style, double size = 0); 1187 1188 /// Sets the font used to print character strings based on a wxFont object. 1189 /** 1190 * The font referenced by the wxFont object will be added to the document if necessary. 1191 * 1192 * \param font The font to be set. 1193 * \param style Font style. Possible values are (case insensitive): 1194 * \li empty string: regular (default) 1195 * \li B: bold 1196 * \li I: italic 1197 * \li BI or IB: bold italic 1198 * \li U: underline 1199 * or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats 1200 * \param size Font size in points. The default value is the current size. If no size has been 1201 * \see AddFont(), SetFont(), SetFontSize(), Cell(), MultiCell(), Write() 1202 */ 1203 virtual bool SetFont(const wxPdfFont& font, int style = wxPDF_FONTSTYLE_REGULAR, double size = 0); 1204 1205 /// Sets the font used to print character strings based on a wxFont object. 1206 /** 1207 * The font referenced by the wxFont object will be added to the document if necessary. 1208 * 1209 * \param font The font to be set. 1210 * \see AddFont(), SetFont(), SetFontSize(), Cell(), MultiCell(), Write() 1211 */ 1212 virtual bool SetFont(const wxFont& font); 1213 1214 /// Defines the size of the current font. 1215 /** 1216 * \param size The size (in points) 1217 * \see SetFont() 1218 */ 1219 virtual void SetFontSize(double size); 1220 1221 /// Returns the current font. 1222 /** 1223 * \return The current font. 1224 * \see SetFont() 1225 */ 1226 virtual wxPdfFont GetCurrentFont() const; 1227 1228 /// Returns the current font description instance. 1229 /** 1230 * \return The current font description. 1231 * \see SetFont() 1232 */ 1233 virtual const wxPdfFontDescription& GetFontDescription() const; 1234 1235 /// Gets the font family of the current font. 1236 /** 1237 * \return The font family of the current font 1238 * \see SetFont() 1239 */ 1240 virtual const wxString GetFontFamily(); 1241 1242 /// Gets the style of the current font. 1243 /** 1244 * \return The style of the current font as a string 1245 * \see SetFont() 1246 */ 1247 virtual const wxString GetFontStyle() const; 1248 1249 /// Gets the style of the current font. 1250 /** 1251 * \return The style of the current font 1252 * \see SetFont() 1253 */ 1254 virtual int GetFontStyles() const; 1255 1256 /// Gets the size of the current font. 1257 /** 1258 * \return The size (in points) of the current font 1259 * \see SetFont() 1260 */ 1261 virtual double GetFontSize() const; 1262 1263 /// Creates a new internal link and returns its identifier. 1264 /** 1265 * An internal link is a clickable area which directs to another place within the document. 1266 * The identifier can then be passed to Cell(), Write(), Image() or Link(). 1267 * The destination is defined with SetLink(). 1268 * \see Cell(), Write(), Image(), Link(), SetLink() 1269 */ 1270 virtual int AddLink(); 1271 1272 /// Defines the page and position a link points to. 1273 /** 1274 * \param link The link identifier returned by AddLink() 1275 * \param y Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) 1276 * \param page Number of target page; -1 indicates the current page. This is the default value 1277 * \see AddLink() 1278 */ 1279 virtual bool SetLink(int link, double y = 0., int page = -1); 1280 1281 /// Puts a link on a rectangular area of the page. 1282 /** 1283 * Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful 1284 * for instance to define a clickable area inside an image. 1285 * \param x Abscissa of the upper-left corner of the rectangle 1286 * \param y Ordinate of the upper-left corner of the rectangle 1287 * \param w Width of the rectangle 1288 * \param h Height of the rectangle 1289 * \param link URL or identifier returned by AddLink() 1290 * \see AddLink(), Cell(), Write(), Image() 1291 */ 1292 virtual void Link(double x, double y, double w, double h, const wxPdfLink& link); 1293 1294 /// Adds a bookmark to the document outline 1295 /** 1296 * \param txt: the bookmark title. 1297 * \param level: the bookmark level (0 is top level, 1 is just below, and so on). 1298 * \param y: the y position of the bookmark destination in the current page. 1299 * -1 means the current position. Default value: 0. 1300 */ 1301 virtual void Bookmark(const wxString& txt, int level = 0, double y = 0); 1302 1303 /// Prints a character string. 1304 /** 1305 * The origin is on the left of the first charcter, on the baseline. 1306 * This method allows to place a string precisely on the page, but it is usually easier to use Cell(), 1307 * MultiCell() or Write() which are the standard methods to print text. 1308 * \param x Abscissa of the origin 1309 * \param y Ordinate of the origin 1310 * \param txt String to print 1311 * \see SetFont(), SetTextColour(), Cell(), MultiCell(), Write() 1312 */ 1313 virtual void Text(double x, double y, const wxString& txt); 1314 1315 /// Prints a rotated text string 1316 /** 1317 * \param x: abscissa of the rotation center. 1318 * \param y: ordinate of the rotation center. 1319 * \param txt String to print 1320 * \param angle: angle in degrees. 1321 */ 1322 virtual void RotatedText(double x, double y, const wxString& txt, double angle); 1323 1324 /// Prints a rotated text string with explicit rotation center 1325 /** 1326 * \param textX Abscissa of the origin 1327 * \param textY Ordinate of the origin 1328 * \param rotationX: abscissa of the rotation center. 1329 * \param rotationY: ordinate of the rotation center. 1330 * \param txt String to print 1331 * \param angle: angle in degrees. 1332 */ 1333 virtual void RotatedText(double textX, double textY, double rotationX, double rotationY, const wxString& txt, double angle); 1334 1335 /// Whenever a page break condition is met, 1336 /** 1337 * Whenever a page break condition is met, the method is called, and the break is issued or not 1338 * depending on the returned value. The default implementation returns a value according to the 1339 * mode selected by SetAutoPageBreak() 1340 * 1341 * This method is called automatically and should not be called directly by the application. 1342 * \return boolean 1343 * \see SetAutoPageBreak() 1344 */ 1345 virtual bool AcceptPageBreak(); 1346 1347 /// Prints a cell (rectangular area) with optional borders, background colour and character string. 1348 /** 1349 * The upper-left corner of the cell corresponds to the current position. The text can be aligned 1350 * or centered. After the call, the current position moves to the right or to the next line. 1351 * It is possible to put a link on the text. 1352 * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done 1353 * before outputting. 1354 * \param w Cell width. If 0, the cell extends up to the right margin. 1355 * \param h Cell height. Default value: 0. 1356 * \param txt String to print. Default value: empty string. 1357 * \param border Indicates if borders must be drawn around the cell. The value can be 1358 * \li wxPDF_BORDER_NONE no border 1359 * \li wxPDF_BORDER_LEFT left border 1360 * \li wxPDF_BORDER_RIGHT right border 1361 * \li wxPDF_BORDER_TOP top border 1362 * \li wxPDF_BORDER_BOTTOM bottom border 1363 * \li wxPDF_BORDER_FRAME border on all sides 1364 * 1365 * or a combination of them. 1366 * \param ln Indicates where the current position should go after the call. Possible values are: 1367 * \li 0: to the right 1368 * \li 1: to the beginning of the next line 1369 * \li 2: below 1370 * 1371 * Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. 1372 * \param align Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align (default value)</li><li>C: center</li><li>R: right align</li></ul> 1373 * \li wxPDF_ALIGN_LEFT align the text at the left margin 1374 * \li wxPDF_ALIGN_CENTER center the text 1375 * \li wxPDF_ALIGN_RIGHT align the text at the right margin 1376 * \li wxPDF_ALIGN_JUSTIFY justify the text 1377 * 1378 * \param fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. 1379 * \param link URL or identifier returned by AddLink(). 1380 * \see SetFont(), SetDrawColour(), SetFillColour(), SetTextColour(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak() 1381 */ 1382 virtual void Cell(double w, double h = 0., const wxString& txt = wxEmptyString, 1383 int border = wxPDF_BORDER_NONE, int ln = 0, 1384 int align = wxPDF_ALIGN_LEFT, int fill = 0, 1385 const wxPdfLink& link = wxPdfLink(-1)); 1386 1387 /// This method allows printing text with line breaks. 1388 /** 1389 * They can be automatic (as soon as the text reaches the right border of the cell) or explicit 1390 * (via the \n character). As many cells as necessary are output, one below the other. 1391 * Text can be aligned, centered or justified. The cell block can be framed and the background painted. 1392 * \param w Width of cells. If 0, they extend up to the right margin of the page. 1393 * \param h Height of cells. 1394 * \param txt String to print 1395 * \param border Indicates if borders must be drawn around the cell. The value can be 1396 * \li wxPDF_BORDER_NONE no border 1397 * \li wxPDF_BORDER_LEFT left border 1398 * \li wxPDF_BORDER_RIGHT right border 1399 * \li wxPDF_BORDER_TOP top border 1400 * \li wxPDF_BORDER_BOTTOM bottom border 1401 * \li wxPDF_BORDER_FRAME border on all sides 1402 * 1403 * or a combination of them. 1404 * \param align Allows to center or align the text. Possible values are: 1405 * \li wxPDF_ALIGN_LEFT align the text at the left margin 1406 * \li wxPDF_ALIGN_CENTER center the text 1407 * \li wxPDF_ALIGN_RIGHT align the text at the right margin 1408 * \li wxPDF_ALIGN_JUSTIFY justify the text (default) 1409 * 1410 * \param fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. 1411 * \param maxline Defines the maximum number of lines which should be printed. 1412 * If maxline is 0 then the number of lines is not restricted. Default value: 0. 1413 * \return position in text string txt where output ended due to reaching the maximum number of lines 1414 * \see SetFont(), SetDrawColour(), SetFillColour(), SetTextColour(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak() 1415 */ 1416 virtual int MultiCell(double w, double h, const wxString& txt, 1417 int border = 0, int align = wxPDF_ALIGN_JUSTIFY, 1418 int fill = 0, int maxline = 0); 1419 1420 /// This method counts the number of lines a text would occupy in respect to a given maximal width 1421 /** 1422 * \param w Width of cells. If 0, they extend up to the right margin of the page. 1423 * \param txt String for which the number of lines is to be counted 1424 * \return Number of lines this text would occupy 1425 */ 1426 virtual int LineCount(double w, const wxString& txt); 1427 1428 /// This method counts the number of lines a text will occupy in respect to a given maximal width 1429 /** 1430 * \param w Width of cells. If 0, they extend up to the right margin of the page. 1431 * \param h Height of cells. 1432 * \param txt String to print 1433 * \param halign Allows to center or align the text. Possible values are: 1434 * \li wxPDF_ALIGN_LEFT align the text at the left margin 1435 * \li wxPDF_ALIGN_CENTER center the text 1436 * \li wxPDF_ALIGN_RIGHT align the text at the right margin 1437 * \li wxPDF_ALIGN_JUSTIFY justify the text (default) 1438 * 1439 * \param valign Allows to vertical align the text. Possible values are: 1440 * \li wxPDF_ALIGN_TOP align the text at the top of the box 1441 * \li wxPDF_ALIGN_MIDDLE center the text vertically in the box 1442 * \li wxPDF_ALIGN_BOTTOM align the text at the bottom of the box 1443 * 1444 * \param border Indicates if borders must be drawn around the text box. The value can be 1445 * \li wxPDF_BORDER_NONE no border 1446 * \li wxPDF_BORDER_LEFT left border 1447 * \li wxPDF_BORDER_RIGHT right border 1448 * \li wxPDF_BORDER_TOP top border 1449 * \li wxPDF_BORDER_BOTTOM bottom border 1450 * \li wxPDF_BORDER_FRAME border on all sides 1451 * 1452 * or a combination of them. 1453 * \param fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. 1454 */ 1455 virtual int TextBox(double w, double h, const wxString& txt, 1456 int halign = wxPDF_ALIGN_JUSTIFY, int valign = wxPDF_ALIGN_TOP, 1457 int border = 0, int fill = 0); 1458 1459 /// This method prints text from the current position. 1460 /** 1461 * When the right margin is reached (or the \n character is met) a line break occurs and text continues 1462 * from the left margin. Upon method exit, the current position is left just at the end of the text. 1463 * It is possible to put a link on the text. 1464 * \param h Line height 1465 * \param txt String to print 1466 * \param link URL or identifier returned by AddLink() 1467 * \see SetFont(), SetTextColour(), AddLink(), MultiCell(), SetAutoPageBreak() 1468 */ 1469 virtual void Write(double h, const wxString& txt, const wxPdfLink& link = wxPdfLink(-1)); 1470 1471 /// This method prints text with cell attributes from the current position. 1472 /** 1473 * When the right margin is reached (or the \n character is met) a line break occurs and text continues 1474 * from the left margin. Upon method exit, the current position is left just at the end of the text. 1475 * It is possible to put a link on the text. 1476 * \param h Line height 1477 * \param txt String to print 1478 * \param border Indicates if borders must be drawn around the cell. The value can be 1479 * \li wxPDF_BORDER_NONE no border 1480 * \li wxPDF_BORDER_LEFT left border 1481 * \li wxPDF_BORDER_RIGHT right border 1482 * \li wxPDF_BORDER_TOP top border 1483 * \li wxPDF_BORDER_BOTTOM bottom border 1484 * \li wxPDF_BORDER_FRAME border on all sides 1485 * 1486 * or a combination of them. 1487 * \param fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. 1488 * \param link URL or identifier returned by AddLink() 1489 * \see SetFont(), SetTextColour(), AddLink(), MultiCell(), SetAutoPageBreak() 1490 */ 1491 virtual void WriteCell(double h, const wxString& txt, int border = wxPDF_BORDER_NONE, int fill = 0, const wxPdfLink& link = wxPdfLink(-1)); 1492 1493 /// Prints an array of glyphs identified by glyph numbers from the current position. 1494 /** 1495 * The glyphs are positioned according to the given offsets in horizontal (x) and vertical (y) direction. 1496 * \note This method only works for dynamically loaded TrueType and OpenType Unicode fonts. 1497 */ 1498 virtual bool WriteGlyphArray(wxPdfArrayDouble& x, wxPdfArrayDouble& y, wxPdfArrayUint32& glyphs); 1499 1500 /// Puts an image in the page. 1501 /** 1502 * The upper-left corner must be given. The dimensions can be specified in different ways: 1503 * \li explicit width and height (expressed in user unit) 1504 * \li one explicit dimension, the other being calculated automatically in order to keep the original proportions 1505 * \li no explicit dimension, in which case the image is put at 72 dpi 1506 * 1507 * Supported formats are JPEG, PNG, GIF and WMF. 1508 * For JPEG, all flavors are allowed: 1509 * \li gray scales, 1510 * \li true colours (24 bits), 1511 * \li CMYK (32 bits) 1512 * 1513 * For PNG, the following flavors are allowed: 1514 * \li gray scales on at most 8 bits (256 levels) 1515 * \li indexed colours 1516 * \li true colours (24 bits) 1517 * 1518 * but the following options are not supported: 1519 * \li Interlacing 1520 * \li Alpha channel 1521 * 1522 * If a transparent colour is defined, it will be taken into account (but will be only interpreted 1523 * by Acrobat 4 and above). 1524 * 1525 * For GIF, all flavors the wxWidgets GIF decoder is able to handle are supported 1526 * 1527 * For WMF: WMF files contain vector data described in terms of Windows Graphics Device Interface 1528 * (GDI) commands. There are approximately 80 different GDI commands allowed for in the WMF standard. 1529 * This method interprets only a small subset of these, but is sufficient to display most WMF images. 1530 * Please feel free to add further functionality. 1531 * 1532 * The format can be specified explicitly or inferred from the file extension. 1533 * 1534 * It is possible to put a link on the image. 1535 * 1536 * Remark: if an image is used several times, only one copy will be embedded in the file. 1537 * 1538 * \param file Name of the file containing the image. 1539 * \param x Abscissa of the upper-left corner. 1540 * \param y Ordinate of the upper-left corner. 1541 * \param w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. 1542 * \param h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. 1543 * \param mimeType Image format. Possible values are: image/jpeg, image/png, image/gif, image/wmf. 1544 * If not specified, the type is inferred from the file extension. 1545 * \param link URL or identifier returned by AddLink(). 1546 * \param maskImage Id of an image mask created previously by ImageMask(). 1547 * \see AddLink() 1548 */ 1549 virtual bool Image(const wxString& file, double x, double y, double w = 0, double h = 0, 1550 const wxString& mimeType = wxEmptyString, 1551 const wxPdfLink& link = wxPdfLink(-1), 1552 int maskImage = 0); 1553 1554 /** 1555 * Puts an image in the page 1556 * The image is given by an wxImage-Object 1557 * \param name Name of the image to be used as an identifier for this image object. 1558 * \param image wxImage object which will be embedded as PNG 1559 * \param x Abscissa of the upper-left corner. 1560 * \param y Ordinate of the upper-left corner. 1561 * \param w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. 1562 * \param h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. 1563 * \param link URL or identifier returned by AddLink(). 1564 * \param maskImage Id of an image mask created previously by ImageMask(). 1565 * \param jpegFormat Switch whether to save image as JPEG (true) or PNG (false, default). 1566 * \param jpegQuality Quality in case of JPEG format (0 = poor, 100 = best, default 75). 1567 */ 1568 virtual bool Image(const wxString& name, const wxImage& image, 1569 double x, double y, double w = 0, double h = 0, 1570 const wxPdfLink& link = wxPdfLink(-1), 1571 int maskImage = 0, bool jpegFormat = false, int jpegQuality = 75); 1572 1573 /** 1574 * Puts an image in the page 1575 * The image is given by an wxInputStream-Object containing the raw image data. 1576 * \param name Name of the image to be used as an identifier for this image object. 1577 * \param stream wxInputStream object containing the raw image data 1578 * \param mimeType Image format. Possible values are: image/jpeg, image/png, image/gif, image/wmf. 1579 * \param x Abscissa of the upper-left corner. 1580 * \param y Ordinate of the upper-left corner. 1581 * \param w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. 1582 * \param h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. 1583 * \param link URL or identifier returned by AddLink(). 1584 * \param maskImage Id of an image mask created previously by ImageMask(). 1585 */ 1586 virtual bool Image(const wxString& name, wxInputStream& stream, 1587 const wxString& mimeType, 1588 double x, double y, double w = 0, double h = 0, 1589 const wxPdfLink& link = wxPdfLink(-1), 1590 int maskImage = 0); 1591 1592 /** 1593 * Prepares an image for use as an image mask 1594 * The image is given as the name of the file containing the image 1595 * \param file Name of the file containing the image. 1596 * \param mimeType Image format. Possible values are: image/jpeg, image/png, image/gif, image/wmf. 1597 * \return id of the image mask, or 0 in case of an error 1598 */ 1599 virtual int ImageMask(const wxString& file, const wxString& mimeType = wxEmptyString); 1600 1601 /** 1602 * Prepares an image for use as an image mask 1603 * The image is given by an wxImage-Object 1604 * \param name Name of the image. 1605 * \param image wxImage object. 1606 * \return id of the image mask, or 0 in case of an error 1607 */ 1608 virtual int ImageMask(const wxString& name, const wxImage& image); 1609 1610 /** 1611 * Prepares an image for use as an image mask 1612 * The image is given by an wxInputStream-Object containing the raw image data. 1613 * \param name Name of the image. 1614 * \param stream wxInputStream object containing the raw image data 1615 * \param mimeType Image format. Possible values are: image/jpeg, image/png, image/gif, image/wmf. 1616 * \return id of the image mask, or 0 in case of an error 1617 */ 1618 virtual int ImageMask(const wxString& name, wxInputStream& stream, const wxString& mimeType); 1619 1620 /// Puts a rotated image in the page. 1621 /** 1622 * The upper-left corner must be given. 1623 * 1624 * The format can be specified explicitly or inferred from the file extension. 1625 * 1626 * It is possible to put a link on the image. 1627 * 1628 * Remark: if an image is used several times, only one copy will be embedded in the file. 1629 * 1630 * \param file Name of the file containing the image. 1631 * \param x Abscissa of the upper-left corner. 1632 * \param y Ordinate of the upper-left corner. 1633 * \param w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. 1634 * \param h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. 1635 * \param angle Angle of rotation 1636 * \param type Image format. Possible values are (case insensitive): JPG, JPEG, PNG, GIF, WMF. 1637 * If not specified, the type is inferred from the file extension. 1638 * \param link URL or identifier returned by AddLink(). 1639 * \param maskImage Id of an image mask created previously by ImageMask(). 1640 * \see Image(), AddLink() 1641 */ 1642 virtual void RotatedImage(const wxString& file, double x, double y, double w, double h, 1643 double angle, 1644 const wxString& type = wxEmptyString, 1645 const wxPdfLink& link = wxPdfLink(-1), 1646 int maskImage = 0); 1647 1648 /// Get x coordinate of bottom right corner of last inserted image 1649 /** 1650 */ GetLastImageBottomRightX()1651 virtual double GetLastImageBottomRightX() { return m_img_rb_x; } 1652 1653 /// Get y coordinate of bottom right corner of last inserted image 1654 /** 1655 */ GetLastImageBottomRightY()1656 virtual double GetLastImageBottomRightY() { return m_img_rb_y; } 1657 1658 /// Performs a line break. 1659 /** 1660 * The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter. 1661 * \param h The height of the break. By default, the value equals the height of the last printed cell. 1662 * \see Cell() 1663 */ 1664 virtual void Ln(double h = -1); 1665 1666 /// Returns the abscissa of the current position. 1667 /** 1668 * \return float 1669 * \see SetX(), GetY(), SetY() 1670 */ 1671 virtual double GetX(); 1672 1673 /// Defines the abscissa of the current position. 1674 /** 1675 * If the passed value is negative, it is relative to the right of the page. 1676 * \param x The value of the abscissa. 1677 * \see GetX(), GetY(), SetY(), SetXY() 1678 */ 1679 virtual void SetX(double x); 1680 1681 /// Returns the ordinate of the current position. 1682 /** 1683 * \return float 1684 * \see SetY(), GetX(), SetX() 1685 */ 1686 virtual double GetY(); 1687 1688 /// Moves the current abscissa back to the left margin and sets the ordinate. 1689 /** 1690 * If the passed value is negative, it is relative to the bottom of the page. 1691 * \param y The value of the ordinate. 1692 * \see GetX(), GetY(), SetY(), SetXY() 1693 */ 1694 virtual void SetY(double y); 1695 1696 /// Defines the abscissa and ordinate of the current position. 1697 /** 1698 * If the passed values are negative, they are relative respectively to the right and bottom of the page. 1699 * \param x The value of the abscissa 1700 * \param y The value of the ordinate 1701 * \see SetX(), SetY() 1702 */ 1703 virtual void SetXY(double x, double y); 1704 1705 /// Saves the document to a file on disk 1706 /** 1707 * The method first calls Close() if necessary to terminate the document. 1708 * \param name The name of the file. If not given, the document will be named 'doc.pdf' 1709 * \return true if successful, false otherwise 1710 * \see Close() 1711 */ 1712 virtual bool SaveAsFile(const wxString& name = wxEmptyString); 1713 1714 /// Closes the document and returns the memory buffer containing the document 1715 /** 1716 * The method first calls Close() if necessary to terminate the document. 1717 * \return const wxMemoryOutputStream reference to the buffer containing the PDF document. 1718 * \see Close() 1719 */ 1720 virtual const wxMemoryOutputStream& CloseAndGetBuffer(); 1721 1722 /// Define text as clipping area 1723 /** 1724 * A clipping area restricts the display and prevents any elements from showing outside of it. 1725 * \param x Abscissa of the origin 1726 * \param y Ordinate of the origin 1727 * \param txt String to print 1728 * \param outline Draw the outline or not. 1729 */ 1730 virtual void ClippingText(double x, double y, const wxString& txt, bool outline = false); 1731 1732 /// Define rectangle as clipping area 1733 /** 1734 * A clipping area restricts the display and prevents any elements from showing outside of it. 1735 * \param x Abscissa of the upper-left corner 1736 * \param y Ordinate of the upper-left corner 1737 * \param w Width of the rectangle 1738 * \param h Height of the rectangle 1739 * \param outline Draw the outline or not. 1740 */ 1741 virtual void ClippingRect(double x, double y, double w, double h, bool outline = false); 1742 1743 /// Define ellipse as clipping area 1744 /** 1745 * A clipping area restricts the display and prevents any elements from showing outside of it. 1746 * \param x Abscissa of the Center point 1747 * \param y Ordinate of the Center point 1748 * \param rx: Horizontal radius 1749 * \param ry: Vertical radius (if ry = 0, draws a circle) 1750 * \param outline Draw the outline or not. (Default false) 1751 */ 1752 virtual void ClippingEllipse(double x, double y, double rx, double ry = 0, bool outline = false); 1753 1754 /// Define polygon as clipping area 1755 /** 1756 * A clipping area restricts the display and prevents any elements from showing outside of it. 1757 * \param x Array with abscissa values 1758 * \param y Array with ordinate values 1759 * \param outline Draw the outline or not. (Default false) 1760 */ 1761 virtual void ClippingPolygon(const wxPdfArrayDouble& x, const wxPdfArrayDouble& y, bool outline = false); 1762 1763 /// Start defining a clipping path 1764 /** 1765 * A clipping area restricts the display and prevents any elements from showing outside of it. 1766 * The clipping path may consist of one or more subpaths. 1767 */ 1768 virtual void ClippingPath(); 1769 1770 /// Begin a new subpath 1771 /** 1772 * Move to the starting point of a new (sub)path. 1773 * The new current point is (x, y). 1774 * \param x abscissa value 1775 * \param y ordinate value 1776 * \remark This must be the first operation after ClippingPath(). 1777 */ 1778 virtual void MoveTo(double x, double y); 1779 1780 /// Append a straight line segment to the current (sub)path 1781 /** 1782 * Append a straight line segment from the current point to the point (x, y). 1783 * The new current point is (x, y). 1784 * \param x abscissa value 1785 * \param y ordinate value 1786 */ 1787 virtual void LineTo(double x, double y); 1788 1789 /// Append a cubic Bezier curve to the current (sub)path 1790 /** 1791 * Append a cubic Bezier curve to the current path. The curve extends 1792 * from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) 1793 * as the B�zier control points. The new current point is (x3, y3). 1794 * \param x1: Abscissa of control point 1 1795 * \param y1: Ordinate of control point 1 1796 * \param x2: Abscissa of control point 2 1797 * \param y2: Ordinate of control point 2 1798 * \param x3: Abscissa of end point 1799 * \param y3: Ordinate of end point 1800 */ 1801 virtual void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3); 1802 1803 /// End a graphics path 1804 /** 1805 * \param style Style of rendering. Possible values are: 1806 * \li wxPDF_STYLE_NOOP 1807 * \li wxPDF_STYLE_DRAW: draw the outline of the path (default) 1808 * \li wxPDF_STYLE_FILL: fill the area enclosed by the path 1809 * \li wxPDF_STYLE_FILLDRAW: draw and fill 1810 */ 1811 virtual void EndPath(int style = wxPDF_STYLE_DRAW); 1812 1813 /// Close the clipping path 1814 /** 1815 * A clipping area restricts the display and prevents any elements from showing outside of it. 1816 * \param style Style of rendering. Possible values are: 1817 * \li wxPDF_STYLE_NOOP (default) 1818 * \li wxPDF_STYLE_DRAW: draw the outline of the clipping path 1819 * \li wxPDF_STYLE_FILL: fill the area enclosed by the clipping path 1820 * \li wxPDF_STYLE_FILLDRAW: draw and fill 1821 */ 1822 virtual void ClosePath(int style = wxPDF_STYLE_NOOP); 1823 1824 /// Define clipping area using a shape 1825 /** 1826 * A clipping area restricts the display and prevents any elements from showing outside of it. 1827 * \param shape shape defining the clipping path 1828 * \param style Style of rendering. Possible values are: 1829 * \li wxPDF_STYLE_NOOP (default) 1830 * \li wxPDF_STYLE_DRAW: draw the outline of the clipping path 1831 * \li wxPDF_STYLE_FILL: fill the area enclosed by the clipping path 1832 * \li wxPDF_STYLE_FILLDRAW: draw and fill 1833 */ 1834 virtual void ClippingPath(const wxPdfShape& shape, int style = wxPDF_STYLE_NOOP); 1835 1836 /// Remove clipping area 1837 /** 1838 * Once you have finished using the clipping, you must remove it with UnsetClipping(). 1839 */ 1840 virtual void UnsetClipping(); 1841 1842 /// Prints a cell clipped to a rectangular area 1843 /** 1844 * The upper-left corner of the cell corresponds to the current position. The text can be aligned 1845 * or centered. After the call, the current position moves to the right or to the next line. 1846 * It is possible to put a link on the text. 1847 * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done 1848 * before outputting. 1849 * \param w Cell width. 1850 * \param h Cell height. 1851 * \param txt String to print. Default value: empty string. 1852 * \param border Indicates if borders must be drawn around the cell. The value can be 1853 * \li wxPDF_BORDER_NONE no border 1854 * \li wxPDF_BORDER_LEFT left border 1855 * \li wxPDF_BORDER_RIGHT right border 1856 * \li wxPDF_BORDER_TOP top border 1857 * \li wxPDF_BORDER_BOTTOM bottom border 1858 * \li wxPDF_BORDER_FRAME border on all sides 1859 * 1860 * or a combination of them. 1861 * \param ln Indicates where the current position should go after the call. Possible values are: 1862 * \li 0: to the right 1863 * \li 1: to the beginning of the next line 1864 * \li 2: below 1865 * 1866 * Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. 1867 * \param align Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align (default value)</li><li>C: center</li><li>R: right align</li></ul> 1868 * \li wxPDF_ALIGN_LEFT align the text at the left margin 1869 * \li wxPDF_ALIGN_CENTER center the text 1870 * \li wxPDF_ALIGN_RIGHT align the text at the right margin 1871 * \li wxPDF_ALIGN_JUSTIFY justify the text 1872 * 1873 * \param fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. 1874 * \param link URL or identifier returned by AddLink(). 1875 * \see SetFont(), SetDrawColour(), SetFillColour(), SetTextColour(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak() 1876 */ 1877 virtual void ClippedCell(double w, double h = 0., const wxString& txt = wxEmptyString, 1878 int border = wxPDF_BORDER_NONE, int ln = 0, 1879 int align = wxPDF_ALIGN_LEFT, int fill = 0, 1880 const wxPdfLink& link = wxPdfLink(-1)); 1881 1882 /// Enters a transformation environment 1883 /** 1884 * Before applying any transformation this method should be invoked. 1885 * All transformation method invoke it implicitly if necessary. 1886 * All open transformation environments are closed implicitly on page end. 1887 */ 1888 virtual void StartTransform(); 1889 1890 /// Performs scaling in X direction only 1891 /** 1892 * A scaling transformation is applied for the X direction. 1893 * \param sx: scaling factor for width as percent. 0 is not allowed. 1894 * \param x: abscissa of the scaling center. Default is current x position 1895 * \param y: ordinate of the scaling center. Default is current y position 1896 */ 1897 virtual bool ScaleX(double sx, double x = -1, double y = -1); 1898 1899 /// Performs scaling in Y direction only 1900 /** 1901 * A scaling transformation is applied for the Y direction. 1902 * \param sy: scaling factor for height as percent. 0 is not allowed. 1903 * \param x: abscissa of the scaling center. Default is current x position 1904 * \param y: ordinate of the scaling center. Default is current y position 1905 */ 1906 virtual bool ScaleY(double sy, double x = -1, double y = -1); 1907 1908 /// Performs equal scaling in X and Y direction 1909 /** 1910 * A scaling transformation is applied for both - X and Y - directions. 1911 * \param s: scaling factor for width and height as percent. 0 is not allowed. 1912 * \param x: abscissa of the scaling center. Default is current x position 1913 * \param y: ordinate of the scaling center. Default is current y position 1914 */ 1915 virtual bool ScaleXY(double s, double x = -1, double y = -1); 1916 1917 /// Performs scaling in X and Y direction 1918 /** 1919 * A scaling transformation is applied independently for X and Y direction. 1920 * \param sx: scaling factor for width in percent. 0 is not allowed. 1921 * \param sy: scaling factor for height in percent. 0 is not allowed. 1922 * \param x: abscissa of the scaling center. Default is current x position 1923 * \param y: ordinate of the scaling center. Default is current y position 1924 */ 1925 virtual bool Scale(double sx, double sy, double x = -1, double y = -1); 1926 1927 /// Performs a horizontal mirroring transformation 1928 /** 1929 * Alias for scaling -100% in x-direction 1930 * \param x: abscissa of the axis of reflection 1931 */ 1932 virtual void MirrorH(double x = -1); 1933 1934 /// Performs a vertical mirroring transformation 1935 /** 1936 * Alias for scaling -100% in y-direction 1937 * \param y: abscissa of the axis of reflection 1938 */ 1939 virtual void MirrorV(double y = -1); 1940 1941 /// Moves the X origin 1942 /** 1943 * \param tx: movement to the right 1944 */ 1945 virtual void TranslateX(double tx); 1946 1947 /// Moves the Y origin 1948 /** 1949 * \param ty: movement to the bottom 1950 */ 1951 virtual void TranslateY(double ty); 1952 1953 /// Moves the origin 1954 /** 1955 * \param tx: movement to the right 1956 * \param ty: movement to the bottom 1957 */ 1958 virtual void Translate(double tx, double ty); 1959 1960 /// Performs a skewing in both X direction only 1961 /** 1962 * \param xAngle: angle in degrees between -90 (skew to the left) and 90 (skew to the right) 1963 * \param x: abscissa of the skewing center. default is current x position 1964 * \param y: ordinate of the skewing center. default is current y position 1965 */ 1966 virtual bool SkewX(double xAngle, double x = -1, double y = -1); 1967 1968 /// Performs a skewing in Y direction only 1969 /** 1970 * \param yAngle: angle in degrees between -90 (skew to the bottom) and 90 (skew to the top) 1971 * \param x: abscissa of the skewing center. default is current x position 1972 * \param y: ordinate of the skewing center. default is current y position 1973 */ 1974 virtual bool SkewY(double yAngle, double x = -1, double y = -1); 1975 1976 /// Performs a skewing in both X and Y directions 1977 /** 1978 * \param xAngle: angle in degrees between -90 (skew to the left) and 90 (skew to the right) 1979 * \param yAngle: angle in degrees between -90 (skew to the bottom) and 90 (skew to the top) 1980 * \param x: abscissa of the skewing center. default is current x position 1981 * \param y: ordinate of the skewing center. default is current y position 1982 */ 1983 virtual bool Skew(double xAngle, double yAngle, double x = -1, double y = -1); 1984 1985 virtual void Transform( double a, double b, double c, double d, double tx, double ty ); 1986 1987 /// Leaves a transformation environment 1988 /** 1989 * This method should be invoked to cancel a transformation environment 1990 * opened by StartTransform. 1991 * All open transformation environments are closed implicitly on page end. 1992 */ 1993 virtual void StopTransform(); 1994 1995 /// Sets alpha values and blend mode 1996 /** 1997 * \param lineAlpha alpha value for stroking operations, from 0 (transparent) to 1 (opaque) 1998 * \param fillAlpha alpha value for non-stroking operations, from 0 (transparent) to 1 (opaque) 1999 * \param blendMode one of the following: 2000 * Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, 2001 * HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity 2002 */ 2003 virtual int SetAlpha(double lineAlpha = 1, double fillAlpha = 1, wxPdfBlendMode blendMode = wxPDF_BLENDMODE_NORMAL); 2004 2005 /// Sets a previously defined alpha state 2006 /** 2007 * \param alphaState id of alpha state 2008 */ 2009 virtual void SetAlphaState(int alphaState); 2010 2011 /// Defines a linear gradient shading 2012 /** 2013 * \param col1 first colour (RGB or CMYK). 2014 * \param col2 second colour (RGB or CMYK). 2015 * \param gradientType Type of the gradient 2016 */ 2017 virtual int LinearGradient(const wxPdfColour& col1, const wxPdfColour& col2, 2018 wxPdfLinearGradientType gradientType = wxPDF_LINEAR_GRADIENT_HORIZONTAL); 2019 2020 /// Defines a axial gradient shading 2021 /** 2022 * \param col1 first colour (RGB or CMYK). 2023 * \param col2 second colour (RGB or CMYK). 2024 * \param x1 start point of gradient vector, default: 0 (range 0 .. 1) 2025 * \param y1 start point of gradient vector, default: 0 (range 0 .. 1) 2026 * \param x2 end point of gradient vector, default: 1 (range 0 .. 1) 2027 * \param y2 end point of gradient vector, default: 0 (range 0 .. 1) 2028 * \param intexp interpolation exponent, default: 1 2029 */ 2030 virtual int AxialGradient(const wxPdfColour& col1, const wxPdfColour& col2, 2031 double x1 = 0, double y1 = 0, 2032 double x2 = 1, double y2 = 0, 2033 double intexp = 1); 2034 2035 /// Defines a axial gradient shading 2036 /** 2037 * \param col1 first colour (RGB or CMYK). 2038 * \param col2 second colour (RGB or CMYK). 2039 * \param x1 start point of gradient vector, default: 0 (range 0 .. 1) 2040 * \param y1 start point of gradient vector, default: 0 (range 0 .. 1) 2041 * \param x2 end point of gradient vector, default: 1 (range 0 .. 1) 2042 * \param y2 end point of gradient vector, default: 0 (range 0 .. 1) 2043 * \param midpoint position of the mirror point, default: 0.5 (range 0 .. 1) 2044 * \param intexp interpolation exponent, default: 1 2045 */ 2046 virtual int MidAxialGradient(const wxPdfColour& col1, const wxPdfColour& col2, 2047 double x1 = 0, double y1 = 0, 2048 double x2 = 1, double y2 = 0, 2049 double midpoint = 0.5, double intexp = 1); 2050 2051 /// Defines a radial gradient shading 2052 /** 2053 * \param col1 first colour (RGB or CMYK). 2054 * \param col2 second colour (RGB or CMYK). 2055 * \param x1 center point of circle 1, default: 0.5 (range 0 .. 1) 2056 * \param y1 center point of circle 1, default: 0.5 (range 0 .. 1) 2057 * \param r1 radius of circle 1, default: 0 2058 * \param x2 center point of circle 2, default: 0.5 (range 0 .. 1) 2059 * \param y2 center point of circle 2, default: 0.5 (range 0 .. 1) 2060 * \param r2 radius of circle 2, default: 1 2061 * \param intexp interpolation exponent, default: 1 2062 */ 2063 virtual int RadialGradient(const wxPdfColour& col1, const wxPdfColour& col2, 2064 double x1 = 0.5, double y1 = 0.5, double r1 = 0, 2065 double x2 = 0.5, double y2 = 0.5, double r2 = 1, 2066 double intexp = 1); 2067 2068 /// Defines a coons patch mesh gradient shading 2069 /** 2070 * \param mesh coons patch mesh to be used for the gradient 2071 * \param minCoord minimal coordinate of the mesh 2072 * \param maxCoord maximal coordinate of the mesh 2073 */ 2074 virtual int CoonsPatchGradient(const wxPdfCoonsPatchMesh& mesh, double minCoord = 0, double maxCoord = 1); 2075 2076 /// Paints a gradient shading to rectangular area 2077 /** 2078 * \param x abscissa of the top left corner of the rectangle. 2079 * \param y ordinate of the top left corner of the rectangle. 2080 * \param w width of the rectangle. 2081 * \param h height of the rectangle. 2082 * \param gradient id of the gradient. 2083 */ 2084 virtual void SetFillGradient(double x, double y, double w, double h, int gradient); 2085 2086 /// Draws a graphical marker symbol 2087 /** 2088 * \param x abscissa of the marker's center 2089 * \param y ordinate of the marker's center 2090 * \param markerType type of the marker 2091 * \param size size of the marker 2092 */ 2093 virtual void Marker(double x, double y, wxPdfMarker markerType, double size); 2094 2095 /// Adds a text annotation 2096 /** 2097 * \param x abscissa of the annotation symbol 2098 * \param y ordinate of the annotation symbol 2099 * \param text annotation text 2100 */ 2101 virtual void Annotate(double x, double y, const wxString& text); 2102 2103 /// Appends Javascript 2104 /** 2105 * Allows to append Javascript code to a Javascript object at the document level. 2106 * \param javascript Javascript code to be appended 2107 */ 2108 virtual void AppendJavascript(const wxString& javascript); 2109 2110 /// Prints a string containing simple XML markup 2111 /** 2112 * Output starts at the current position. 2113 * \param str string containing text with simple XML markup 2114 * \see \ref writexml 2115 */ 2116 virtual void WriteXml(const wxString& str); 2117 2118 /// Adds a check box field at the current position 2119 /** 2120 * Adds a check box to the list of form fields at the current position 2121 * \param name field name of the check box 2122 * \param width width of the check box 2123 * \param checked default value of the check box 2124 */ 2125 virtual void CheckBox(const wxString& name, double width, bool checked = false); 2126 2127 /// Adds a check box field 2128 /** 2129 * Adds a check box to the list of form fields 2130 * \param name field name of the check box 2131 * \param x abscissa of the check box position 2132 * \param y ordinate of the check box position 2133 * \param width width of the check box 2134 * \param checked default value of the check box 2135 */ 2136 virtual void CheckBox(const wxString& name, double x, double y, double width, bool checked = false); 2137 2138 /// Adds a combo box field at the current position 2139 /** 2140 * Adds a combo box to the list of form fields at the current position 2141 * \param name field name of the combo box 2142 * \param width width of the combo box 2143 * \param height height of the combo box 2144 * \param values array of option values of the combo box 2145 */ 2146 virtual void ComboBox(const wxString& name, double width, double height, const wxArrayString& values); 2147 2148 /// Adds a combo box field 2149 /** 2150 * Adds a combo box to the list of form fields 2151 * \param name field name of the combo box 2152 * \param x abscissa of the combo box position 2153 * \param y ordinate of the combo box position 2154 * \param width width of the combo box 2155 * \param height height of the combo box 2156 * \param values array of option values of the combo box 2157 */ 2158 virtual void ComboBox(const wxString& name, 2159 double x, double y, double width, double height, 2160 const wxArrayString& values); 2161 2162 /// Adds a push button at the current position 2163 /** 2164 * Adds a push button to the list of form fields at the current position 2165 * \param name field name of the push button 2166 * \param width width of the push button 2167 * \param height height of the push button 2168 * \param caption caption of the push button 2169 * \param action associated Javascript action 2170 */ 2171 virtual void PushButton(const wxString& name, double width, double height, 2172 const wxString& caption, const wxString& action); 2173 2174 /// Adds a push button 2175 /** 2176 * Adds a push button to the list of form fields 2177 * \param name field name of the push button 2178 * \param x abscissa of the push button position 2179 * \param y ordinate of the push button position 2180 * \param width width of the push button 2181 * \param height height of the push button 2182 * \param caption caption of the push button 2183 * \param action associated Javascript action 2184 */ 2185 virtual void PushButton(const wxString& name, double x, double y, double width, double height, 2186 const wxString& caption, const wxString& action); 2187 2188 /// Adds a radio button at the current position 2189 /** 2190 * Adds a radio button to the list of form fields at the current position 2191 * \param group name of the radio button group this radio button belongs to 2192 * \param name field name of the radio button 2193 * \param width width of the radio button 2194 */ 2195 virtual void RadioButton(const wxString& group, const wxString& name, double width); 2196 2197 /// Adds a radio button 2198 /** 2199 * Adds a radio button to the list of form fields 2200 * \param group name of the radio button group this radio button belongs to 2201 * \param name field name of the radio button 2202 * \param x abscissa of the radio button position 2203 * \param y ordinate of the radio button position 2204 * \param width width of the radio button 2205 */ 2206 virtual void RadioButton(const wxString& group, const wxString& name, 2207 double x, double y, double width); 2208 2209 /// Adds a text field at the current position 2210 /** 2211 * Adds a text field to the list of form fields at the current position 2212 * \param name field name of the text field 2213 * \param width width of the text field 2214 * \param height height of the text field 2215 * \param value default value of the text field 2216 * \param multiline flag whether the text field is a multiline field or not 2217 */ 2218 virtual void TextField(const wxString& name, double width, double height, 2219 const wxString& value = wxEmptyString, bool multiline = false); 2220 2221 /// Adds a text field 2222 /** 2223 * Adds a text field to the list of form fields 2224 * \param name field name of the text field 2225 * \param x abscissa of the text field position 2226 * \param y ordinate of the text field position 2227 * \param width width of the text field 2228 * \param height height of the text field 2229 * \param value default value of the text field 2230 * \param multiline flag whether the text field is a multiline field or not 2231 */ 2232 virtual void TextField(const wxString& name, 2233 double x, double y, double width, double height, 2234 const wxString& value = wxEmptyString, bool multiline = false); 2235 2236 /// Sets colours for form fields 2237 /** 2238 * Sets the border, background and text colour to be used 2239 * for all subsequent form field additions until this method is called again 2240 * with different values. 2241 * \param borderColour colour of the form field's border 2242 * \param backgroundColour colour of the form field's background 2243 * \param textColour colour of the form field's font 2244 */ 2245 virtual void SetFormColours(const wxPdfColour& borderColour = wxPdfColour(), 2246 const wxPdfColour& backgroundColour = wxPdfColour(250), 2247 const wxPdfColour& textColour = wxPdfColour()); 2248 2249 /// Sets the border style for form fields 2250 /** 2251 * Sets the border width and style to be used 2252 * for all subsequent form field additions until this method is called again 2253 * with different values. 2254 * \param borderStyle style of the form field's border 2255 * \li wxPDF_BORDER_SOLID - solid border 2256 * \li wxPDF_BORDER_DASHED - dashed border 2257 * \li wxPDF_BORDER_BEVELED - beveled border 2258 * \li wxPDF_BORDER_INSET - inset border 2259 * \li wxPDF_BORDER_UNDERLINE - border on the bottom side only 2260 * \param borderWidth width of the form field's border 2261 */ 2262 virtual void SetFormBorderStyle(wxPdfBorderStyle borderStyle = wxPDF_BORDER_SOLID, 2263 double borderWidth = -1); 2264 2265 /// Starts a new Template 2266 /** 2267 * Starts a new template, optionally with own dimensions. 2268 * The margins have to adapted to the new template size. 2269 * For writing outside the template, for example to build a clipped template, 2270 * the margins and "cursor" position have to be set manually after 2271 * the call to BeginTemplate(). 2272 * 2273 * If no dimensions are given, the template uses the current page size. 2274 * The method returns the ID of the current template. 2275 * The ID is used to reference a template in the UseTemplate() method. 2276 * Warning: A template once created is embedded in the resulting PDF document 2277 * at all events, even if it is not used. 2278 * 2279 * \param x The x-coordinate given in user units 2280 * \param y The y-coordinate given in user units 2281 * \param width The width given in user units 2282 * \param height The height given in user units 2283 * \return int The ID of the created template 2284 * \see EndTemplate(), UseTemplate() 2285 * 2286 * Attention: Calls to BeginTemplate can not be nested! 2287 */ 2288 virtual int BeginTemplate(double x = 0, double y = 0, double width = 0, double height = 0); 2289 2290 /// Terminates a template 2291 /** 2292 * Terminates the creation of a template and reset initiated variables on beginTemplate. 2293 * 2294 * \return If a template was under construction, its ID is returned, otherwise a 0 is returned. 2295 * \see BeginTemplate(), UseTemplate() 2296 */ 2297 virtual int EndTemplate(); 2298 2299 /// Get the calculated size of a template 2300 /** 2301 * Retrieves the size of a template. 2302 * 2303 * \param templateId A valid template ID 2304 * \param width The width of the template 2305 * \param height The height of the template 2306 * \see BeginTemplate(), EndTemplate(), UseTemplate(), ImportPage() 2307 * 2308 * Attention: The width and/or height parameters have to be set to a value <= 0 2309 * prior to calling this method, otherwise they will not be calculated. 2310 * If one dimension, i.e. width, is passed with a value > 0, 2311 * the other one, i.e. height, is calculated accordingly. 2312 */ 2313 virtual void GetTemplateSize(int templateId, double& width, double& height); 2314 2315 /// Uses a template in current page or in another template 2316 /** 2317 * Uses the specified template just like an image in the current page or 2318 * in another template. 2319 * 2320 * All parameters are optional. The width or height is calculated using 2321 * GetTemplateSize internally. 2322 * By default the size as defined by BeginTemplate is used. 2323 * 2324 * \param templateId A valid template ID 2325 * \param x The x coordinate 2326 * \param y The y coordinate 2327 * \param width The new width of the template 2328 * \param height The new height of the template 2329 * \see BeginTemplate(), EndTemplate(), ImportPage() 2330 * 2331 * Attention: The template may be displayed distorted, if both width and height 2332 * are given with values > 0 and do not correspond to the dimensions of the template. 2333 */ 2334 virtual void UseTemplate(int templateId, double x = -1, double y = -1, double width = 0, double height = 0); 2335 2336 /// Sets a source file for the external template feature. 2337 /** 2338 * Selects the source for the external template feature. 2339 * A parser is setup for importing pages from the PDF document. 2340 * Although wxPdfDocument usually creates PDF documents conforming to version 1.3 2341 * of the PDF standard, parsing of documents conforming to versions up to 1.6 is 2342 * supported. If pages are aimported from documents conforming to a higher version 2343 * than 1.3 the version used by wxPdDocument is updated accordingly. 2344 * 2345 * \param filename a valid filename 2346 * \param password a valid user or owner password if the PDF document is encrypted 2347 * \return the number of available pages, or 0 if the document could not be opened 2348 * \see ImportPage(), UseTemplate() 2349 * 2350 * Attention: Access permissions for printing, copying and extracting text or graphics 2351 * are required. If a PDF document does not have these access permissions, it cannot 2352 * be used as a source for the external template feature. 2353 */ 2354 virtual int SetSourceFile(const wxString& filename, const wxString& password = wxEmptyString); 2355 2356 /// Gets the document information dictionary of the current external PDF document. 2357 /** 2358 * Gets the values of the Info dictionary of the current external document, if available. 2359 * 2360 * \param info the info dictionary object receiving the document information 2361 * \return true if the info dictionary was available, false otherwise 2362 * \see SetSourceFile() 2363 */ 2364 virtual bool GetSourceInfo(wxPdfInfo& info); 2365 2366 /// Imports a page from an external PDF document 2367 /** 2368 * Imports a page from the current external PDF document. As the bounding box of the 2369 * template the ArtBox of the imported page is used. If the page does not have an 2370 * explicit ArtBox, the CropBox will be used instead; if there is no explicit CropBox 2371 * then the MediaBox will be used. 2372 * 2373 * \param pageno page number of the page to be imported 2374 * \param pageBox page box which should be used (default: ArtBox) 2375 * \return Index of imported page - for use in UseTemplate(). 2376 * A value of 0 is returned if the page number is out of range or no source was selected. 2377 * \see SetSourceFile() 2378 */ 2379 virtual int ImportPage(unsigned int pageno, wxPdfPageBox pageBox = wxPDF_PAGEBOX_ARTBOX); 2380 2381 /// Gets the bounding box of a template 2382 /** 2383 * Especially for pages imported from an external PDF document the size of the bounding 2384 * box might be of interest. The values returned correspond to the coordinates of the 2385 * lower left corner and the width and height of the template. 2386 * 2387 * \param templateId A valid template ID 2388 * \param x The x coordinate of the lower left corner 2389 * \param y The y coordinate of the lower left corner 2390 * \param width The width of the template 2391 * \param height The height of the template 2392 * \see SetTemplateBBox(), BeginTemplate(), ImportPage() 2393 */ 2394 virtual void GetTemplateBBox(int templateId, double& x, double& y, double& width, double& height); 2395 2396 /// Sets the bounding box of a template 2397 /** 2398 * As long as a template hasn't been used it is possible to change the bounding box of 2399 * the template. This may be useful for pages imported from an external PDF document 2400 * allowing to set the visible portion of the template. 2401 * \b Note: Setting the bounding box influences only the visible area of the template, 2402 * not the real size it occupies. 2403 * 2404 * \param templateId A valid template ID 2405 * \param x The x coordinate of the lower left corner 2406 * \param y The y coordinate of the lower left corner 2407 * \param width The width of the template 2408 * \param height The height of the template 2409 * \see GetTemplateBBox(), BeginTemplate(), ImportPage() 2410 */ 2411 virtual void SetTemplateBBox(int templateId, double x, double y, double width, double height); 2412 2413 /// Prints a text string along a path defined by a shape 2414 /** 2415 * \param shape shape defining a path along which the text is printed 2416 * \param text text string to be printed 2417 * \param mode flag how to handle the text string 2418 * \li wxPDF_SHAPEDTEXTMODE_ONETIME: the text should be printed at most one time depending on the path length 2419 * \li wxPDF_SHAPEDTEXTMODE_STRETCHTOFIT: the text should be stretched to fit exactly along the given path (default) 2420 * \li wxPDF_SHAPEDTEXTMODE_REPEAT: the text should be repeated if the text length is shorter than the path length 2421 */ 2422 virtual void ShapedText(const wxPdfShape& shape, const wxString& text, wxPdfShapedTextMode mode = wxPDF_SHAPEDTEXTMODE_STRETCHTOFIT); 2423 2424 /// Add a layer 2425 /** 2426 * An optional content group represents a collection of graphics 2427 * that can be made visible or invisible dynamically by users of viewer applications. 2428 * In wxPdfDocument they are referenced as layers. 2429 * \param layerName the name of the layer 2430 * \return a reference to the new layer 2431 */ 2432 virtual wxPdfLayer* AddLayer(const wxString& layerName); 2433 2434 /// Add a title layer 2435 /** 2436 * Creates a title layer. A title layer is not really a layer but a collection of layers 2437 * under the same title heading. 2438 * \param layerTitle the title text 2439 * \return a reference to the title layer 2440 */ 2441 virtual wxPdfLayer* AddLayerTitle(const wxString& layerTitle); 2442 2443 /// Add a layer membership container 2444 /** 2445 * Content typically belongs to a single optional content group, 2446 * and is visible when the group is <B>ON</B> and invisible when it is <B>OFF</B>. 2447 * To express more complex visibility policies, content should not declare itself 2448 * to belong to an optional content group directly, but rather to an optional 2449 * content membership container. 2450 * \return a reference to the new layer membership container 2451 */ 2452 virtual wxPdfLayerMembership* AddLayerMembership(); 2453 2454 /// Lock a layer 2455 /** 2456 * Use this method to lock an optional content group. 2457 * The state of a locked group cannot be changed through the user interface 2458 * of a viewer application. Producers can use this entry to prevent the visibility 2459 * of content that depends on these groups from being changed by users. 2460 * \param layer the layer that needs to be added to the array of locked OCGs 2461 */ 2462 virtual void LockLayer(wxPdfLayer* layer); 2463 2464 /// Add a radio group of layers 2465 /** 2466 * Use this method to set a collection of optional content groups 2467 * whose states are intended to follow a "radio button" paradigm. 2468 * That is, the state of at most one optional content group 2469 * in the array should be ON at a time: if one group is turned 2470 * ON, all others must be turned OFF. 2471 * \param radioGroup the radio group 2472 */ 2473 virtual void AddLayerRadioGroup(const wxPdfLayerGroup& radioGroup); 2474 2475 /// Enter a layer 2476 /** 2477 * Begins a graphic block whose visibility is controlled by the <CODE>layer</CODE>. 2478 * Blocks can be nested. Each block must be terminated by LeaveLayer().<p> 2479 * Note that nested layers only require a single 2480 * call to this method and a single call to LeaveLayer(); all the nesting control 2481 * is built in. 2482 * \param layer the layer 2483 */ 2484 virtual void EnterLayer(wxPdfLayer* layer); 2485 virtual void EnterLayer(wxPdfLayerMembership* layer); 2486 2487 /// Leave a layer 2488 /** 2489 * Ends a layer controlled graphic block. It will end the most recent open block. 2490 */ 2491 virtual void LeaveLayer(); 2492 2493 /// Attach file 2494 /** 2495 * Attaches a file to the PDF document. 2496 * \param fileName path to the file to attach 2497 * \param attachName the name under which the file will be attached (dfeault: filename) 2498 * \param description an optional description 2499 */ 2500 virtual bool AttachFile(const wxString& fileName, 2501 const wxString& attachName = wxEmptyString, 2502 const wxString& description = wxEmptyString); 2503 2504 /// Set message translation mode 2505 /** 2506 * Sets the message translation mode which controls the handling of msg tags in XML output 2507 * \param translate flag specifying whether messages translation should be enabled 2508 */ SetMessageTranslateMode(bool translate)2509 void SetMessageTranslateMode(bool translate) { m_translate = translate; } 2510 2511 /// Get message translation mode 2512 /** 2513 * Gets the message translation mode which controls the handling of msg tags in XML output 2514 * \return TRUE if messages are translated, FALSE otherwise 2515 */ GetMessageTranslateMode()2516 bool GetMessageTranslateMode() { return m_translate; } 2517 2518 protected: 2519 /// Initialize 2520 virtual void Initialize(int orientation); 2521 2522 /// Save graphic state 2523 virtual void SaveGraphicState(); 2524 2525 /// Restore graphic state 2526 virtual void RestoreGraphicState(); 2527 2528 /// Clear graphic state 2529 virtual void ClearGraphicState(); 2530 2531 /// Select font 2532 virtual bool SelectFont(const wxString& family, 2533 const wxString& style = wxEmptyString, 2534 double size = 0, bool setFont = true); 2535 2536 /// Select font 2537 virtual bool SelectFont(const wxString& family, int style, 2538 double size = 0, bool setFont = true); 2539 2540 /// Select font based on wxFont object 2541 virtual bool SelectFont(const wxFont& font, bool setFont = true); 2542 2543 /// Select font based on wxFont object 2544 virtual bool SelectFont(const wxPdfFont& font, int style, double size = 0, bool setFont = true); 2545 2546 /// Force selecting the current font 2547 virtual void ForceCurrentFont(); 2548 2549 /// Defines the size of the current font. 2550 /** 2551 * \param size The size (in points) 2552 * \param setSize flag whether to actually set the font size in PDF output 2553 * \see SetFont() 2554 */ 2555 virtual void SetFontSize(double size, bool setSize); 2556 2557 /// Apply visual ordering 2558 virtual wxString ApplyVisualOrdering(const wxString& txt); 2559 2560 /// Returns the length of a string in user unit. 2561 /** 2562 * A font must be selected. 2563 * \param s The string whose length is to be computed 2564 * \return int 2565 * \note This method expects the text already to be preprocessed in respect to visual layout. 2566 */ 2567 virtual double DoGetStringWidth(const wxString& s); 2568 2569 /// Prints a cell (rectangular area) with optional borders, background colour and character string. 2570 /** 2571 * \note This method expects the text already to be preprocessed in respect to visual layout. 2572 */ 2573 virtual void DoCell(double w, double h = 0., const wxString& txt = wxEmptyString, 2574 int border = wxPDF_BORDER_NONE, int ln = 0, 2575 int align = wxPDF_ALIGN_LEFT, int fill = 0, 2576 const wxPdfLink& link = wxPdfLink(-1)); 2577 2578 /// Get size of an image 2579 /** 2580 * The size of the image is determined from the given graphics file. 2581 * 2582 * \param file Name of the file containing the image. 2583 * \param mimeType Image format. Possible values are: image/jpeg, image/png, image/gif, image/wmf. 2584 * \return width and height of the image 2585 */ 2586 virtual wxSize GetImageSize(const wxString& file, const wxString& mimeType = wxEmptyString); 2587 2588 /// Start document 2589 virtual void BeginPage(int orientation, wxSize pageSize); 2590 2591 /// End of page contents 2592 virtual void EndPage(); 2593 2594 /// End dociment 2595 virtual void EndDoc(); 2596 2597 /// Add header 2598 virtual void PutHeader(); 2599 2600 /// Add pages. 2601 virtual void PutPages(); 2602 2603 /// Replace page number aliases 2604 virtual void ReplaceNbPagesAlias(); 2605 2606 /// Add resources 2607 virtual void PutResources(); 2608 2609 /// Add bookmarks 2610 virtual void PutBookmarks(); 2611 2612 /// Add extended graphics states 2613 virtual void PutExtGStates(); 2614 2615 /// Add shaders 2616 virtual void PutShaders(); 2617 2618 /// Adds fonts 2619 virtual void PutFonts(); 2620 2621 /// Add images 2622 virtual void PutImages(); 2623 2624 /// Add templates 2625 virtual void PutTemplates(); 2626 2627 /// Add imported objects 2628 virtual void PutImportedObjects(); 2629 2630 virtual void WriteObjectValue(wxPdfObject* value, bool newline = true); 2631 2632 /// Add spot colours 2633 virtual void PutSpotColours(); 2634 2635 /// Add patterns 2636 virtual void PutPatterns(); 2637 2638 /// Add layers 2639 virtual void PutLayers(); 2640 2641 /// Add optional content properties 2642 void PutOCProperties(); 2643 2644 /// Add optional content order 2645 void PutOCGOrder(wxPdfLayer* layer); 2646 2647 /// Add automatic state event 2648 void PutASEvent(const wxString& situation, const wxString& category, bool& first); 2649 2650 /// Add Javascript (document level) 2651 virtual void PutJavaScript(); 2652 2653 /// Add attached files 2654 virtual void PutFiles(); 2655 2656 /// Add resource dictionary 2657 virtual void PutResourceDict(); 2658 2659 /// Add encryption info. 2660 virtual void PutEncryption(); 2661 2662 /// Add form fields 2663 virtual void PutFormFields(); 2664 2665 /// Add info. 2666 virtual void PutInfo(); 2667 2668 /// Addcatalog 2669 virtual void PutCatalog(); 2670 2671 /// Add object dictionary 2672 virtual void PutXObjectDict(); 2673 2674 /// Add trailer 2675 virtual void PutTrailer(); 2676 2677 /// Calculate stream size 2678 size_t CalculateStreamLength(size_t len); 2679 2680 /// Calculate stream offset 2681 size_t CalculateStreamOffset(); 2682 2683 /// Get new object id 2684 int GetNewObjId(); 2685 2686 /// Begin a new object 2687 void NewObj(int objId = 0); 2688 2689 /// Decorate text 2690 wxString DoDecoration(double x, double y, const wxString& txt); 2691 2692 /// Show text string, with kerning if requested 2693 void ShowText(const wxString& txt); 2694 2695 /// Show a single glyph 2696 void ShowGlyph(wxUint32 glyph); 2697 2698 /// Format a text string 2699 void TextEscape(const wxString& s, bool newline = true); 2700 2701 /// Add byte stream 2702 void PutStream(wxMemoryOutputStream& s); 2703 2704 /// Add a text string to the document 2705 void OutTextstring(const wxString& s, bool newline = true); 2706 2707 /// Add a raw text string to the document (without charset conversion) 2708 void OutRawTextstring(const wxString& s, bool newline = true); 2709 2710 /// Add a hex text string to the document (without charset conversion) 2711 void OutHexTextstring(const wxString& s, bool newline = true); 2712 2713 /// Add an ASCII text string to the document 2714 void OutAsciiTextstring(const wxString& s, bool newline = true); 2715 2716 /// Add \ before \, ( and ) 2717 void OutEscape(const char* s, size_t len); 2718 2719 /// Add ASCII string 2720 void OutAscii(const wxString& s, bool newline = true); 2721 2722 /// Add character string 2723 void Out(const char* s, bool newline = true); 2724 2725 /// Add len characters 2726 void Out(const char* s, size_t len, bool newline = true); 2727 2728 /// Sets a draw point 2729 void OutPoint(double x, double y); 2730 2731 /// Sets a draw point relative to current position 2732 void OutPointRelative(double dx, double dy); 2733 2734 /// Draws a line from last draw point 2735 void OutLine(double x, double y); 2736 2737 /// Draws a line relative from last draw point 2738 void OutLineRelative(double dx, double dy); 2739 2740 /// Draws a B�zier curve from last draw point 2741 void OutCurve(double x1, double y1, double x2, double y2, double x3, double y3); 2742 2743 /// Perform transformation 2744 void Transform(double tm[6]); 2745 2746 /// Adds a form field to the document 2747 void AddFormField(wxPdfAnnotationWidget* field, bool setFormField = true); 2748 2749 /// Add an indirect object to the document 2750 void OutIndirectObject(wxPdfIndirectObject* object); 2751 2752 /// Add an image object to the document 2753 void OutImage(wxPdfImage* currentImage, 2754 double x, double y, double w, double h, const wxPdfLink& link); 2755 2756 /// Write XML using XML node 2757 void WriteXml(wxXmlNode* node); 2758 2759 /// Prepare an XML cell for output 2760 void PrepareXmlCell(wxXmlNode* node, wxPdfCellContext& context); 2761 2762 /// Output a prepared XML cell 2763 void WriteXmlCell(wxXmlNode* node, wxPdfCellContext& context); 2764 2765 /// Take alignment of an XML cell into account 2766 void DoXmlAlign(wxPdfCellContext& context); 2767 2768 /// Prepare an XML table for output 2769 void PrepareXmlTable(wxXmlNode* node, wxPdfCellContext& context); 2770 2771 /// Output a prepared XML table 2772 void WriteXmlTable(wxPdfCellContext& context); 2773 2774 /// Set internal scale factor 2775 void SetScaleFactor(const wxString& unit); 2776 2777 wxSize CalculatePageSize(wxPaperSize format); 2778 2779 wxSize CalculatePageSize(double pageWidth, double pageHeight); 2780 2781 virtual void AddPage(int orientation, wxSize pageSize); 2782 2783 void LoadZapfDingBats(); 2784 2785 private: 2786 /// Return a string key by a font name and a font encoding 2787 wxString MakeFontKey(const wxString& fontName, const wxString& fontEncoding); 2788 2789 private: 2790 bool m_yAxisOriginTop; ///< flag whether the origin of the y axis resides at the top (or bottom) of the page 2791 int m_page; ///< current page number 2792 int m_n; ///< current object number 2793 int m_firstPageId; ///< object id of the first page 2794 2795 wxPdfOffsetHashMap* m_offsets; ///< array of object offsets 2796 2797 wxOutputStream* m_buffer; ///< buffer holding in-memory PDF 2798 wxPdfPageHashMap* m_pages; ///< array containing pages 2799 int m_state; ///< current document state 2800 2801 bool m_kerning; ///< kerning flag 2802 bool m_compress; ///< compression flag 2803 int m_defOrientation; ///< default orientation 2804 int m_curOrientation; ///< current orientation 2805 wxPdfBoolHashMap* m_orientationChanges; ///< array indicating orientation changes 2806 wxSize m_defPageSize; ///< default page width 2807 wxSize m_curPageSize; ///< current page width 2808 wxPdfPageSizeMap* m_pageSizes; ///< array indicating page size changes 2809 2810 double m_k; ///< scale factor (number of points in user unit) 2811 double m_fwPt; ///< width of page format in points 2812 double m_fhPt; ///< height of page format in points 2813 double m_fw; ///< width of page format in user unit 2814 double m_fh; ///< height of page format in user unit 2815 double m_wPt; ///< current width of page in points 2816 double m_hPt; ///< current height of page in points 2817 double m_w; ///< current width of page in user unit 2818 double m_h; ///< current height of page in user unit 2819 double m_imgscale; ///< image scale factor 2820 2821 double m_tMargin; ///< top margin 2822 double m_bMargin; ///< page break margin 2823 double m_lMargin; ///< left margin 2824 double m_rMargin; ///< right margin 2825 double m_cMargin; ///< cell margin 2826 2827 double m_x; ///< current x position in user unit for cell positioning 2828 double m_y; ///< current y position in user unit for cell positioning 2829 double m_angle; ///< current rotation angle 2830 double m_lasth; ///< height of last cell printed 2831 double m_lineWidth; ///< line width in user units 2832 wxPdfLineStyle m_lineStyle; ///< current line style 2833 int m_fillRule; ///< current filling rule 2834 2835 int m_inTransform; ///< flag for transformation state 2836 wxPdfFontHashMap* m_fonts; ///< array of used fonts 2837 wxPdfStringHashMap* m_diffs; ///> array of encoding differences 2838 wxPdfBoolHashMap* m_winansi; ///> array of flags whether encoding differences are based on WinAnsi 2839 wxPdfImageHashMap* m_images; ///< array of used images 2840 wxPdfPageLinksMap* m_pageLinks; ///< array of links in pages 2841 wxPdfLinkHashMap* m_links; ///< array of internal links 2842 wxPdfNamedLinksMap* m_namedLinks; ///< array of named internal links 2843 2844 wxPdfExtGStateMap* m_extGStates; ///< array of extended graphics states 2845 wxPdfExtGSLookupMap* m_extGSLookup; ///< array for fast lookup of extended graphics states 2846 int m_currentExtGState; ///< current extended graphics state 2847 2848 wxPdfGradientMap* m_gradients; ///< array of gradients 2849 wxPdfSpotColourMap* m_spotColours; ///< array of spot colours 2850 wxPdfPatternMap* m_patterns; ///< array of patterns 2851 2852 wxPdfAnnotationsMap* m_annotations; ///< array of text annotations 2853 2854 wxArrayPtrVoid m_outlines; ///< array of bookmarks 2855 int m_outlineRoot; ///< number of root node 2856 int m_maxOutlineLevel; ///< max. occuring outline level 2857 2858 wxArrayPtrVoid m_graphicStates; ///< array of graphic states 2859 wxString m_fontPath; ///< current default path for font files 2860 wxString m_fontFamily; ///< current font family 2861 int m_fontStyle; ///< current font style 2862 int m_decoration; ///< font decoration flags 2863 bool m_fontSubsetting; ///< flag whether to use font subsetting 2864 2865 wxPdfFontDetails* m_currentFont; ///< current font info 2866 2867 double m_fontSizePt; ///< current font size in points 2868 double m_fontSize; ///< current font size in user unit 2869 wxPdfColour m_drawColour; ///< commands for drawing colour 2870 wxPdfColour m_fillColour; ///< commands for filling colour 2871 wxPdfColour m_textColour; ///< commands for text colour 2872 bool m_colourFlag; ///< indicates whether fill and text colours are different 2873 bool m_wsApply; ///< Flag whether to apply explicit word spacing 2874 double m_ws; ///< word spacing 2875 wxPdfTextRenderMode m_textRenderMode; ///< text render mode 2876 2877 bool m_autoPageBreak; ///< automatic page breaking 2878 double m_pageBreakTrigger; ///< threshold used to trigger page breaks 2879 bool m_inFooter; ///< flag set when processing footer 2880 wxPdfZoom m_zoomMode; ///< zoom display mode 2881 double m_zoomFactor; ///< zoom factor 2882 wxPdfLayout m_layoutMode; ///< layout display mode 2883 int m_viewerPrefs; ///< viewer preferences 2884 2885 wxString m_title; ///< title 2886 wxString m_subject; ///< subject 2887 wxString m_author; ///< author 2888 wxString m_keywords; ///< keywords 2889 wxString m_creator; ///< creator 2890 wxString m_aliasNbPages; ///< alias for total number of pages 2891 wxString m_PDFVersion; ///< PDF version number 2892 2893 double m_img_rb_x; ///< right-bottom corner X coordinate of inserted image 2894 double m_img_rb_y; ///< right-bottom corner Y coordinate of inserted image 2895 2896 // Encryption 2897 bool m_encrypted; ///< flag whether document is protected 2898 wxPdfEncrypt* m_encryptor; ///< encryptor instance 2899 int m_encObjId; ///< encrypted object id 2900 2901 // Javascript 2902 int m_nJS; ///< Javascript object number 2903 wxString m_javascript; ///< Javascript string 2904 2905 // Forms 2906 int m_zapfdingbats; ///< index of font ZapfDingBats 2907 wxPdfFormFieldsMap* m_formFields; ///< array of form fields 2908 wxPdfFormAnnotsMap* m_formAnnotations; ///< array of form field annotations 2909 wxPdfRadioGroupMap* m_radioGroups; ///< array of radio button groups 2910 wxString m_formBorderColour; ///< form field border colour 2911 wxString m_formBackgroundColour; ///< form field background colour 2912 wxString m_formTextColour; ///< form field text colour 2913 wxString m_formBorderStyle; ///< form field border style 2914 double m_formBorderWidth; ///< form field border width 2915 2916 // Templates 2917 bool m_inTemplate; ///< flag whether template mode is on 2918 wxPdfTemplatesMap* m_templates; ///< array of templates 2919 wxString m_templatePrefix; ///< prefix used for template object names 2920 int m_templateId; ///< Id of current template 2921 wxPdfTemplate* m_currentTemplate; ///< current template 2922 2923 wxPdfParserMap* m_parsers; ///< array of parsers 2924 wxPdfParser* m_currentParser; ///< current parser 2925 wxString m_currentSource; ///< current import source file name 2926 wxString m_importVersion; ///< highest PDF version of imported files 2927 2928 // OCG / layer 2929 wxPdfOcgMap* m_ocgs; ///< array of OCGs 2930 wxPdfLayerRGMap* m_rgLayers; ///< array of radio group layers 2931 wxPdfLayerGroup* m_lockedLayers; ///< array of locked layers 2932 wxArrayInt m_layerDepth; ///< stack for nested layers 2933 2934 // File attachments 2935 int m_nAttachments; ///< attachments object number 2936 wxPdfAttachmentMap* m_attachments; ///< array of file attachments 2937 2938 bool m_translate; ///< flag whether messages in msg tags should be translated 2939 2940 private: 2941 bool m_creationDateSet; ///< flag whether the creation date was explicitly specified 2942 wxDateTime m_creationDate; ///< creation date for the final PDF document 2943 2944 #if WXPDFDOC_INHERIT_WXOBJECT 2945 DECLARE_DYNAMIC_CLASS(wxPdfDocument) 2946 #endif 2947 DECLARE_NO_COPY_CLASS(wxPdfDocument) 2948 2949 friend class wxPdfImage; 2950 friend class wxPdfTable; 2951 }; 2952 2953 #endif 2954