PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Jul 09, 2024 10:23 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Feb 07, 2010 11:54 pm 
Offline

Joined: Sun Feb 07, 2010 11:49 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 08, 2010 2:17 am 
Offline

Joined: Sun Feb 07, 2010 11:49 pm
Posts: 2
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 ;)


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 29, 2010 7:06 am 
Offline

Joined: Tue Jun 29, 2010 6:48 am
Posts: 1
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,


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 29, 2010 1:28 pm 
Offline

Joined: Mon Jan 04, 2010 2:44 pm
Posts: 23
Are you compiling managed C++? AIUI, only managed C++ has the #using directive. Native C++ and C# do not.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 19, 2012 7:25 am 
Offline

Joined: Mon Nov 19, 2012 7:14 am
Posts: 3
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


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 20, 2012 1:27 am 
Offline

Joined: Mon Nov 19, 2012 7:14 am
Posts: 3
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group