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 > General Discussion
  New Posts New Posts RSS Feed - Simple Imposition
  FAQ FAQ  Forum Search   Register Register  Login Login

Simple Imposition

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


Joined: 24 May 16
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote WilliamFaulkner Quote  Post ReplyReply Direct Link To This Post Topic: Simple Imposition
    Posted: 24 May 16 at 12:45AM
Greetings,

I simply have to take two distinct portrait Letter-sized Pdf files and impose them on a landscape Tabloid-sized blank Pdf.

The code currently only outputs the second page on the left side of the tabloid.

Here is my code...


Sub Impose_2up_Letter_On_Tabloid

    Dim ClassName
    Dim LicenseKey
    Dim PdfLib
    Dim Result
    
    
ClassName = "QuickPDFAX0725.PDFLibrary"
LicenseKey = "######censured##########" ' KEY
    Set PdfLib = CreateObject(ClassName)
Result = PdfLib.UnlockKey(LicenseKey)
    
    If Result = 1 Then
    
        intTabloidLandscapeTemplate =         PdfLib.LoadFromFile(Pdf_File_Tabloid_Landscape_Template)
        intTabloidLandscapeTemplate = PdfLib.SelectedDocument()
        
        intTabloidLandscapeTemplate = PdfLib.setorigin(1) ' Top left
        intTabloidLandscapeTemplate = PdfLib.setmeasurementunits(2) ' Inches
        intTabloidLandscapeTemplate = PdfLib.setpagesize("Tabloid Landscape")
        
        counter = 1
        
While counter <= (Pdf_File_Names_Dictionary.Count - 2)
        
        Pdf_File_Left = Pdf_File_Names_Dictionary.Item(CStr(counter))
        PdfLib.LoadFromFile(Pdf_File_Left)
        intLeftPage = PdfLib.SelectedDocument()
            'intLeftPage = PdfLib.CapturePage(1)
            
        counter = counter + 1
            
        Pdf_File_Right = Pdf_File_Names_Dictionary.Item(CStr(counter))
        PdfLib.LoadFromFile(Pdf_File_Right)
        intRightPage = PdfLib.SelectedDocument()
            'intRightPage = PdfLib.CapturePage(1)
            
        counter = counter + 1
            
        intTabloidLandscapeTemplate = PdfLib.setpagesize("Tabloid Landscape")
        intTabloidLandscapeTemplate = PdfLib.DrawCapturedPage(intLeftPage,X1,Y,8.5,11)
        intTabloidLandscapeTemplate = PdfLib.setpagesize("Tabloid Landscape")
        intTabloidLandscapeTemplate = PdfLib.DrawCapturedPage(intRightPage,X2,Y,8.5,11)
                    
            
        Pdf_File_Imposed = Prod_Pdf_Files_Output_folder & "\" & CStr((counter - 2)) & "-" & CStr((counter-1)) &".pdf"
            
        intTabloidLandscapeTemplate = PdfLib.SaveToFile(Pdf_File_Imposed)
        
        
        Wend
        
    End If

End Sub






Thank you for your time,
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: 24 May 16 at 5:42PM
Hi William ;-)

i think the empty landscape pdf wasn't landscape while creation but rotated later?
I think internally it's a portrait format with a rotate 90.
That's your hurdle i fear.
The newer versions of the library offers a NormalizePage to avoid problems like these ones.
But there's no need to use an existing, empty landscape pdf for this job.
You can do this from scratch on the fly.
In the developer guide and in the knowledge base you'll find enough samples for jobs like the described one.

Cheers and welcome here,
Ingo

Cheers,
Ingo

Back to Top
WilliamFaulkner View Drop Down
Beginner
Beginner


Joined: 24 May 16
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote WilliamFaulkner Quote  Post ReplyReply Direct Link To This Post Posted: 24 May 16 at 7:01PM
hi Ingo,

Thanks for the help, its good to see.
I created it landscape in inDesign however working without it, as you mentioned, does seem simpler.

Could I bother you a bit more and ask you more details?

Thank you,
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: 24 May 16 at 7:40PM
Hi,

