Print Page | Close Window

Insert a Background in Pdf

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=391
Printed Date: 03 May 24 at 5:22AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Insert a Background in Pdf
Posted By: kaliand
Subject: Insert a Background in Pdf
Date Posted: 14 Apr 06 at 4:05PM
Hi everybody,
first of all sorry about my english, i'm from barcelona.

i'm using the activeX dll with visual basic.
i'd like to know if there's any way to insert a background in a pdf ? as in acrobat 7 professional, from a file (pdf file in my case).

The background image is a pdf file in "vectorial", and i would not like to convert to a jpg file to do this.

can anyone help me?

Thanks and regards.



Replies:
Posted By: chicks
Date Posted: 14 Apr 06 at 5:58PM
This is untested vbscript, not sure if it still works. Note how it merges the letterhead to the end of the document, captures it (which removes it from the document), then draws the captured page on all the other pages.

For a background, you may need to look at the layer functions to move it behind the text layer.

<pre>

'-- Init iSedQuickPDF and FSO objects
Set QP = CreateObject("iSED.QuickPDF")

'-- Set file names
ltrHdFileName = "LetterHead.pdf"
inFileName = "Document.pdf"
outFileName = "Imposed.pdf"

'-- Unlock the PDF library
Call QP.UnlockKey(" -- YOUR QUICKPDF KEY GOES HERE -- ")

'-- Load the letterhead
Ret = QP.LoadFromFile(ltrHdFileName)
idLetterHead = QP.SelectedDocument()
WScript.Echo("Load Letterhead: " & Ret)
w = QP.PageWidth()
h = QP.PageHeight()

'-- Load the input PDF
Ret = QP.LoadFromFile(inFileName)
idDocument = QP.SelectedDocument()
WScript.Echo("Load File: " & Ret)

'-- Merge the letterhead to the end of the document
Ret = QP.MergeDocument(idLetterHead)
WScript.Echo("Merge: " & Ret)

'-- Capture the letterhead page
ltrHdID = QP.CapturePage(QP.PageCount())
WScript.Echo("Capture ID: " & ltrHdID)

Call QP.SetOrigin(1)

'-- Then we get the number of pages in the document
pageCount = QP.PageCount()
WScript.Echo("PageCount: " & pageCount)

'-- Stamp the letterhead on each page of the document
For page = 1 To pageCount
    Call QP.SelectPage(page)
    WScript.Echo("Page: " & page & " Width: " & w & " Height: " & h)
    Ret = QP.DrawCapturedPage(ltrHdID, 0, 0, w, h)
    WScript.Echo("DrawCapturedPage: " & Ret)
Next

'-- Save the imposed file

Call QP.SaveToFile(outFileName)

Set QP = nothing

</pre>


Posted By: kaliand
Date Posted: 16 Apr 06 at 12:25PM
thanks a lot for your quick answer, it was very usefull, an certenly it is very easy to insert a background with ised dll and i can sure hat the result is much bether than with the acrobat program.

another question, is it possible to create a pdf with dll from a microsoft officce word or excel? like distiller does?

regards!


Posted By: eliazTeez
Date Posted: 11 Sep 17 at 2:01PM
If the Background is rotated then add Call doc.NormalizePage(0).

'-- Init iSedQuickPDF and FSO objects 
Set QP = CreateObject("iSED.QuickPDF") 

'-- Set file names 
ltrHdFileName = "LetterHead.pdf" 
inFileName = "Document.pdf" 
outFileName = "Imposed.pdf" 

'-- Unlock the PDF library 
Call QP.UnlockKey(" -- YOUR QUICKPDF KEY GOES HERE -- ") 

'-- Load the letterhead 
Ret = QP.LoadFromFile(ltrHdFileName) 
idLetterHead = QP.SelectedDocument() 
WScript.Echo("Load Letterhead: " & Ret) 
w = QP.PageWidth() 
h = QP.PageHeight() 

'-- Load the input PDF 
Ret = QP.LoadFromFile(inFileName) 
idDocument = QP.SelectedDocument() 
WScript.Echo("Load File: " & Ret) 

'-- Merge the letterhead to the end of the document 
Ret = QP.MergeDocument(idLetterHead) 
WScript.Echo("Merge: " & Ret) 

'-- Capture the letterhead page 
ltrHdID = QP.CapturePage(QP.PageCount()) 
WScript.Echo("Capture ID: " & ltrHdID) 

Call QP.SetOrigin(1) 

'-- Then we get the number of pages in the document 
pageCount = QP.PageCount() 
WScript.Echo("PageCount: " & pageCount) 

'-- Stamp the letterhead on each page of the document 
For page = 1 To pageCount 
    Call QP.SelectPage(page)
    Call doc.NormalizePage(0)
    WScript.Echo("Page: " & page & " Width: " & w & " Height: " & h) 
    Ret = QP.DrawCapturedPage(ltrHdID, 0, 0, w, h) 
    WScript.Echo("DrawCapturedPage: " & Ret) 
Next 

'-- Save the imposed file 

Call QP.SaveToFile(outFileName) 

Set QP = nothing 



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