Dev Direct Solution Center

For more information and to buy this product...

How to Create a PDF document

  For a copy of the sample project please click here to download and install the product evaluation.

Introduction

Our Amyuni PDF Creator products (available as an ActiveX control, a .NET component or a .NET library) will allow a developer to add or edit text to existing PDF documents or create a new PDF document by placing different PDF objects on a blank page.

Detail

The developer can access or create a number of different objects on a PDF document using different methods exposed by our products. Our product will also allow the developer to access, modify and exit a number of different attributes for each PDF object.

In the C# code snippet below, we are creating a new object and placing it on an empty PDF document.
private void btnCreateText_Click(object sender, System.EventArgs e)
{
	//initailize library
	//This should be done once
	acPDFCreatorLib.Initialize ();

	//set license key 
	acPDFCreatorLib.SetLicenseKey ( "...","...." );

	//need to create a document object
	using ( Amyuni.PDFCreator.IacDocument   doc = new Amyuni.PDFCreator.IacDocument ( null ) )
	{

		//put component in design mode
		doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateDesign;

		//create object on Page 1
		using (Amyuni.PDFCreator.IacObject oText = doc.GetPage( 1 ).CreateObject( Amyuni.PDFCreator.IacObjectType.acObjectTypeText, "acText" ))
		{
			//position picture and and properties
            oText.AttributeByName("left").Value = 200;
            oText.AttributeByName("Top").Value = 600;
            oText.AttributeByName("Right").Value = 2000;
            oText.AttributeByName("Bottom").Value = 800;
            oText.AttributeByName("Text").Value = "Hello World";

		}

        //need to open a file stream to save new PDF document
        string strFilePathAndName = @"c:\temp\temp.pdf";
        System.IO.FileStream fs = new System.IO.FileStream(strFilePathAndName, FileMode.Create, FileAccess.Write, FileShare.Write);
		doc.Save ( fs, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveAll ); 
	}
	//end and cleanup
	//this should only be done once
	acPDFCreatorLib.Terminate (); 

}
Visit Amyuni Technologies Inc for more information and more samples.