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 > I need help - I can help
  New Posts New Posts RSS Feed - CopyPageRanges corrupts original document
  FAQ FAQ  Forum Search   Register Register  Login Login

CopyPageRanges corrupts original document

 Post Reply Post Reply
Author
Message
JanN View Drop Down
Senior Member
Senior Member


Joined: 29 Oct 05
Location: Germany
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote JanN Quote  Post ReplyReply Direct Link To This Post Topic: CopyPageRanges corrupts original document
    Posted: 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? Confused

Back to Top
JanN View Drop Down
Senior Member
Senior Member


Joined: 29 Oct 05
Location: Germany
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote JanN Quote  Post ReplyReply Direct Link To This Post 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! :)
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
JanN View Drop Down
Senior Member
Senior Member


Joined: 29 Oct 05
Location: Germany
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote JanN Quote  Post ReplyReply Direct Link To This Post 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. Wink 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
Back to Top
JanN View Drop Down
Senior Member
Senior Member


Joined: 29 Oct 05
Location: Germany
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote JanN Quote  Post ReplyReply Direct Link To This Post Posted: 30 Oct 09 at 8:56AM
Same behaviour using latest version 7.17... Cry
Back to Top
JanN View Drop Down
Senior Member
Senior Member


Joined: 29 Oct 05
Location: Germany
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote JanN Quote  Post ReplyReply Direct Link To This Post 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)?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
JanN View Drop Down
Senior Member
Senior Member


Joined: 29 Oct 05
Location: Germany
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote JanN Quote  Post ReplyReply Direct Link To This Post 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.
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