Print Page | Close Window

Using(twice) DrawRotatedCapturedPage on a new Page

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=2930
Printed Date: 03 May 24 at 9:26AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Using(twice) DrawRotatedCapturedPage on a new Page
Posted By: JMLM
Subject: Using(twice) DrawRotatedCapturedPage on a new Page
Date Posted: 06 Jul 14 at 3:22PM
Hello,
I'd like to copy a page and duplicate it on a new page, after rotate and resize each new copy
How DrawRotatedCapturedPage and  CapturePage can be used 
?
I tried thes lines of code, with no success (I thought to use these function this way)
            for (int i = 1; i <= qp.PageCount(); i++)
            {
                qp.SelectPage(i);
                int CapturedPageID = qp.CapturePage(i);
                int newPage = qp.NewPage();
                qp.SelectPage(newPage);
                qp.DrawRotatedCapturedPage(CapturedPageID,0 , 0,
NewWidth, NewHeight, 90);
                qp.DrawRotatedCapturedPage(CapturedPageID, 0, newPos,
NewWidth, NewHeight, 90);
}

NewHeight = iPageWidth;
I have a function for
NewWidth = getNewWidth(iPageHeight,iPageWidth,NewHeight );
        private double getNewWidth(double imgH, double imgW, double newImgH)
        {
            double result = (imgW / imgH * newImgH);
            return result;
        }


I have an error, and my captures are not displayed correctly.
The angle 90 is not respected, I have 180 sometimes
.
cheers,



Replies:
Posted By: AndrewC
Date Posted: 08 Jul 14 at 11:58AM
JMLM,

Can you try the following variation of the code.

Andrew.

for (int i = 1; i <= qp.PageCount(); i++)
{
      int newPage = qp.NewPage();  // For 1 page documents we need a 2nd page before calling CapturePage.
     
      qp.SelectPage(1);  
// Each capture deletes the page so always capture page 1.
      qp.NormalizePage(0);  // Remove rotation and shared content streams.

      int CapturedPageID = qp.CapturePage(1);   // Again page 1.

      qp.SelectPage(newPage);

      qp.DrawRotatedCapturedPage(CapturedPageID,0 , 0, 
NewWidth, NewHeight, 90);
      qp.DrawRotatedCapturedPage(CapturedPageID, 0, newPos, 
NewWidthNewHeight, 90);
}

Andrew.


Posted By: JMLM
Date Posted: 08 Jul 14 at 1:28PM
Hello Andrew,
Thanks for your reply,
Using your code, I still have an error (tree nodes document), on opening the file with adobe reader, and all the qp.DrawRotatedCapturedPage are overlapped on the first page of the document , with an angle of 90 to each page, and the rest of pages are blank.

The result is the same with xcode version, and C# version.

Cheers.
Jim


Posted By: JMLM
Date Posted: 16 Aug 14 at 3:03PM
Hello finaly ,
those lines of codes did the job (objective-c version) :

for (int i = 1; i <= [DQPL PageCount]; i++)

    {

        

        [DQPL NormalizePage:0];

        int CapturedPageID = [DQPL CapturePage:1];   // Again page 1.

        int newPage = [DQPL NewPage];  

        [DQPL SelectPage:newPage];

          

        [DQPL DrawRotatedCapturedPage: CapturedPageID:500 :0 : 500 : 50090]; 

        [DQPL DrawRotatedCapturedPage: CapturedPageID:500 :500 : 500 : 50090];

        

        

    }




Posted By: JMLM
Date Posted: 16 Aug 14 at 3:32PM
I still have a warning on opening the file "The tree node contains an incorrect page." (when  Bookmarks exist in the current file)
even if I remove the bookmarks  with this line of code : 

    int test = [DQPL GetFirstOutline];

    [DQPL RemoveOutline:test];


How can I avoid this warning ?

Cheers Jim



Posted By: AndrewC
Date Posted: 17 Aug 14 at 5:01AM
JMLM,

It sounds like you have more book marks that needs to be delete.  You seem to be only deleting the first bookmark.

Can you upload the PDF or send it to support@debenu.com so we can see what the problem is and how to fix it.  There could be other issues also.

Andrew.


Posted By: JMLM
Date Posted: 19 Aug 14 at 9:42AM
Hello Andrew,
Bookmarks are the problem, I need to list them, and delete them, for the moment , and save the file as a new file. I use the Debenu Reference Guide PDF, for testing.
Thanks for your reply.
Cheers

To delete Outlines : 

    int firstOutline = [DQPL GetFirstOutline];

    int current = firstOutline;

    

    while ([DQPL GetNextOutline:current] != 0) {

        int next = [DQPL GetNextOutline:current];

        [DQPL RemoveOutline:current];

        current = next;

    }

    firstOutline = [DQPL GetFirstOutline];

    [DQPL RemoveOutline:firstOutline];




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