Print Page | Close Window

DrawCapturedPage is Drawing off artboard

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2171
Printed Date: 17 Jan 26 at 12:39AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DrawCapturedPage is Drawing off artboard
Posted By: dptulk
Subject: DrawCapturedPage is Drawing off artboard
Date Posted: 24 Feb 12 at 2:14AM
I have some vb code that I am using to try to imposition some pages.  It took me forever to figure it out but the drawcapturedpage command is drawing it far off of the current page.  are there any known issues with this?  Is there something that I am missing?

Here is the code that I am using:
 QP.LoadFromFile(SrcFileName, "")
        Dim numpages As Integer = QP.PageCount
        Dim pagewidth = QP.PageWidth()
        Dim pageheight = QP.PageHeight()

        MsgBox("There are " & numpages & " in the " & pagewidth & " x " & pageheight & " document.")

        Dim ThisCaptureID = QP.CapturePage(2)

        QP.NewPage()
        'QP.SetPageDimensions(1224, 792)
        QP.SetPageSize("Tabloid")
        QP.SetFillColor(1, 1, 0)
        QP.DrawBox(0, 0, 1224, 792, 1)
        Dim Capt = QP.DrawCapturedPage(ThisCaptureID, 0, 0, pagewidth, pageheight)
        MsgBox(Capt)

        QP.DeletePages(1, numpages)
        QP.SaveToFile("newfile.pdf")
        QP = Nothing




Replies:
Posted By: jpbro
Date Posted: 24 Feb 12 at 2:50AM
A PDF origin is the bottom left corner as opposed to the top left as you might intuitively expect.

Try calling QP.SetOrigin 1 to change the origin to the top-left corner before drawing.



Posted By: dptulk
Date Posted: 24 Feb 12 at 3:41AM
So the origin of the source and the origin of the destination are both bottom left?  That seems strange.  I will give it a shot.



Posted By: AndrewC
Date Posted: 24 Feb 12 at 8:46AM
dptulk is correct.

The origin is located in the bottom left corner and the y axis increases as you go up the page.  This is the default for Postscript and PDF.

Call QP.SetOrigin(1)  just before you call QP.SetPageSize() and it should work well.



Posted By: edvoigt
Date Posted: 24 Feb 12 at 10:10AM
Hi,

I see another small problem. You try to delete all pages. Only because of

"PageCount The total number of pages to delete. The value will be automatically adjusted if
necessary so that the document is left with at least one page.
"

DeletePages deletes only numpages-1. This potential to come in error, when making the code for more than only test.


Cheers,
Werner



Posted By: dptulk
Date Posted: 24 Feb 12 at 4:50PM
That did the trick gentlemen...  Thank you.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk