Skip to content

Commit 419525b

Browse files
committed
Update Readme.md to reflect new API
1 parent 546586d commit 419525b

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ You can access pages by index:
3434
#include <QtPdfium/QPdfium>
3535
3636
QPdfium pdf("mypdf.pdf");
37-
QWeakReference<QPdfiumPage> ref = pdf.page(0);
38-
qDebug() << ref.data()->width(); // should show something!
37+
QPdfiumPage page = pdf.page(0);
38+
qDebug() << page.width(); // should show something!
3939
```
4040

4141
To generate the image:
@@ -44,8 +44,18 @@ To generate the image:
4444
#include <QtPdfium/QPdfium>
4545

4646
QPdfium pdf("mypdf.pdf");
47-
QWeakReference<QPdfiumPage> ref = pdf.page(0);
48-
QImage image = ref.data()->image(3); //renders it 3 times bigger
47+
QPdfiumPage page = pdf.page(0);
48+
QImage image = page.image(3); //renders it 3 times bigger
49+
```
50+
51+
And for extracting text:
52+
53+
```cpp
54+
#include <QtPdfium/QPdfium>
55+
56+
QPdfium pdf("mypdf.pdf");
57+
QPdfiumPage page = pdf.page(0);
58+
QString pageText = page.text();
4959
```
5060

5161
Note: On iOS you need to initialize QtPdfium manually since it is statically linked. Just create a global object like this:
@@ -71,4 +81,3 @@ Feel free to help. :)
7181

7282
### License
7383
BSD
74-

0 commit comments

Comments
 (0)