Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Get current page canvas |
Post Reply
|
| Author | |
grapentin
Beginner
Joined: 29 Apr 14 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: Get current page canvasPosted: 29 Apr 14 at 1:00AM |
|
I'm on 10.11 and I've used GetCanvasDC to get a canvas so that I can draw RTF text and NewPageFromCanvasDC to apply the canvas. (Previously we were creating a canvas-based type of report, so I'm remapping the old canvas coordinates into a QuickPdf coordinate system. So generally the easiest solution is to carry on with this approach.)
The problem is this that NewPageFromCanvasDC always creates a new page in the document, so I end up having to read the text back and then re-create it on the previous page, which can be error-prone. See: What I need is to be able to get the current page as a canvas, or apply a canvas over the current page instead of creating a new page. Either that, or find a way to merge two pages together. Any suggestions?
Edited by grapentin - 29 Apr 14 at 1:01AM |
|
![]() |
|
grapentin
Beginner
Joined: 29 Apr 14 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 Apr 14 at 6:02AM |
|
I've discovered a few things. Firstly, the DAExtractPageText I was using to read back the RTF does not get me all the font information, such as underlines and strikeouts. So I MUST merge the pages rather than read back the RTF and re-create it on the previous page.
Finally, I discovered how to merge pages together: pageID = QP.CapturePage(theReport.PDFFile.PageCount); QP.DrawCapturedPage(pageID, 0, 0, QP.PageWidth, QP.PageHeight) Note that the CapturePage function will remove the page that has been captured. So when the DrawCapturedPage function executes, the current page is now what was the previous page, which is exactly what I need.
Edited by grapentin - 29 Apr 14 at 6:03AM |
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 Apr 14 at 3:39PM |
|
grapentin, Your CapturePage code assumes that SetOrigin(1); has been called beforhand. QP.SelectPage can be used to select the correct page before calling DrawCapturedPage. Andrew.
|
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 Apr 14 at 3:42PM |
|
grapetin,
A PDF font doesn't support attributes such as underline, superscript, strikeout. It really only stores the fontname and some font metric dimentions such as ascent, descent. capheight etc. A PDF file is just a group of characters drawn on the page. There is no concept of lines, sentences, paragraphs or other formatting. Andrew
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store