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!
![]() |
ClonePages giving more copies than requested |
Post Reply
|
| Author | |
juanf
Beginner
Joined: 10 Nov 14 Location: South Africa Status: Offline Points: 11 |
Post Options
Thanks(0)
Quote Reply
Topic: ClonePages giving more copies than requestedPosted: 11 Nov 14 at 1:27AM |
|
Hi,
I'm using ClonePage to create multiple copies, When I request 250 copies, it outputs 308 copies, if i request 57 i get 58, is this a bug with ClonePages? Could Debenu please fix it? Thanks |
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 11 Nov 14 at 11:17AM |
|
Hi Juan,
i think it's not a bug in the library ;-) Perhaps you should post the relevant code part here? So we can have a look telling you what's wrong with it. Cheers and welcome here, Ingo |
|
|
Cheers,
Ingo |
|
![]() |
|
juanf
Beginner
Joined: 10 Nov 14 Location: South Africa Status: Offline Points: 11 |
Post Options
Thanks(0)
Quote Reply
Posted: 11 Nov 14 at 11:51AM |
|
Hello Ingo
See code below. Tried it by itself, without all the code... same issue.
Dim QP As New DebenuPDFLibraryAX1112.PDFLibrary QP = CreateObject("DebenuPDFLibraryAX1112.PDFLibrary") If QP.UnlockKey(My.Settings.DebenuLicence) = 1 Then 'Unlock Debenu Library 'Debenu now unlocked - lets proceed 'check if file exists If Dir(sFilename) <> "" Then 'File exists, we can proceed Dim Pages As Long Dim Copies As Integer Dim CopyAmount As Integer Dim CopyFileName As String Dim MissingCopies As Integer Dim CopiesPageCount As Integer 'Load file QP.LoadFromFile(sFilename, "") 'load file QP.SelectPage(1) 'Select first page 'Set Measurement Units QP.SetMeasurementUnits(1) ' 1=mm 0=default user space 2=inches 'Set Origin QP.SetOrigin(1) 'left top 'Set page count Pages = QP.PageCount() Copies = InputBox("How Many Copies?") If Copies < 500 Then ' use clone instead UpdateStatus("CreateCopies: Creating Copies - Please Wait....") QP.ClonePages(1, Pages, Copies) QP.SaveToFile(sFilename) UpdateStatus("CreateCopies: Copies Done.") QP = Nothing Return "Success" Exit Function Else 'use clone multiplier and file copy and then merge CopyFileName = My.Settings.ProcessingPath & "\" & Path.GetFileNameWithoutExtension(sFilename) Debug.WriteLine("CopyFilename: " & CopyFileName) 'remove processing path files If IO.Directory.Exists(My.Settings.ProcessingPath) Then Dim fileListings() As String fileListings = IO.Directory.GetFiles(My.Settings.ProcessingPath, Path.GetFileNameWithoutExtension(sFilename) & "*.pdf") For Each File In fileListings IO.File.Delete(File) Next End If 'Determine how many copies of the multiplier needs to be created UpdateStatus("CreateCopies: Creating Multiplier") CopyAmount = Int(Copies / 250) MissingCopies = Copies - (250 * CopyAmount) 'createMissing copies and store it in temp folder If MissingCopies = 1 Then 'copy sfilename to temp folder FileCopy(sFilename, CopyFileName & "0.pdf") ElseIf MissingCopies = 0 Then 'do nothing Else QP.ClonePages(1, Pages, MissingCopies) QP.SaveToFile(CopyFileName & "0.pdf") End If UpdateStatus("CreateCopies: Creating Multiplier") Application.DoEvents() 'Create Multiplier PDF QP.ClonePages(1, Pages, 250) ' get 308 copies??? really 'Save File QP.SaveToFile(sFilename) UpdateStatus("CreateCopies: Creating Copies") Application.DoEvents() 'Create Copies For CCopy As Integer = 1 To CopyAmount Step 1 FileCopy(sFilename, CopyFileName & CCopy & ".pdf") UpdateStatus("CreateCopies: Copy " & CCopy & " of " & CopyAmount) Application.DoEvents() Next UpdateStatus("Copies Created - Merging copies... please wait") Application.DoEvents() 'Merge copy files 'Add files to mergelist QP.ClearFileList("MergeList") 'populate merge list Dim InFileNames As String Dim Filelist As String() = Directory.GetFiles(My.Settings.ProcessingPath, Path.GetFileNameWithoutExtension(sFilename) & "*.pdf") For Each InFileNames In Filelist QP.AddToFileList("MergeList", InFileNames) Next Debug.WriteLine(QP.FileListCount("MergeList")) QP.MergeFileListFast("MergeList", sFilename) QP.LoadFromFile(sFilename, "") CopiesPageCount = QP.PageCount() If (Copies * Pages) < CopiesPageCount Then QP.DeletePages(1, CopiesPageCount - (Copies * Pages)) QP.SaveToFile(sFilename) End If UpdateStatus("CreateCopies: Copies Done.") QP = Nothing Return "Success" Exit Function End If Else 'File does not exist Return "Failed" MsgBox("CreateCopies: File Does not Exist", vbOKOnly, "Error") Exit Function End If Else 'Debenu not active Return "Failed" MsgBox("PDF Library not active!", MsgBoxStyle.OkOnly, "Error") Exit Function End If End Function |
|
![]() |
|
juanf
Beginner
Joined: 10 Nov 14 Location: South Africa Status: Offline Points: 11 |
Post Options
Thanks(0)
Quote Reply
Posted: 11 Nov 14 at 12:03PM |
|
Hi Ingo,
Apologies, I only realised now, its because i didnt re-load the file, that it in fact was using the missingcopies file, instead of the inputfile Thanks. |
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 12 Nov 14 at 9:06AM |
|
Hi Juan,
it's always helpful describing the own Problem to other ones ;-) Cheers, Ingo
|
|
|
Cheers,
Ingo |
|
![]() |
|
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