Print Page | Close Window

place one pdf on another

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1071
Printed Date: 07 May 25 at 8:26PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: place one pdf on another
Posted By: Karsten
Subject: place one pdf on another
Date Posted: 27 Apr 09 at 2:24PM
Hi,
 
I'm looking for a solution to do the following steps.
 
1.
 I must create an emty single side pdf with special dimensions in millimeters
PDFLibrary := TQuickPDF0712.Create;
PDFLibrary.SetPageDimensions (310*72/25.4,510*72/25.4);
 
2.
I must place on this page a second pdf-file on position X1,Y1
3.
I must place on this page an eps-file on position X2,Y2
 
4.
Save this PDF-document
PDFLibrary.SaveToFile('D:\placed.pdf');
 
Are the steps 2 and 3 possible with the Quick PDF Library or not?
 
I use imagemagick on this time to do that but the quality is not so good.
 
Karsten



Replies:
Posted By: Ingo
Date Posted: 27 Apr 09 at 3:40PM
Hi Karsten!
You can't put one pdf over the other!
You can merge pdf-documents one after the other ...
What you can do is creating a first pdf and then painting images (like your second and third pdf) on special places of the first pdf. You can determine if it shall be transparency or not and a lot more...
Cheers, Ingo


Posted By: DELBEKE
Date Posted: 28 Apr 09 at 12:45AM

Hi Karsten

Ingo say You can merge pdf-documents one after the other, that's right, but you can use CapturePage and DrawCapturedPage for the point 2.


Posted By: Karsten
Date Posted: 28 Apr 09 at 2:02AM
Thx,
 
@ http://www.quickpdf.org/forum/member_profile.asp?PF=129&FID=15 - DELBEKE
 
Do you have an example to do this?
 
I do this
 
  PDFLibrary.SetPageDimensions (310*72/25.4,510*72/25.4);
  PDFLibrary.SaveToFile('D:\quickpdf\test\empty.pdf');
  PDFLibrary.ClearFileList('mylist');
  PDFLibrary.AddToFileList('mylist','D:\quickpdf\test\empty.pdf');
  PDFLibrary.AddToFileList('mylist','D:\quickpdf\test\test1.pdf');
  PDFLibrary.AddToFileList('mylist','D:\quickpdf\test\test2.pdf');
  PDFLibrary.MergeFileList('mylist','D:\quickpdf\test\merge.pdf');
 
and now I must draw the content of page2 and page 3 to the empty page 1 on position X1,Y1 and X2,Y2
 
after this I can delete page 2 and page 3 and save again.
 
Karsten


Posted By: DELBEKE
Date Posted: 28 Apr 09 at 4:23AM
here is a vb6 sample for drawing a pdf onto an other
 
Private Sub Command1_Click()
Dim IdMain As Long
Dim IdIncluded As Long
Dim IdCaptured As Long
Dim LastPage As Long
Dim lRet As Long
  m_Doc.UnlockKey "mykey"
  lRet = m_Doc.LoadFromFile(Text1.Text) 'load main file
  IdMain = m_Doc.GetDocumentID(m_Doc.DocumentCount) 'save it's id
  LastPage = m_Doc.PageCount  'save nb page in the main doc
  lRet = m_Doc.LoadFromFile(Text2.Text) 'load pdf to be included
  IdIncluded = m_Doc.GetDocumentID(m_Doc.DocumentCount) 'save it's id
  lRet = m_Doc.SelectDocument(IdMain) 'select back main doc
  m_Doc.MergeDocument IdIncluded    'merge the 2 pdfs
  IdCaptured = m_Doc.CapturePage(LastPage + 1) 'capture the fist page of the second pdf
  m_Doc.SelectPage 1  's'lect the page that wil receive the capture
  m_Doc.SetOrigin 1   'coord origin top left
  m_Doc.SetMeasurementUnits 1 'use millimeters as unit for coords
  lRet = m_Doc.DrawCapturedPage(IdCaptured, 10, 10, 150, 150) 'draw the captured page
  'clear possible extra pages got from the second pdf
  If m_Doc.PageCount > LastPage Then
    m_Doc.DeletePages LastPage + 1, m_Doc.PageCount
  End If
  'finaly save the result
  lRet = m_Doc.SaveToFile("c:\test.pdf")
  'clear doc
  m_Doc.RemoveDocument IdMain
End Sub
 


Posted By: Karsten
Date Posted: 28 Apr 09 at 8:27AM

thx.

it works great for step 2 of the first post. Now I need only the solution for step 3 to place an eps-file onto the pdf.
 
Any idea?
 
Karsten


Posted By: Ingo
Date Posted: 28 Apr 09 at 8:43AM
Hi Karsten!
 
The description/functions about drawing an image on a pdf you can find in the online-documentation at the section "image handling"... "DrawImage" should be your choice.
 
After loading your pdf-document ...
First:
AddImageFromFile
Then:
SelectImage
At least:
DrawImage
 
Supported imagetypes are
BMP, TIFF, JPEG, PNG, GIF, WMF and EMF.
So you should convert your eps-file first.
 
Cheers, Ingo
 


Posted By: Karsten
Date Posted: 28 Apr 09 at 10:03AM

all works fine, now I test it with Delphi 2009 and the Beta libraries.

 
Thx


Posted By: Karsten
Date Posted: 29 Apr 09 at 1:56AM
Thx at all,
 
It works realy good for my problem in delphi 2009 with the beta-files. When will release the Delphi2009 DCU's.
I will purchase one license today Smile
 
Karsten
 
 


Posted By: Ingo
Date Posted: 29 Apr 09 at 2:08AM
Hi Karsten!

Such a question you should post at "contact" on www.quickpdflibrary.com .

Cheers, Ingo



Posted By: deabrew
Date Posted: 29 Apr 09 at 2:13AM
We're on the case! At the moment the end date is TBA, but it shouldn't be too much longer. I don't want to provide an exact date just yet...



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk