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 - Merged overlay with multiple pages
  FAQ FAQ  Forum Search   Register Register  Login Login

Merged overlay with multiple pages

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


Joined: 02 Jul 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote coco Quote  Post ReplyReply Direct Link To This Post Topic: Merged overlay with multiple pages
    Posted: 02 Jul 10 at 2:23PM
Hi all,

I'm trying to add an overlay page to a pdf files with 10 pages. This works when i use (exactly) the sample code but the overlay page is printed upsidedown on every page. 
I've tried to use the DrawRotatedCapturedPage function as well but this doesn't give me a result at all.
I'm using version "QuickPDF0719" on Windows 7.

Here's my code: 

var
  oQuickPdf: TQuickPDF;
  iUnlock: Integer;
  iPageHeight, iPageWidth: Double;
  iPrimaryDoc, iSecondaryDoc, iCapturedPageID, iCount, iPrimaryPageCount: Integer;
  sTargetFileName, sDocumentOverlayFile, sDocumentPdfFile: string;
begin

  oQuickPdf := TQuickPDF.Create;
  try
    iUnlock := oQuickPdf.UnlockKey('');

    if iUnlock = 1 then
    begin
      sDocumentPdfFile := DM.GetTempFile('.pdf');
      sDocumentOverlayFile := DM.GetTempFile('.pdf');
      sTargetFileName := DM.GetTempFile('.pdf');
      try
        oQuickPdf.LoadFromFile('c:\users\olav\desktop\Invoice DE.pdf');

        iPrimaryDoc := oQuickPdf.SelectedDocument();
        iPrimaryPageCount := oQuickPdf.PageCount;

        oQuickPdf.LoadFromFile('c:\users\olav\desktop\Overlay.pdf');

        iSecondaryDoc := oQuickPdf.SelectedDocument();

        oQuickPdf.SelectDocument(iPrimaryDoc);

        oQuickPdf.MergeDocument(iSecondaryDoc);

        iPageHeight := oQuickPdf.PageHeight();
        iPageWidth := oQuickPdf.PageWidth();

        iCapturedPageID := oQuickPdf.CapturePage(oQuickPdf.PageCount);

        oQuickPdf.SelectDocument(iPrimaryDoc);

        for iCount := 1 to iPrimaryPageCount do begin
          oQuickPdf.SelectPage(iCount);
          oQuickPdf.SetOrigin(1);
          oQuickPdf.DrawCapturedPage(iCapturedPageID, 0, 0, iPageWidth, iPageHeight);
        end;

        oQuickPdf.SaveToFile(sTargetFileName);
        ShellExecute(Application.Handle, 'open', PAnsiChar(sTargetFileName), '', '', SW_NORMAL);
      finally
    //delete files etc.
      end;

    end else
    begin
      ShowMessage('Invalid license key');
    end;
  finally
    oQuickPdf.Free;
  end;
