Print Page | Close Window

Adding pages

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: Sample Code
Forum Description: Share Debenu Quick PDF Library sample code with other forum members
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1371
Printed Date: 22 Nov 24 at 6:47PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Adding pages
Posted By: einar
Subject: Adding pages
Date Posted: 18 Mar 10 at 12:38PM
After using much time trying to use ClonePages() and CapturePage()/DrawCapturedPage() without luck, I found that using MergeDocument() did what I needed. So I like to add this function to this forum. The code is in Foxpro.
 
The task is to create a letter using a template with two pages. (The template is created with MS-Word) One page with header/footer for the first page and one page as a template for rest of the pages. The idea is to add template page 2 as many times as needed.
 
Function NewPage(N) && N is template page 1 or 2.
 Local nLast, nDoc2
 With This
  If N==1
   result=.oPDF.LoadFromFile(.templatefile)
   This.DocId=.oPDF.SelectedDocument()
   nLast=This.oPDF.PageCount()
   .oPDF.DeletePages(2,nLast-1)
  Else
   result=.oPDF.LoadFromFile(.templatefile)
   nDoc2=.oPDF.SelectedDocument()
   .oPDF.DeletePages(1,1)
   .oPDF.SelectDocument(.DocId)
   .oPDF.MergeDocument(nDoc2)
  Endif
  nLast=This.oPDF.PageCount()
  .oPDF.SelectPage(nLast)
  Return result
 Endwith
 Endfunc



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