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!
Simple Imposition |
Post Reply |
Author | |
WilliamFaulkner
Beginner Joined: 24 May 16 Status: Offline Points: 5 |
Post Options
Thanks(0)
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,
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(1)
|
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 |
|
WilliamFaulkner
Beginner Joined: 24 May 16 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
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,
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(1)
|
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 |
|
WilliamFaulkner
Beginner Joined: 24 May 16 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
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 |
|
WilliamFaulkner
Beginner Joined: 24 May 16 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
SUCCESS! :)
I had forgotten to set measurement and origins!
|
|
Shaare
Beginner Joined: 25 May 16 Location: Vancouver Status: Offline Points: 1 |
Post Options
Thanks(0)
|
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) |
|
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