Beginning with PDF Converter

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
brightlogic
Posts: 1
Joined: Thu Mar 05 2009

Beginning with PDF Converter

Post by brightlogic »

Hi,

I am new to AmyUni and am trying to get started with the PDF converter. I'm following the Common Driver Interface 300 PDF however I have a few questions. I apologise in advance, I know they will probably be trivial questions but I would appreciate any help.

I'm writing a project in vb.net using visual studio 2008.

I've managed to get the install working correctly however it's the converting code that I'm having an issue with. I've added the CDIntfNet300.dll as a reference in my project. I've also added the CdIntf300.vb into my project.

Code:

Imports CDIntfNet.CDintfDll
Imports CDIntf.CDIntfControl
Imports AmyUniPDF

.....

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
'* initalise printer
DriverInit("Amyuni PDF Converter")

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

In the PDF documentation it says to run the SetDefaultFileName and SetFileNameOptions, I can't seem to find these functions anywhere. I can find the DefaultFileName and FileNameOptions properties in CDIntf.CDIntfControl, however I don't know what to set the FileNameOptions property to as it wants an integer. When i looko at the sample in the documentation it says "SetFileNameOptions( NoPrompt + UseFileName + … )."

Am I missing something? Where should I find these?

Another quick question to print do I use the DocPrint function? As all the documentation says is "print to the "My Company Printer" as you would do when printing to any other printer"

Many thanks in advance for any help.

James
David
Amyuni Team
Posts: 89
Joined: Mon Dec 18 2006

Re: Beginning with PDF Converter

Post by David »

Hello

Below is a code snippet that demonstrates how to set the outputfilename using the .NET wrapper of cdintf()

CDIntf.CDIntfControl PDF = new CDIntf.CDIntfControl ();
PDF.DriverInit ( PDFprinter );
PDF.SetDefaultPrinter ();

//Set output directory and output filename
PDF.DefaultDirectory = Application.StartupPath.ToString ();
PDF.DefaultFileName = Application.StartupPath.ToString () + "\\myfile.pdf"

//Set printer settings
PDF.SetSimPostscript ( false );
PDF.VerticalMargin = 0;
PDF.HorizontalMargin = 0;

PDF.SetDefaultConfig (); //need to call this to apply changes

//Set printing options
PDF.FileNameOptions = (int) sNoPrompt + sUseFileName;

//need to call the enable printer each time
PDF.EnablePrinter ( strLicenseTo, strActivationCode );

//print someting
printDocument1.Print();

//Reset everything
PDF.FileNameOptions = 0;



To print a pdf document to a printer you can use the document object as follows:

CDIntf.PDFDocumentControl PDFdoc = new CDIntf.PDFDocumentControl();
//open pdf file
PDFdoc.Open("c:\\temp\\myfile.pdf","");

//print document
//PDFdoc.Print(string PrinterName, int StartPage,int EndPage,int Copies)
PDFdoc.Print("HP LaserJet", 1, 5,1);


Hope that helps?
David
Amyuni Custom Development
Do you need a specific PDF solution? Are you looking for expertise that will enable you to start or complete a PDF integration project?
http://www.amyuni.com/en/company/services.php
Post Reply