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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Get current page canvas
  FAQ FAQ  Forum Search   Register Register  Login Login

Get current page canvas

 Post Reply Post Reply
Author
Message
grapentin View Drop Down
Beginner
Beginner


Joined: 29 Apr 14
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote grapentin Quote  Post ReplyReply Direct Link To This Post Topic: Get current page canvas
    Posted: 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
Back to Top
grapentin View Drop Down
Beginner
Beginner


Joined: 29 Apr 14
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote grapentin Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 29 Apr 14 at 3:39PM
grapentin,

The LoadFromCanvasDC function is designed to load the first page.  After that you can use NewPageFromCanvasDC.

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.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store