well.....
i ve done it myself
i used dll.
the first dll ever in my life.. was yours
ok so lets have a look what i ve done, maybe some newbies will find this useful if they re gonna use dll in
VC++ .NET 2008.
this is basically this vb code
http://www.pdfsharp.net/wiki/HelloWorld-sample-VB.ashx , rewritten with/without some odds to C++.NET. So beginners, this is one way how you can start:
0. Download PDFsharp-MigraDocFoundation-Assemblies-1_31.zip
1. put
PdfSharp.dll (from GDI+ subdirectory inside ZIP) where all yours project`s .cpp;.h;.resX files are. Note: I havent tried the WPF version since I have no clue what WPF is used for...
2. this is how the beginning of your
.h file should look like:
Code:
#pragma once
#using <PdfSharp.dll>
#include "init.h"
#include "proj.h"
#include "filetext.h"
namespace myProject {
using namespace PdfSharp;
using namespace PdfSharp::Drawing;
using namespace PdfSharp::Pdf;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
interesting lines are where i added
<PdfSharp.dll> and later on, those
using namespace PdfSharp related lines.
3. Create a function, name it whatever u want and you can have fun using the features of PDFsharp
Code:
// Create a new PDF document
PdfDocument^ document = gcnew PdfDocument();
document->Info->Title = "Created with PDFsharp";
// Create an empty page
PdfPage^ page = document->AddPage();
// Get an XGraphics object for drawing
XGraphics^ gfx = XGraphics::FromPdfPage(page);
// Create a font
XFont^ font = gcnew XFont("Verdana", 20, XFontStyle::BoldItalic);
// Draw the text
gfx->DrawString("Hello, World!", font, XBrushes::Black, XRect::FromLTRB(0, 0, page->Width, page->Height),
XStringFormats::Center);
// Save the document...
String^ filename = "HelloWorld.pdf";
document->Save(filename);
I hope you enjoyed this piece of blablablabla
maybe someone will find it useful.
Have fun guys & GL in future