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!
![]() |
CopyPageRanges corrupts original document |
Post Reply
|
| Author | |
JanN
Senior Member
Joined: 29 Oct 05 Location: Germany Status: Offline Points: 116 |
Post Options
Thanks(0)
Quote Reply
Topic: CopyPageRanges corrupts original documentPosted: 21 Oct 09 at 10:59AM |
|
Hi,
I have used the following code. Please have a look at the comments. ------ var pdf: TQuickPDF0716; id: Integer; begin pdf := TQuickPDF0716.Create; pdf.UnlockKey(';-)'); pdf.LoadFromFile('c:\temp\x.pdf'); id := pdf.SelectedDocument; pdf.SaveToFile('c:\temp\x1.pdf'); // this file is okay and fits the original file pdf.NewDocument; pdf.CopyPageRanges(id, '1'); pdf.SelectDocument(id); pdf.SaveToFile('c:\temp\x2.pdf'); // !!!this file is corrupt!!! pdf.Free; ------ I believe it's a bug in the library. Or have I missed something? ![]() |
|
![]() |
|
JanN
Senior Member
Joined: 29 Oct 05 Location: Germany Status: Offline Points: 116 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 Oct 09 at 10:04AM |
|
Could anybody please quickly run my code with another test file and confirm my result? That would already help me a lot. Thanks in advance! :)
|
|
![]() |
|
Rowan
Moderator Group
Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 Oct 09 at 5:38AM |
|
Hi Jan,
Try the code listed below, does it work for you? ------ var pdf: TQuickPDF0716; id1: Integer; id2: Integer; begin pdf := TQuickPDF0716.Create; pdf.UnlockKey(';-)'); id1 := pdf.LoadFromFile('c:\temp\x.pdf'); pdf.SelectDocument(id1); pdf.SaveToFile('c:\temp\x1.pdf'); // this file is okay and fits the original file id2 := pdf.NewDocument; pdf.SelectDocument(id2); pdf.CopyPageRanges(id, '1'); pdf.SaveToFile('c:\temp\x2.pdf'); // !!!this file is corrupt!!! pdf.Free; ------ Cheers, - Rowan.
|
|
![]() |
|
JanN
Senior Member
Joined: 29 Oct 05 Location: Germany Status: Offline Points: 116 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 Oct 09 at 9:25AM |
|
Hi Rowan,
Thanks for your reply. Be careful with "id1 := LoadFromFile()". That function only returns success or error. But the following code works.------ var pdf: TQuickPDF0716; id1, id2: Integer; begin pdf := TQuickPDF0716.Create; pdf.UnlockKey(';-)'); pdf.LoadFromFile('c:\temp\x.pdf'); id1 := pdf.SelectedDocument; pdf.SaveToFile('c:\temp\x1.pdf'); id2 := pdf.NewDocument; pdf.SelectDocument(id2); pdf.CopyPageRanges(id1, '1'); pdf.SaveToFile('c:\temp\x2.pdf'); pdf.Free; end ------ But... I need to be able to call CopyPageRanges and afterwards work again with the original document. Something like that: ------ var pdf: TQuickPDF0716; id1, id2, id3, pc: Integer; begin pdf := TQuickPDF0716.Create; pdf.UnlockKey(''); pdf.LoadFromFile('c:\temp\x.pdf'); pc := pdf.PageCount; id1 := pdf.SelectedDocument; // 1. saving original document is okay pdf.SaveToFile('c:\temp\x1.pdf'); // 2. saving original document is okay pdf.SaveToFile('c:\temp\x2.pdf'); // Saving copy 1 is okay id2 := pdf.NewDocument; pdf.SelectDocument(id2); pdf.CopyPageRanges(id1, '1-' + IntToStr(pc)); pdf.DeletePages(1, 1); pdf.SaveToFile('c:\temp\x3.pdf'); // Saving copy 2 is okay id3 := pdf.NewDocument; pdf.SelectDocument(id3); pdf.CopyPageRanges(id1, '1-' + IntToStr(pc)); pdf.DeletePages(1, 1); pdf.SaveToFile('c:\temp\x4.pdf'); // 3. Saving original document -> corrupt file pdf.SelectDocument(id1); pdf.SaveToFile('c:\temp\x5.pdf'); pdf.Free; end; ------ Can you reproduce that error? Edited by JanN - 27 Oct 09 at 9:27AM |
|
![]() |
|
JanN
Senior Member
Joined: 29 Oct 05 Location: Germany Status: Offline Points: 116 |
Post Options
Thanks(0)
Quote Reply
Posted: 30 Oct 09 at 8:56AM |
|
Same behaviour using latest version 7.17...
|
|
![]() |
|
JanN
Senior Member
Joined: 29 Oct 05 Location: Germany Status: Offline Points: 116 |
Post Options
Thanks(0)
Quote Reply
Posted: 03 Nov 09 at 9:48AM |
|
Hi Rowan,
Sorry for being impatient. But I need the CopyPageRanges function in a current project. Do you already have an idea why that happens? Can you estimate how long it will take to provide a patch (if it's a bug)? |
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 03 Nov 09 at 11:47AM |
|
Hi Jan!
It depends on the point of view... Perhaps this kind of work isn't possible or QuickPDF doesn't offer this piece of functionality you need or there's a buggy QuickPDF-function. If you think that the last point is the right one that you should post your problem on the official support site. Rowan visited this user-user-forum from time to time but not in a regulary way. Cheers, Ingo |
|
![]() |
|
JanN
Senior Member
Joined: 29 Oct 05 Location: Germany Status: Offline Points: 116 |
Post Options
Thanks(0)
Quote Reply
Posted: 03 Nov 09 at 11:55AM |
|
Moin Ingo!
I already chose that way (support site). But Rowan asked me to continue the case here. But I'll give it another try. |
|
![]() |
|
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