Print Page | Close Window

How to Split A4 into 2xA5 format

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=2877
Printed Date: 19 May 25 at 6:42PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: How to Split A4 into 2xA5 format
Posted By: mLipok
Subject: How to Split A4 into 2xA5 format
Date Posted: 26 Apr 14 at 12:50PM
The question exactly how the topic:
How to Split A4 pdf File/page into 2xA5 format.


EDIT:
Iam using
DebenuPDFLibraryAX1014.PDFLibrary

Best regards
mLipok




Replies:
Posted By: mLipok
Date Posted: 28 Apr 14 at 2:01AM
I managed it with my own.
I could not wait. 
But I'm counting on your help in the future.


Posted By: Ingo
Date Posted: 29 Apr 14 at 7:25AM
Hi,
 
from time to time Debenu-members are looking and answering here, too.
Mainly this is a user-user-forum.
If you're counting on help you sometimes have to wait a few days.
If there's nobody here with the same prob in the past there can't be an answer for you 'cause nobody will sit down to create a solution for you ;-)
But the other way round: If i want to split a page into two smaller ones in the future...
I'll see your headline of the post and open it 'cause i think there's a solution but i'll only find a "i managed it by my own" ;-)
Perhaps you can post your own solution in the samples-section to help others?
On the official Debenu-pages you'll find a lot of samples, FAQs, ...
 
Cheers and welcome here,
Ingo
 


-------------
Cheers,
Ingo



Posted By: mLipok
Date Posted: 29 Apr 14 at 3:42PM
Thanks for your answer.

Just wait a few days, and I post my solution for this problem. 
Becase I solve it my self. 

btw 
I know it's not 24/7/365 help line :) 

I am a member of the community AutoIt 
http://www.autoitscript.com/forum/user/10673-mlipok/ 

and have knowledge and understanding of netiquette 

for this, please bear with us in the future about my language skills. 

Best regards 
Michael Lipok (mLipok)




Posted By: mLipok
Date Posted: 08 May 14 at 2:57PM
"
I'll see your headline of the post and open it 'cause i think there's a solution but i'll only find a "i managed it by my own" ;-)
Perhaps you can post your own solution in the samples-section to help others?
"

