Page Headers / Footers in Converter / Creator

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
jburbine
Posts: 2
Joined: Mon May 24 2004

Page Headers / Footers in Converter / Creator

Post by jburbine »

I'm trying to get some information on your Converter / Creator development products and I've been contacting your Canadian office with out getting thru to speak to a real person.
(How can I speak to a live person to get some answers to my questions?)

Does anyone know the answer to the following questions:

1. In Converter using Visual Basic 6.0 do I have the ability to add header and footer information when converting from Word documents, Excel documents, as well as Powerpoint documents(as well as jpegs, tiffs and bmps)? Do I need Creator to change the document in any way shape or form? I also need the ability to add copyright information to the bottom of each page as well as control the page number and "title" information of the converted document.

2. In Converter (again using Visual Basic 6.0) do I have the ability to change the orientation of the page during the conversion? I need the ability to flip all landscape documents 90 degrees counterclock wise in the final version of our PDF document.

3. Where Can I find an example of converting a Word, Excel or Powerpoint (again as well as jpeg, tiff and bmp) documents into PDF using Visual Basic 6.0. I've looked through the Technical notes and none of them seem to apply to using Visual Basic as a conversion host without a background database application (we handle the database piece of our application with Crystal reports). We need to convert Word, Excel, Powerpoint as well as jpeg, tiff, bmp files into PDF format and merge all the PDF documents into a single PDF document for delivery to our clients.
We need to retain the ability to reference the converted "attachments" in our table-of-contents, as well as in each section of the final PDF document/Report.

4. If we purchase the developers license of the product, is that all we need to distribute our Visual Basic 6.0 application with the ability to create/convert PDF fileds by our in-house users. We are looking at distributing our application to 500+ users worldwide and was wondering what impact that would have on licensing?

Any help would be greatly appreciated.

Jeff Burbine
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello Jeff,

You can talk to our technical support representatives from 9 am to 6 pm by calling any of our contact information http://www.amyuni.com/en/contact/index.html

You may also reach our technical support department by sending an e-mail to support@amyuni.com

Here are the replies to your questions:

1 - The PDF Converter is a printer driver, it enables you to get pdf files by printing your documents to that printer. It will not allow you to add header and footer to the files while converting them. You may however prepare a separate pdf file containing the header and footer information than merge it to the pdf file generated from the Word, Excel,... documents to get the final output.

You can use the PDF Converter programatically through CDIntfEx that provides a DLL and an ActiveX for developpers to interface with the printer, change its settings and process the pdf files.

The PDF Creator is a pdf viewer and editor, it enables you to make changes to the pdf file, add objects to it (text object, picture, table, fields,...), change it from Portrait to Landscape, ect... Yes you need the PDF Creator to make changes to the pdf file after it is generated, specially if these changes are related to the file content.

Concerning the page number, you can get the number of pages in a pdf file using the Document Interface of CDIntf:

Code: Select all

nbOfpages = (pdfdoc.PageCount)
You may then add page numbers using either the PDF Creator or by creating a blank pdf file containing the page numbers and merging it to the generated pdf file.

Concerning the document 'Title', you can set it using the Document interface of CDIntf too:

Code: Select all

pdfdoc.Title = "My Title"

For the copyright, you can add it in the same way as the page numbers, by either using the PDF Creator (open the pdf file, add a text to it containing the copyright and save it) this is done programatically without user interface or by having the copyright on a separate file and merging it to your pdf.

2 - You can change the orientation of the page during conversion by setting the page setup of the printer to landscape or protrait, than can be done programatically by calling:

Code: Select all

cdi.Orientation = 1     '1 for portrait, 2 for landscape
You can rotate the pages counter clockwise after the pdf file is generated by using the Document interface of CDIntfEx:

Code: Select all

pdfdoc.Rotate = -90
3 - In our Technical Notes page, the closer sample to VB is the Access one, as the code is in VBA. You may check the Access technical note for reference.

I will include here a VB sample that uses the ActiveX interface of CDIntfEx to convert a Word document to pdf than convert and Excel document and append them together. Before using the ActiveX you need to add CDIntfEx (Common Driver Interface) as a Reference to your project.

Code: Select all

' Declaration part this could be included in a module or in the General part of your code

