Print Page | Close Window

CapturePage and DrawCapturedPage creating upside d

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=1927
Printed Date: 22 Nov 24 at 7:57PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: CapturePage and DrawCapturedPage creating upside d
Posted By: champagnecharly
Subject: CapturePage and DrawCapturedPage creating upside d
Date Posted: 16 Aug 11 at 1:15AM


Hello,

Where am i going wrong? Is it lack of sleep that stops me seeing the wood for the trees?

Basically using capture I get an upside down mirror image of the original page. 


    Dim CapturedPageID, OptionalContentGroupID, pagecount

pagecount= qp.pagecount
    
     OptionalContentGroupID = qp.NewOptionalContentGroup("NonPrintable")
  Call qp.SetOptionalContentGroupPrintable(OptionalContentGroupID, 0)
  
  CapturedPageID = qp.CapturePage(pagecount)
    Call qp.SetCapturedPageOptional(CapturedPageID, OptionalContentGroupID)
        qp.SelectPage (pagecount - 2)

can anybody see what silly mistake I am making?

Thanks 




Replies:
Posted By: champagnecharly
Date Posted: 16 Aug 11 at 2:11AM
Seems like maybe the origin is where the problem lies. 
If I try and set origin to 1 and then save file. I then check  using getOrigin... it returns 0.  IS this normal?

Regards


Posted By: champagnecharly
Date Posted: 16 Aug 11 at 11:50AM
Ok.. so maybe some important info. The pdf is originally created using XSL> FOP. If I recreate each page. i.e loop through each page and append each page to a new page. then using exactly the same formulae. as previously and overlay the relevant pages.. then there are no mirror images.
This would be an ok work around however the bookmark tree references become corrupt/ invalid.
and my links no longer work. 

Any sugestions?
  


Posted By: AndrewC
Date Posted: 17 Aug 11 at 2:30PM
This problem has been fixed by calling QP.NormalizePage().  

Many libraries, when they create the PDF content stream by adding drawing commands, they don't restore the graphics state back to default when they have finished.  For example, if the last object on the page is 90 degree rotated text and their program rotates the coordinate system to draw the text at 90 degrees but doesn't restore the graphics state back to 0 degrees then the next PDF library that wants to add text to the page such as QPL and the DrawText() command will draw the text at 90 degrees without realising.  Page scaling and the origin can also be affected in the same way.  NormalizePage attempts to fix most of these problems by wrapping the content streams with savestate/restore commands.


Posted By: champagnecharly
Date Posted: 17 Aug 11 at 2:32PM
Thanks Andrew. It certainly fixed the issue. Thank you also for the explanation. 

Regards



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