Welcome Guest Search | Active Topics | Sign In | Register

How to use EO.Pdf in VC++ 2010 Options
eo_support
Posted: Sunday, February 6, 2011 3:57:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
EO.Pdf is a standard .NET class library, so it works with any .NET based language, including Visual C++. The following steps describe how to use EO.Pdf with VC++ 2010:

1. Make sure CLR is enabled on your project. To verify this, right click your project in the solution explorer, select "Properties", then select Configuration Properties -> General, make sure "Common Language Runtime Support" is set to "Common Language Runtime Support (/clr)";

2. Reference EO.Pdf in your project. Still in the project properties dialog, select Common Properties -> Framework and References, then click "Add New Reference...", click "Browse" tab to browse EO.Pdf.dll, then click "OK". Note if you do not see the "Browse" tab, then check step 1 to make sure CLR is enabled on your project;

3. Import namespace in your C++ file. To import a namespace, add "using namespace" directive to your code. For example, the following code imports "EO.Pdf" namespace:

Code:
using namespace EO::Pdf;


4. Use corresponding EO.Pdf objects. For example, the following code create a new PdfDocument object:

Code:
PdfDocument^ pDoc = gcnew PdfDocument();


The following is the full C++ source code to create an PDF file with a single word "Hello":

Code:
#include "stdafx.h"
using namespace EO::Pdf;
using namespace EO::Pdf::Acm;

int _tmain(int argc, _TCHAR* argv[])
{
    PdfDocument^ pDoc = gcnew PdfDocument();
    AcmText^ pText = gcnew AcmText("Hello!");
    AcmRender^ pRender = gcnew AcmRender(pDoc);
    pRender->Render(pText);
    pDoc->Save("c:\\test.pdf");
    return 0;
}

Hope this helps.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.