here i've found three posts/threads with the search-function
giving you an idea how this can be done:
http://www.debenu.com/kb/programmatically-impose-multiple-pages-on-one-page-imposition/
http://www.quickpdf.org/forum/what-does-drawcapturedpage-do_topic594.html
http://www.debenu.com/kb/merge-content-from-multiple-pages-into-one-page/
 
Cheers,
Ingo

Back to Top
WilliamFaulkner View Drop Down
Beginner
Beginner


Joined: 24 May 16
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote WilliamFaulkner Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 16 at 12:06AM
Hi Ingo,

Reading the links and developer pdf did help...
Not knowing how Pdf is implemented made me have wrong assumptions.
Thank you for reminding me to RTM, really, I should have started there.

I've merged my two letter sized documents prior to using CapturePage.
However, my output is a blank tabloid landscape.

While counter <= (Pdf_File_Names_Dictionary.Count - 2

   Pdf_File_Left = Pdf_File_Names_Dictionary.Item(CStr(counter))
   PdfLib.LoadFromFile(Pdf_File_Left)
   leftPage = PdfLib.SelectedDocument()
            
   Pdf_File_Right = Pdf_File_Names_Dictionary.Item(CStr(counter + 1))
   PdfLib.LoadFromFile(Pdf_File_Right)
   rightPage = PdfLib.SelectedDocument()
            
   PdfLib.SelectDocument(leftPage)
   PdfLib.MergeDocument(rightPage)
            
   PdfLib.NewPage()
   PdfLib.setpagesize("Tabloid Landscape")
            
   leftPage = PdfLib.CapturePage(1)
   rightPage = PdfLib.CapturePage(1)

   tabloid = PdfLib.DrawCapturedPage(leftPage,X1,Y,8.5,11) 'X1 = 0 = Y
   tabloid = PdfLib.DrawCapturedPage(rightPage,X2,Y,8.5,11) 'X2 = 8.5

   Pdf_File_Imposed = Prod_Pdf_Files_Output_folder & "\test.pdf"
   PdfLib.SaveToFile(Pdf_File_Imposed)
           
   counter = counter + 1
Wend

Any hints is appreciated!

ps: I am not a professional programmer, but am learning, thanks for your patience.









Edited by WilliamFaulkner - 25 May 16 at 12:07AM
Back to Top
WilliamFaulkner View Drop Down
Beginner
Beginner


Joined: 24 May 16
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote WilliamFaulkner Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 16 at 12:50AM
SUCCESS! :) 
I had forgotten to set measurement and origins!
Back to Top
Shaare View Drop Down
Beginner
Beginner
Avatar

Joined: 25 May 16
Location: Vancouver
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shaare Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 16 at 2:14AM
Here's the code for this:

Pdf_File_Left_Path = Pdf_File_Names_Dictionary.Item(CStr(counter))
PdfLib.LoadFromFile(Pdf_File_Left_Path)
Pdf_File_Left_Selected_Document_Pointer = PdfLib.SelectedDocument()
counter = counter + 1

Pdf_File_Right_Path = Pdf_File_Names_Dictionary.Item(CStr(counter))
PdfLib.LoadFromFile(Pdf_File_Right_Path)
Pdf_File_Right_Selected_Document_Pointer = PdfLib.SelectedDocument()
counter = counter + 1
PdfLib.SelectDocument(Pdf_File_Left_Selected_Document_Pointer)
PdfLib.MergeDocument(Pdf_File_Right_Selected_Document_Pointer)

PdfLib.NewPage()
PdfLib.setpagesize("Tabloid Landscape")

Pdf_File_Left_Captured_Page_Pointer = PdfLib.CapturePage(1)
Pdf_File_Right_Captured_Page_Pointer = PdfLib.CapturePage(1)

PdfLib.setorigin(1) 'Top left
PdfLib.setmeasurementunits(2) 'Inches
            
Result = PdfLib.DrawCapturedPage(Pdf_File_Left_Captured_Page_Pointer,X1,Y,8.5,11)      
Result = PdfLib.DrawCapturedPage(Pdf_File_Right_Captured_Page_Pointer,X2,Y,8.5,11)

Pdf_File_Name_Tabloid_Imposition = Prod_Pdf_Files_Output_folder & "\" & CStr((counter - 2)) & "-" & CStr((counter-1)) &".pdf"
PdfLib.SaveToFile(Pdf_File_Name_Tabloid_Imposition)
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