end;
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 (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 02 Jul 10 at 3:27PM
Hi Coco!

No time... Only a quick shot:
Try SetOrigin

Cheers and welcome here,
Ingo

Back to Top
coco View Drop Down
Beginner
Beginner


Joined: 02 Jul 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote coco Quote  Post ReplyReply Direct Link To This Post Posted: 02 Jul 10 at 3:49PM
Thanks, but I've tried this one. Unfortunately without results...

Regards Olav
Back to Top
coco View Drop Down
Beginner
Beginner


Joined: 02 Jul 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote coco Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jul 10 at 11:12AM
Hi again, 

Is there anything else I can try?
I'm pretty stuck right now :(

Kind regards
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 (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jul 10 at 1:59PM
Originally posted by coco coco wrote:


Is there anything else I can try?


Hi!

If you don't get an answer here you should try
the official support pages.

Cheers, Ingo

Back to Top
evil_hunter View Drop Down
Beginner
Beginner


Joined: 24 Jun 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote evil_hunter Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 10 at 1:40PM
Hi,
I don't know if it can help you (i don't really understand your demand... i know i know my english is not perfect!^^)
I did that (in VB)
 

If Result = 1 Then

'You can only use the DrawCapturedPage function if the captured page is in the same

'document, so first we'll need to merge the two pages that we wish to overlay together

'into one document.

QP.LoadFromFile(file1)

FileA = QP.SelectedDocument()

QP.LoadFromFile(file2)

FileB = QP.SelectedDocument()

'After merging FileB is automatically deleted, leaving only FileB which is now a combination of FileA and FileB

QP.SelectDocument(FileA)

QP.MergeDocument(FileB)

'Capture the page to copy in the merged document

CapturedPageID = QP.CapturePage(QP.PageCount)

'Now select the page(s) and retrieve its height and width

For i = 1 To QP.PageCount

QP.SelectDocument(FileA)

QP.SelectPage(i)

PageHeight = QP.PageHeight()

PageWidth = QP.PageWidth()

'Draw the captured page onto the currently selected page(s)

QP.DrawCapturedPage(CapturedPageID, 0, PageHeight, PageWidth, PageHeight)

Next

 

'Save the stitched file to disk

QP.SaveToFile("")

Bye!
Back to Top
coco View Drop Down
Beginner
Beginner


Joined: 02 Jul 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote coco Quote  Post ReplyReply Direct Link To This Post Posted: 13 Aug 10 at 12:36PM
Hi,
 
Thanks for the reply. I've found out that my code was ok like it was.
 
However, when using pdf files exported by crystal reports this strange behaviour was introduced. It worked perfectly fine with any other pdf.
 
Regards
Back to Top
evil_hunter View Drop Down
Beginner
Beginner


Joined: 24 Jun 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote evil_hunter Quote  Post ReplyReply Direct Link To This Post Posted: 16 Aug 10 at 1:47PM
Hum exact...
my code doesn't work with pdf generated by crystal... any solutions?
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 (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 16 Aug 10 at 3:10PM
Hi!

No.
But i've made the experiences that this doesn' happen with newer (i don't know how new) versions of crystal reps.
Why not upload your prob-docs to the official support pages?
There won't be a solution but perhaps further versions of QP can work with these documents.

Cheers, Ingo

Back to Top
evil_hunter View Drop Down
Beginner
Beginner


Joined: 24 Jun 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote evil_hunter Quote  Post ReplyReply Direct Link To This Post Posted: 17 Aug 10 at 4:20PM
It's ok i found how to generate a "good" pdf! works with crystal 9 and 11.
I'll test with 2008.
Back to Top
coco View Drop Down
Beginner
Beginner


Joined: 02 Jul 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote coco Quote  Post ReplyReply Direct Link To This Post Posted: 18 Aug 10 at 11:28AM
That sounds great! Can you tell me how you did it?
Back to Top
evil_hunter View Drop Down
Beginner
Beginner


Joined: 24 Jun 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote evil_hunter Quote  Post ReplyReply Direct Link To This Post Posted: 18 Aug 10 at 1:22PM

I ve find that you can't overlay a pdf on a pdf made with crystal 11 (with crystal 9 the overlay pdf is rotate and small, in my case).

But you can overlay a pdf made by crystal (9 or 11) on an other pdf!
In my case it's ok because juste one of the 2 pdf are comming from crystal! I don't know in yours...
Back to Top
coco View Drop Down
Beginner
Beginner


Joined: 02 Jul 10
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote coco Quote  Post ReplyReply Direct Link To This Post Posted: 10 Sep 10 at 3:16PM
Hmm, I didn't get a mailmessage about your reply so sorry for the late reaction.
I'm having the same case but my crystal report can contain more then 1 page so that doesn't work.
 
Of course I can duplicate the overlay until it matches the number of pages that my report contains but I don't like the method :(
 
I guess there's no other way at the moment. Thanks for your reaction!
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