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 - Is there a way to detect landscape pages?
  FAQ FAQ  Forum Search   Register Register  Login Login

Is there a way to detect landscape pages?

 Post Reply Post Reply
Author
Message
ExchangeViews View Drop Down
Team Player
Team Player
Avatar

Joined: 13 Mar 12
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote ExchangeViews Quote  Post ReplyReply Direct Link To This Post Topic: Is there a way to detect landscape pages?
    Posted: 18 May 12 at 10:02AM
DrawRotatedText function is not working perfectly for landscape pages. Lib auto convert landscape pages to portrait and them use DrawRotatedText(....) and finally save as landscape. Can anybody help me in detecting landscape pages to set different angle for those pages? Question
Back to Top
edvoigt View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 Mar 11
Location: Berlin, Germany
Status: Offline
Points: 111
Post Options Post Options   Thanks (0) Thanks(0)   Quote edvoigt Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 12 at 12:54PM
Hi,

I think, you are wrong. It seems, as you are working on existing PDF which contains inside a rotate-command.

For solution look at the end of my post:
http://www.quickpdf.org/forum/drawcapturedpage-and-autorotation_topic2071_post8885.html?KW=rotate+edvoigt#8885

Remark: Landscape or portrait is first a question of relation between pagewidth and pageheigt, not of rotation.


Cheers,

Werner


Edited by edvoigt - 18 May 12 at 12:56PM
Back to Top
ExchangeViews View Drop Down
Team Player
Team Player
Avatar

Joined: 13 Mar 12
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote ExchangeViews Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 12 at 7:52AM
Dear Werner, you are right, i am working on existing PDF which contains inside a rotate-command. So I used:
rotation := QP.PageRotation;
  if (rotation<>0)
  then begin
  Angle:=
Angle+rotation; (for angle 0 to 270)
  end;
and the code is working for landscape pages. Thanks for your help!!!!Clap
Back to Top
edvoigt View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 Mar 11
Location: Berlin, Germany
Status: Offline
Points: 111
Post Options Post Options   Thanks (0) Thanks(0)   Quote edvoigt Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 12 at 9:12AM
Hi,

here a small remark. Because on some place an anglevalue only from 0, 90, 180, 270 is accepted, use better:

Angle:= (Angle+rotation) mod 360; // sure inside 0..359

So at RotatePage the Reference Guide says:

PageRotation The number of degrees to rotate the page by. Must be a multiple of 90
degrees (90, 180 or 270)

So with mod you are more on sure side.


Cheers again,

Werner
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: 21 May 12 at 3:06AM

It sounds like you may need to use QP.NormalizePage(0) to allow you to use the DrawText and DrawRotatedText.

  QP.LoadFromFile("page.pdf");
  for (int i=1;i<=QP.PageCount();i++)
  {
     QP.SelectPage(i);
     QP.NormalizePage(0);
  }

Andrew.
Back to Top
ExchangeViews View Drop Down
Team Player
Team Player
Avatar

Joined: 13 Mar 12
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote ExchangeViews Quote  Post ReplyReply Direct Link To This Post Posted: 22 May 12 at 9:43AM
Originally posted by AndrewC AndrewC wrote:


It sounds like you may need to use QP.NormalizePage(0) to allow you to use the DrawText and DrawRotatedText.

  QP.LoadFromFile("page.pdf");
  for (int i=1;i<=QP.PageCount();i++)
  {
     QP.SelectPage(i);
     QP.NormalizePage(0);
  }

Andrew.


Dear Andrew,
Thanks. It is working perfectly for rotated pages but when I use the above code to draw text beneath the page content as below, it display just a blank page. If i comment QP.NormalizePage(0) function, program works fine but another issue occurs for rotated pages.
http://www.quickpdf.org/forum/settextmode-function-is-not-working-for-me-why_topic2261.html

QP.LoadFromFile("page.pdf");
  for (int i=1;i<=QP.PageCount();i++)
  {
   QP.CapturePage
     QP.SelectPage(i);
     QP.NormalizePage(0);
     QP.SaveState;
   QP.SetTextMode(2)
     Watermark;
     QP.LoadState;       // as it was
     QP.DrawCaptured;
  }




Edited by ExchangeViews - 22 May 12 at 9:45AM
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: 22 May 12 at 11:55AM
I am just guessing but try this

QP.LoadFromFile("page.pdf");
  for (int i=1;i<=QP.PageCount();i++)
  {     
     QP.SelectPage(i);
     QP.NormalizePage(0);
     QP.CapturePage
     QP.SaveState;
   QP.SetTextMode(2)
     Watermark;
     QP.LoadState;       // as it was
     QP.DrawCaptured;
  }
Back to Top
ExchangeViews View Drop Down
Team Player
Team Player
Avatar

Joined: 13 Mar 12
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote ExchangeViews Quote  Post ReplyReply Direct Link To This Post Posted: 22 May 12 at 12:29PM
Thanks a lot. Your idea is working fine. I am sorry to bother you. It was so easy.
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