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!
Some Pages of PDF File Rotated 180 degrees |
Post Reply |
Author | |
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(1)
|
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 |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
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.
|
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
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? |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store