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 - Some Pages of PDF File Rotated 180 degrees
  FAQ FAQ  Forum Search   Register Register  Login Login

Some Pages of PDF File Rotated 180 degrees

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


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Topic: Some Pages of PDF File Rotated 180 degrees
    Posted: 02 Aug 18 at 9:18AM
Hi,

I am using CapturePage and DrawCapturedPage to add margins to PDF files. On some PDF files and only for some pages the contents get rotated by 180 degrees. I have given the code I am using below. (Note I have removed any margins for clarity).

Any suggestions?


FOR lnCount = 1 TO loPDFLibrary.PageCount()
loPDFLibrary.SelectPage(1)
lnPageWidth = loPDFLibrary.PageWidth
lnPageHeight = loPDFLibrary.PageHeight
loPDFLibrary.NormalizePage(2)
capturedPageId = loPDFLibrary.CapturePage(1)

pageId = loPDFLibrary.NewPage()
loPDFLibrary.SelectPage(pageId)
loPDFLibrary.SetPageDimensions(lnPageWidth , lnPageHeight)
loPDFLibrary.SetOrigin(1)
ret = loPDFLibrary.DrawCapturedPage(capturedPageId, 0, 0, lnPageWidth, lnPageHeight)

ENDFOR
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (1) Thanks(1)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 05 Aug 18 at 7:40PM
Hi ysr,

a NormalizePage before working on a selected page
will be the solution for you:
http://www.debenu.com/docs/pdf_library_reference/NormalizePage.php

Cheers and welcome here,
Ingo

Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 06 Aug 18 at 1:13AM
Thank you Ingo,

I changed my code to 

FOR lnCount = 1 TO loPDFLibrary.PageCount()
loPDFLibrary.SelectPage(1)
loPDFLibrary.NormalizePage(2)
lnPageWidth = loPDFLibrary.PageWidth
lnPageHeight = loPDFLibrary.PageHeight

capturedPageId = loPDFLibrary.CapturePage(1)

pageId = loPDFLibrary.NewPage()
loPDFLibrary.SelectPage(pageId)
loPDFLibrary.NormalizePage(2)
loPDFLibrary.SetPageDimensions(lnPageWidth , lnPageHeight)
loPDFLibrary.SetOrigin(1)
ret = loPDFLibrary.DrawCapturedPage(capturedPageId, 0, 0, lnPageWidth, lnPageHeight)

ENDFOR

But unfortunately it doesn't make any difference and those pages that gets rotated remains rotated.
Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 06 Aug 18 at 2:07AM
A further update on this.

I just changed the code to capture and Draw only the second page. Still some pages in the rest of the document automatically gets rotated even though I haven't done any operations on those pages. 

Then I changed the code to only capture (no draw) on the second page. Still the rotation happens. 

It looks like the CapturePage on some pages, somehow affects the remaining pages. I also tried doing a CapturePageEx(2,1) for the second page and added a RemoveOpenAction() at the top. But no luck.

Any suggestions?

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 07 Aug 18 at 9:27PM
The first part doesn't use the loop:
FOR lnCount = 1 TO loPDFLibrary.PageCount()
loPDFLibrary.SelectPage(1)
loPDFLibrary.NormalizePage(2)
...
Try it with:
FOR lnCount = 1 TO loPDFLibrary.PageCount()
loPDFLibrary.SelectPage(InCount)
loPDFLibrary.NormalizePage(2)
Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 17 Aug 18 at 4:08AM
Hi Ingo,

Once again, thank you very much for your reply. In the end we managed to find the problem and it is due to Shared Content Streams. Once we opened the file, if we use RemoveSharedContentStreams the issue is resolved.

I hope it helps someone.
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