Solved

Using ABCpdf 6.1 .NET component from PHP - How to instantiate

Posted on 2008-10-01
2
1,875 Views
Last Modified: 2012-05-05
I downloaded ABCpdf 6.1 .NET from Websupergoo.com - to use from a PHP script, to create PDF's from Word documents on the fly - very cool indeed.

Only thing is, I want to use PHP (of course) instead of .NET

As far as I can read here, http://dk.php.net/manual/en/class.dotnet.php, that should not be a problem.

Only thing is, that I never tried to use .NET components before, only COM objects.

So my question is - can someone please help me fill in the blanks :
$obj = new DOTNET("assembly", "classname")

Attached are some example code from ABCpdf...

Thanks for your help on this matter :-)

// ===========================================================================
//	©2006 WebSupergoo. All rights reserved.
// ===========================================================================
 
using System;
using System.IO;
using WebSupergoo.ABCpdf6;
using WebSupergoo.ABCpdf6.Objects;
 
 
namespace TaggedPDF {
	/// <summary>
	/// Startup class for calling tagged pdf tests
	/// Tests include xml converter example and hardcoded tagged 
	/// pdf creation.
	/// - Simple example shows how to generate tagged pdf files using ABCPdf
	/// - Xml converter transforms simple html-like xml format to tagged pdf. 
	/// </summary>
	class TaggedPDFApp {
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args) {
			string theBase = Directory.GetParent( Directory.GetCurrentDirectory() ).Parent.FullName;
			string theIn = theBase + @"\Input\";
			string theOut = theBase + @"\Output\";
 
			// simple example first
			SimpleExample(theIn, theOut);
	
			// then xml based example
			string[] theFiles = Directory.GetFiles(theIn);
			foreach (string inFile in theFiles) {
				string outFile = theOut + Path.GetFileNameWithoutExtension(inFile) + ".pdf";
				XmlConverter converter = new XmlConverter();
				converter.Convert(inFile, outFile);
			}
		}
 
		/// <summary>
		/// Example of a dynamically created tagged pdf document  
		/// </summary>
		static public void SimpleExample(string inputDirectory, string outputDirectory) {
			// Create new doc and tagged content for it
			Doc theDoc = new Doc();
			TaggedContent theContent = new TaggedContent(theDoc);
 
			//Add a container tag
			theContent.BeginTaggedItem("Container");
 
			//Add a paragraph of text
			theDoc.Rect.Inset(40, 40);
			theDoc.FontSize = 20;
			theContent.AddTaggedText("P", "Tagged PDF (PDF 1.4) is a stylized use of PDF that builds on the logical structure framework described in Section 10.6, Logical Structure. It defines a set of standard structure types and attributes that allow page content (text, graphics, andimages) to be extracted and reused for other purposes.");
 
			//Add image
			theDoc.Rect.String = "300 100 300 100";
			theContent.AddTaggedImage("Image", inputDirectory + @"images\aster1.jpg");
 
			//Add some rotated text marked with header tag (H1)
			theDoc.Rect.String = theDoc.MediaBox.String;
			theDoc.Rect.Magnify(0.5, 0.5);
			theDoc.FontSize = 30;
			theDoc.Transform.Rotate(45, theDoc.Pos.X, theDoc.Pos.Y);
			theContent.AddTaggedText("H1", "Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae, aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.");
			theDoc.Transform.Reset();
 
			//Close container
			theContent.EndTaggedItem();
 
			// Dump tagged content and save pdf file
			theContent.AddToDoc();
			theDoc.Save(outputDirectory + "Simple.pdf");
		}
	}
}

Open in new window

0
Comment
Question by:trg_dk
  • 2
2 Comments
 
LVL 2

Author Comment

by:trg_dk
ID: 22621861
No takers on this one ?? Really need your help to make this work :-)

Thanks,
Mark
0
 
LVL 2

Accepted Solution

by:
trg_dk earned 0 total points
ID: 22656948
OK Guess I'll be closing this one then :-(
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php convert date format 3 21
php simple error message 4 23
How can I implement a "Select All" with this configuration...? 6 41
How can I make this form submit to itself? 10 27
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question