Here is my script (  I wrote it in AutoIt   http://www.autoitscript.com/site/" rel="nofollow - http://www.autoitscript.com/site/   )  :


Func _QPDF_A4toA5()
Local $oQP
If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then

#Region create a A4 test PDF

$oQP.SetPageSize('A4')
$oQP.SetOrigin($__QPDF_SORIGIN_TopLeft);
$oQP.SetMeasurementUnits($__QPDF_MUNITS_Milimeters)
$oQP.SetTextSize(10);
Local $iTableID = $oQP.CreateTable(2, 1);
$oQP.SetTableColumnWidth($iTableID, 1, 1, $__QPDF_A4_WidthInMM);
$oQP.SetTableRowHeight($iTableID, 1, 2, $__QPDF_A4_HeightInMM / 2);
$oQP.SetTableCellBorderColor($iTableID, 1, 1, 2, 1, 0, 1, 0, 2);
$oQP.SetTableCellBorderWidth($iTableID, 1, 1, 2, 1, $__QPDF_BORDERINDEX_All, 0.1);
$oQP.SetTableCellTextSize($iTableID, 1, 1, 2, 1, 100)
$oQP.SetTableCellAlignment($iTableID, 1, 1, 2, 1, $__QPDF_CELLALIGNMENT_MiddleCenter);
$oQP.SetTableCellContent($iTableID, 1, 1, 'TOP')
$oQP.SetTableCellContent($iTableID, 2, 1, 'BOTTOM')
$oQP.DrawTableRows($iTableID, 0, 0, $__QPDF_A4_HeightInMM, 1, 2)
$oQP.SaveToFile(@ScriptDir & '\A4_TEST.pdf');

#EndRegion create a A4 test PDF


#Region Create New PDF File with 2* new A5 Landscape Page

Local $iIDMainDocument = $oQP.SelectedDocument()
$oQP.NewDocument()

$oQP.CopyPageRanges($iIDMainDocument, '1') ; it is 2 page but will be first Page
$oQP.SetOrigin($__QPDF_SORIGIN_TopLeft);
$oQP.SetMeasurementUnits($__QPDF_MUNITS_Milimeters)

$oQP.CopyPageRanges($iIDMainDocument, '1') ; it is 3 page but will be second Page
$oQP.SetOrigin($__QPDF_SORIGIN_TopLeft);
$oQP.SetMeasurementUnits($__QPDF_MUNITS_Milimeters)

$oQP.DeletePages(1, 1); Remove the "NewDocument first" empty page.


$oQP.NewPage() ; Top  ; it will be third Page
$oQP.SetPageSize('A5 Landscape');
$oQP.SetOrigin($__QPDF_SORIGIN_TopLeft);
$oQP.SetMeasurementUnits($__QPDF_MUNITS_Milimeters)

$oQP.NewPage() ; Top  ; it will be fourth Page
$oQP.SetPageSize('A5 Landscape');
$oQP.SetOrigin($__QPDF_SORIGIN_TopLeft);
$oQP.SetMeasurementUnits($__QPDF_MUNITS_Milimeters)

$oQP.RemoveDocument($iIDMainDocument)
$oQP.SaveToFile(@ScriptDir & "\__test_1.pdf")

$oQP.SelectPage(1) ; yet, for a little while Page #1
$oQP.SetPageBox($__QPDF_BOXTYPE_CropBox, 0, 0, $__QPDF_A4_WidthInMM, $__QPDF_A4_HeightInMM / 2) ; Media Box - Set Region to Capture
Local $iIDCapture1 = $oQP.CapturePageEx($oQP.SelectedPage(), $__QPDF_BOXTYPE_CropBox - 1)
; Remember Once a page has been captured it is removed from the document.
$oQP.SelectPage(2) ; previously Page #3
$oQP.DrawCapturedPage($iIDCapture1, 0, 0, $__QPDF_A4_WidthInMM, $__QPDF_A4_HeightInMM / 2) ; draw CaptuedPage to SelectedPage
$oQP.SaveToFile(@ScriptDir & "\__test_2.pdf");

$oQP.SelectPage(1) ; previously Page #2
$oQP.SetPageBox($__QPDF_BOXTYPE_CropBox, 0, $__QPDF_A4_HeightInMM / 2, $__QPDF_A4_WidthInMM, $__QPDF_A4_HeightInMM / 2) ; Media Box - Set Region to Capture
Local $iIDCapture2 = $oQP.CapturePageEx($oQP.SelectedPage(), $__QPDF_BOXTYPE_CropBox - 1)
; Remember Once a page has been captured it is removed from the document.
$oQP.SelectPage(2) ; previously Page #4
$oQP.DrawCapturedPage($iIDCapture2, 0, 0, $__QPDF_A4_WidthInMM, $__QPDF_A4_HeightInMM / 2) ; draw CaptuedPage to SelectedPage
$oQP.SaveToFile(@ScriptDir & "\__test_3.pdf")

$oQP.SaveToFile(@ScriptDir & "\A5Format_UpperAndBottom.pdf");

#EndRegion Create New PDF File with 2* new A5 Landscape Page

Sleep(100)

#Region Splitting
Local $sPDF_Destination = ''
$oQP.ExtractFilePages(@ScriptDir & "\A5Format_UpperAndBottom.pdf", '', @ScriptDir & '\A5Format_Upper.pdf', 1)
$oQP.ExtractFilePages(@ScriptDir & "\A5Format_UpperAndBottom.pdf", '', @ScriptDir & '\A5Format_Bottom.pdf', 2)
#EndRegion Splitting
EndIf
EndFunc   ;==>_QPDF_A4toA5





REMARKS:
$oQP is a Object created by this Function: _QPDF_CreateObjectAndUnlock($oQP)
and Returned by Reference

EDIT:
here are results and entire script "QuickPDF_TEST_A4toA5.au3":
http://www.lipok.pl/Debenu/TEST_AU3.ZIP" rel="nofollow - http://www.lipok.pl/Debenu/TEST_AU3.ZIP


Posted By: mLipok
Date Posted: 08 May 14 at 3:08PM
But I have one problem:

when I use 


_QPDF_A4toA5()
MsgBox(1, '\A5Format_Upper.pdf', _QPDF_ExtractTextFromFile(@ScriptDir & '\A5Format_Upper.pdf'))
MsgBox(1, '\A5Format_Bottom.pdf', _QPDF_ExtractTextFromFile(@ScriptDir & '\A5Format_Bottom.pdf'))

_QPDF_Shutdown()


Then in MsgBox I see:
in A5Format_Upper.pdf
TOP
BOTTOM

and 

in A5Format_Bottom.pdf
TOP
BOTTOM



QUESTION:

why 
A5Format_Upper.pdf
and 
A5Format_Bottom.pdf

still contain the entire contents? 


My intention was to 
A5Format_Upper.pdf contained only the text "TOP" 
and 
A5Format_Bottom.pdf contained only the text "BOTTOM"




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