Print Page | Close Window

Resize A1 and A0 pages to A4

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=3117
Printed Date: 01 May 24 at 11:18PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Resize A1 and A0 pages to A4
Posted By: CrazyTIm
Subject: Resize A1 and A0 pages to A4
Date Posted: 18 May 15 at 6:34AM
Hi All, I am looking for a way to resize all pages of a pdf (containing some A1, and some A0 pages) to A4.

I have experimented with:

SetPageDimensions
NormalizePage
DrawCapturedPage

but no luck yet.


Any help would be appreciated.




Replies:
Posted By: mLipok
Date Posted: 18 May 15 at 8:30AM
Did you use CapturePage or CapturePageEx ?
can you post code snippet ?


-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: erico
Date Posted: 19 May 15 at 4:45PM
CapturePage/CapturePageEx should not matter unless the input file mediabox is the wrong size. 'Ex' allows you to use a choice of boxes for capturing.

I would do something like the following to resize to A4:

// First find out how many pages you need to process:
inputDoc=LoadFromFile(documentname,password)
pagesToProcess = PageCount()

// Create your "sized" template with the correct number of pages
sizedDoc = NewDocument()
SetPageSize("A4")
InsertPages(pagesToProcess -1   // We got one page "for free"

// Combine the documents so CapturePage can be used
MergeDocument(inputDoc)            // Append the document so CapturePage can be used
currentPage = 1
while (currentPage <= pagesToProcess)
{
  CapturePage(pagesToProcess+1)   // This deletes the page from the document
  SelectPage(currentPage)
  DrawCapturedPage(0, 842, 595, 842)    // This draws the captured page at A4 size regardless of its original dimension
  currentPage += 1
}
SaveToFile()


-------------
Eric O


Posted By: mLipok
Date Posted: 19 May 15 at 7:46PM
I think you are using this:
DrawCapturedPage(0, 842, 595, 842) 

in a wrong way.


I see you are using default value for SetOrigin

so I think you need to use this:
DrawCapturedPage(0, 0, 595, 842) 



-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: erico
Date Posted: 19 May 15 at 7:50PM
Doc for DrawCapturedPage says left, top, width, height.

DrawRotatedCapturedPage uses left, bottom, width, height, angle

I think my numbers are correct.


-------------
Eric O


Posted By: mLipok
Date Posted: 20 May 15 at 7:39AM
I see you are using
DrawCapturedPage
not
DrawRotatedCapturedPage

?

EDIT:
ah I see 
SetOrigin default is 0 = Bottom left (default)

try to change 1 = Top left
and then
DrawCapturedPage(0,0,...




-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: mLipok
Date Posted: 20 May 15 at 8:32AM
btw.
From Reference guide:

DrawCapturedPage
Top >> The co-ordinate of the top edge of the destination area

I think this is independently your SetOrigin settings.
If I'am right, then I submit request to Debenu for more clearly describe this in the documentation.



-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: erico
Date Posted: 20 May 15 at 1:31PM
I have not tested the SetOrigin, but I do believe you are correct in stating it does not affect the values for DrawCapturedPage.

In any case, I think CrazyTim can get his job done with this information and a minimal amount of experimentation. Good luck!


-------------
Eric O


Posted By: CrazyTIm
Date Posted: 12 Jun 15 at 1:09AM
Thanks guys,  DrawCapturedPage(0, 842, 595, 842) was what I needed.


Posted By: mLipok
Date Posted: 12 Jun 15 at 1:50AM
Nice to hear You solved a problem.

Can you use GetOrigin() to say us which Origin you are using just before using DrawCaptredPage.




-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600



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