qpdfdocument.sip 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // qpdfdocument.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtPdf Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QPdfDocument : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qpdfdocument.h>
  25. %End
  26. %ConvertToSubClassCode
  27. static struct class_graph {
  28. const char *name;
  29. sipTypeDef **type;
  30. int yes, no;
  31. } graph[] = {
  32. {sipName_QPdfBookmarkModel, &sipType_QPdfBookmarkModel, -1, 1},
  33. {sipName_QPdfDocument, &sipType_QPdfDocument, -1, 2},
  34. #if QT_VERSION >= 0x060600
  35. {sipName_QPdfLinkModel, &sipType_QPdfLinkModel, -1, 3},
  36. #else
  37. {0, 0, -1, 3},
  38. #endif
  39. {sipName_QPdfPageNavigator, &sipType_QPdfPageNavigator, -1, 4},
  40. {sipName_QPdfPageRenderer, &sipType_QPdfPageRenderer, -1, 5},
  41. {sipName_QPdfSearchModel, &sipType_QPdfSearchModel, -1, -1},
  42. };
  43. int i = 0;
  44. sipType = NULL;
  45. do
  46. {
  47. struct class_graph *cg = &graph[i];
  48. if (cg->name != NULL && sipCpp->inherits(cg->name))
  49. {
  50. sipType = *cg->type;
  51. i = cg->yes;
  52. }
  53. else
  54. i = cg->no;
  55. }
  56. while (i >= 0);
  57. %End
  58. public:
  59. enum class Status
  60. {
  61. Null,
  62. Loading,
  63. Ready,
  64. Unloading,
  65. Error,
  66. };
  67. enum class Error
  68. {
  69. None,
  70. Unknown,
  71. DataNotYetAvailable,
  72. FileNotFound,
  73. InvalidFileFormat,
  74. IncorrectPassword,
  75. UnsupportedSecurityScheme,
  76. };
  77. enum class MetaDataField
  78. {
  79. Title,
  80. Subject,
  81. Author,
  82. Keywords,
  83. Producer,
  84. Creator,
  85. CreationDate,
  86. ModificationDate,
  87. };
  88. enum class PageModelRole /BaseType=IntEnum/
  89. {
  90. Label,
  91. PointSize,
  92. };
  93. explicit QPdfDocument(QObject *parent /TransferThis/);
  94. virtual ~QPdfDocument();
  95. QPdfDocument::Error load(const QString &fileName) /ReleaseGIL/;
  96. void load(QIODevice *device) /ReleaseGIL/;
  97. QPdfDocument::Status status() const;
  98. void setPassword(const QString &password);
  99. QString password() const;
  100. QVariant metaData(QPdfDocument::MetaDataField field) const;
  101. QPdfDocument::Error error() const;
  102. void close();
  103. int pageCount() const;
  104. QSizeF pagePointSize(int page) const;
  105. QString pageLabel(int page);
  106. QAbstractListModel *pageModel();
  107. QImage render(int page, QSize imageSize, QPdfDocumentRenderOptions options = QPdfDocumentRenderOptions());
  108. QPdfSelection getSelection(int page, QPointF start, QPointF end);
  109. QPdfSelection getSelectionAtIndex(int page, int startIndex, int maxLength);
  110. QPdfSelection getAllText(int page);
  111. %If (Qt_6_6_0 -)
  112. int pageIndexForLabel(const QString &label);
  113. %End
  114. signals:
  115. void passwordChanged();
  116. void statusChanged(QPdfDocument::Status status);
  117. void pageCountChanged(int pageCount);
  118. void pageModelChanged();
  119. };