Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > Sample Code
  New Posts New Posts RSS Feed - Using C# and the DLL edition of Quick PDF Library
  FAQ FAQ  Forum Search   Register Register  Login Login

Using C# and the DLL edition of Quick PDF Library

 Post Reply Post Reply
Author
Message
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Topic: Using C# and the DLL edition of Quick PDF Library
    Posted: 15 Jun 09 at 10:27AM
This is a short demo of how to use the DLL edition of Quick PDF Library with C#.

// Add the namespaces (first you'll need to. You will need to add a reference to the
// C# import file for the DLL edition.

using System.IO;
using QuickPDFDLL0714;

// Put a button onto the form and add this code to the Click event:

       private void button1_Click(object sender, EventArgs e)
       {
           // Create an instance of the class and give it the path to the DLL
           PDFLibrary qp = new PDFLibrary("...path where the DLL is stored... \\QuickPDFDLL0714.dll");

           // Check if the DLL was loaded successfully
           if (qp.LibraryLoaded())
           {
               // Check the license key
               if (qp.UnlockKey(" ...license key here... ") == 1)
               {
// Draw some text on the PDF
                 qp.DrawText(100, 500, "Hello world from C#");

// Save the new document to disk
                 qp.SaveToFile("c:\\HelloCSharpDLLWorldWorld.pdf");
               }
           }
       }
Back to Top
vijayan View Drop Down
Beginner
Beginner


Joined: 27 Oct 09
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote vijayan Quote  Post ReplyReply Direct Link To This Post Posted: 27 Oct 09 at 5:51PM
Hi,
 
In the example, it says to add a reference to the DLL; however, within Visual Studio 2008 when I do this, I get the error:
 
"A reference to 'C:\Program Files\Quick PDF Library\DLl\QuickPDFDLL0716.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
 
How do I get around this?
 
Even so, in the example the path to the DLL seems to be required:
 
PDFLibrary qp = new PDFLibrary("...path where the DLL is stored... \\QuickPDFDLL0714.dll");
 
Is it possible to get a PDFLibrary instance without knowing the path to the DLL? (Assuming of course it is present in the BIN directory of the Windows or ASP.NET application, as normal with other DLL components.)
 
Thanks,
/vijayan
 
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 27 Oct 09 at 8:19PM
Hi!

It's possible to use a normal dll with C#, too...
But perhaps it's better if you try the activeX-version of the dll (don't forget the wrapper-file!).
The other thing: It's okay putting the dll into the system32-directory or into your app-directory and then it's not necessary to know the complete file-path.
It's not possible to register the dll 'cause there's no entry-point (that's normal for many dlls out there).

Cheers, Ingo

Here's the basically content of a form1.cs (from C# 3.5).
A "normal" dll was used...

using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;

namespace H_PDFtext
{
    public partial class Form1 : Form
    {

        [DllImport(@"your_dll.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "your_functionname")]
        public static extern UInt32 your_functionname(your_parameter_type your_parameter);

        [DllImport(@"your_dll.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "your_next_functionname")]
        public static extern IntPtr your_next_functionname(your_parameter_type your_parameter, ...);

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            nothing = 0;
        }

        private void button1_Click(object sender, EventArgs e)
        {

        // . . .
        
            textBox1.Text = Marshal.PtrToStringAnsi(your_next_functionname(your_parameter, ...));
        }

        private void button2_Click(object sender, EventArgs e)
        {

        // . . .
        
        }

        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Text = Convert.ToString(your_functionname(your_parameter));
        }
    }
}



Edited by Ingo - 27 Oct 09 at 8:46PM
Back to Top
mkinsel View Drop Down
Beginner
Beginner


Joined: 18 Nov 09
Location: Washington St.
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote mkinsel Quote  Post ReplyReply Direct Link To This Post Posted: 18 Nov 09 at 2:17AM
Can you use the same approach with VB 2005?  Can you show me a Visual Basic example?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store