' This is the printer name as installed by default
Const PrinterName As String = "Amyuni PDF Converter"
' LicenseTo and ActivationCode need to be replaced by the ones you received when downloading the product
Const LicenseTo As String = "Amyuni Technologies"
Const ActivationCode As String = "07EFE68713E9D19D175B7293BA5"

'Create an instance of the Excel application and an Excel Workbook.
Dim xlApp As New Excel.Application
Dim wkBook As Excel.Workbook

'Create an instance of the Word application
Dim wordapp As New Word.Application
Dim worddoc As Word.Document

'Declare a new CDintfEx object
Public pdf As New CDIntfEx.CDIntfEx

------- ----- ------ ------ -----  ------  ------ ----- ------- -----

'Initializing the PDF Priter
pdf.DriverInit PrinterName

'Saving the output file using a given file name, here it is "Test.pdf"
pdf.DefaultFileName = "c:\Tmp\Test.pdf"
pdf.FileNameOptionsEx = NoPrompt + UseFileName  ' = 1 + 2


'Change the printer settings if needed
    pdf.Resolution = 150
    pdf.PaperSize = 9
    pdf.Orientation = 1
    pdf.SetDefaultConfig
    
    
'Open the Word document
    Set worddoc = wordapp.Documents.Open("C:\Temp\Test.doc", , , , , , , , , , , True)
    
'Enable the Printer
pdf.EnablePrinter LicenseTo, ActivationCode
     
'Print the first Word document
    worddoc.PrintOut ActivePrinter = PrinterName

'Close and Quit Word
worddoc.Close
wordapp.Quit
Set worddoc = Nothing
Set wordapp = Nothing

You can similarly open all the applications and print each document to pdf than Append them using the Append function of the Document interface.

Another option would be to use the BatchConvert function of CDintfEx to convert all the files in one directory to pdf and you can choose to save the pdf files individually or all concatenated in one PDF.

Code: Select all

pdf.FileNameOptionsEx = NoPrompt + UseFileName + Concatenate
pdf.DefaultFileName = "c:\Temp\BatchConvert.pdf"
pdf.BatchConvert("c:\Temp\MyFiles\*.*")

I didn't get what you mean by:
We need to retain the ability to reference the converted "attachments" in our table-of-contents, as well as in each section of the final PDF document/Report.
But you may add bookmarks to the pdf file after or while generating it so you can keep trak of each section.

4 - If you have an application and you need to enable your users to use the PDF Converter only from inside your application, the Developer version of the PDF Converter and / or the PDF Creator is enought, it will enables you to distribute the needed files and dlls royalty free with your application to your registred users who alreayd bought your product.
For more information about licenses please feel free to check with our Sales Department sales@amyuni.com.

Hope this helps 8)
jburbine
Posts: 2
Joined: Mon May 24 2004

Post by jburbine »

Joan,

Thank you for the VERY DETAILED response with the included sample code(YOU ROCK!...AGAIN MANY THANKS!)

FYI....Concerning "We need to retain the ability to reference the converted "attachments" in our table-of-contents, as well as in each section of the final PDF document/report". By being able to capture the page information of the PDF document thru the "PageCount" object we will probally be able to meet that need of retaining our "references". The ability to dynamically create "copyright" information and/or add header and footer information will solve our remainting problems. It appears that your product could be the total solution to our needs!

Again thanks for the quick response.

Jeff Burbine / Siemens Westinghouse Power Corporation
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hi Jeff,

I am glad this helped :)

If you generate each pdf file containing some bookmarks and then you Append these files together, the bookmarks will stay there.

The PageCount() will return the number of pages in a pdf document, if you need to get information such as when a page strats print, when a document ends, ect... you may use the broadcast message events, to capture messages generated by the driver while printing so you can add bookmarks when a page starts printing by example.

You can find more information about this issue in the Developers' manual "Common Driver Interface 210.pdf" you received with the evaluation version of the PDF Converter.

Adding copyright info and header and footer info can be done by merging a pdf file containing this info to the main pdf file, or by opening the pdf file in the PDF Creator and add this info to it. In both cases this would be automated. If the header and / or footer info is not always the same and can be changed, it would be better to use the PDF Creator.

Please note that the demo versions available on our site are full demos, you can use them to start developping your solution and see how everything works.

If you got any technical question while evaluating our product you can send a request to support@amyuni.com

Have a nice day !
Post Reply