PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Visual C++ 2008 Express Edition & DLL or source codes?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1047
Page 1 of 1

Author:  mONE [ Sun Feb 07, 2010 11:54 pm ]
Post subject:  Visual C++ 2008 Express Edition & DLL or source codes?

Hi, am new to programming, so please be patient :D

So. I obtained MS VC++ 2008 Express Edition, now I am confused as you show Hello World app in VB.NET... Do I have to use precompiled .dll from your site or can I somehow make use of source codes in VC++ although they r written in C#? (cuz of VB.NET example)

Thank you for your answer. N1 project btw.

EDIT: I am woring on C++ .NET app. I cannot manage to use the class/functions from within the dll :(( ......gooooooogling...gooooooogling...zzzzz ;) cu later

Author:  mONE [ Mon Feb 08, 2010 2:17 am ]
Post subject:  Re: Visual C++ 2008 Express Edition & DLL or source codes?

well..... :D

i ve done it myself :) i used dll.
the first dll ever in my life.. was yours :D
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... :D

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 :lol:
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 :D maybe someone will find it useful.
Have fun guys & GL in future ;)

Author:  Priyah [ Tue Jun 29, 2010 7:06 am ]
Post subject:  Re: Visual C++ 2008 Express Edition & DLL or source codes?

Hi,

I tried to convert add this code im my application.But i am getting this following error.

"fatal error C1021: invalid preprocessor command 'using'"

How to resolve this one?

Thanks,

Author:  DaleStan [ Tue Jun 29, 2010 1:28 pm ]
Post subject:  Re: Visual C++ 2008 Express Edition & DLL or source codes?

Are you compiling managed C++? AIUI, only managed C++ has the #using directive. Native C++ and C# do not.

Author:  roel1234 [ Mon Nov 19, 2012 7:25 am ]
Post subject:  Re: Visual C++ 2008 Express Edition & DLL or source codes?

Hi mONE,

I have perforemed you inputs at visual C++ 2005, but I am having this error though the compilation is successful.

"An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Windows.Forms.dll

Additional information: Could not load file or assembly 'PdfSharp, Version=1.31.1789.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb' or one of its dependencies. The system cannot find the file specified."

Do you have any suggestions?

Your response is highly appreciated.

Regards,
Roel

Author:  roel1234 [ Tue Nov 20, 2012 1:27 am ]
Post subject:  Re: Visual C++ 2008 Express Edition & DLL or source codes?

Hi Everyone.

Just figured is out.
You need to look at the properties of the project and add PDFSharp.dll to the list of resources by looking at the few tabs.

FYI and Regards,
Roel

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/