I start again with a new one.
Dowloaded the example for DLL from the site.
Added the 2 dll file's to the dir and import the DebenuPDFLibraryDLL0915.vb from to the project in vb2010
With add new item , the to the dir imports , vb.net.
Ok no more errors .
so it returns 0 en the programm start but won't work but this step i can't get it to work
Imports visual_basic_dll_sample.DebenuPDFLibraryDLL0915 ' The DebenuPDFLibraryDLL0915.vb import file must be added to the project
Public Class Form1
Dim QP As PDFLibrary
Dim LicenseKey = "j69ke7sf8uz6f83co7sk68j4y" ' Insert your trial or commercial license key here
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
QP = New PDFLibrary("DebenuPDFLibraryDLL0915.dll")
If QP.UnlockKey(LicenseKey) = 0 Then
MsgBox("- Invalid license key: Have you included your license key? -")
QP = Nothing
End If
End Sub
Private Sub btnDrawText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDrawText.Click
' This function draws text onto a document
' Setup the parameters
Dim fileName As String = "..\..\Test Files\drawText.pdf"
' Set origin co-ordinates to top left of page
QP.SetOrigin(1)
' Call the DrawText function
QP.DrawText(100, 100, "Hello world from Visual Basic .NET and the DLL edition of Quick PDF Library")
' Save the changes to the document on the local disk (in the debug folder)
QP.SaveToFile(fileName)
' Open PDF automatically
System.Diagnostics.Process.Start(fileName)
End Sub
Private Sub btnDrawHTMLText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDrawHTMLText.Click
' This function draws text using HTML tags onto a document
' Setup the parameters
Dim fileName As String = "..\..\Test Files\drawHTMLText.pdf"
' Create a new document in memory with one blank page
Dim docID As Integer = QP.NewDocument()
' Call the DrawHTMLText function and specify the necessary settings.
QP.DrawHTMLText(40, 760, 200, "Here is some <b>bold</b>, <i>italic</i> and <u>underlined</u> text")
QP.DrawHTMLText(40, 730, 200, "<ul><li>This</li><li>is</li><li>a</li><li>bullet</li><li>list</li></ul>")
' Save the changes to the document on the local disk (in the debug folder)
QP.SaveToFile(fileName)
' Remove document from memory
QP.RemoveDocument(docID)
' Open PDF automatically
System.Diagnostics.Process.Start(fileName)
End Sub
Private Sub btnGetPageText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetPageText.Click
' This function extracts text from a page in a document
' Setup the parameters
Dim fileName As String = "C:\VT\Pomp11.pdf"
' Create a new document in memory with one blank page
Dim docID As Integer = QP.NewDocument()
' Load the document that you want to extract text from into memory
QP.LoadFromFile(fileName, "")
' Select the page that you want to extract text from (first page in
' a document is always 1)
QP.SelectPage(1)
' Specify the variable that the text should be added to and call
' the GetPageText function (with the appropriate option selected)
Dim pageText As String = QP.GetPageText(1)
' Display the extracted text in a message box
MessageBox.Show(pageText)
' Remove document from memory
QP.RemoveDocument(docID)
End Sub
Private Sub btnExtractPages_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExtractPages.Click
' This function extracts pages from a document
' Setup the parameters
Dim fileName As String = "C:\VT\Pomp11.pdf.pdf"
Dim StartPage As Integer = 1
Dim PageCount As Integer = 1
Dim OutputFile As String = "C:\VT\Pomp111.pdf"
' Load the document that you want to extract text from into memory
Dim docID As Integer = QP.LoadFromFile(fileName, "")
' The ExtractPages requires two paramters. The first paramter
' tells the library where to start extracting pages from and
' the second paramter tells the library how many pages from the
' starting point should be extracted.
Dim extractPageSuccess As Integer = QP.ExtractPages(StartPage, PageCount)
' You can find out if the extraction process was successfull by
' checking the returned value of the ExtractPages function. If
' it returns 0 then it means the page(s) could not be extracted,
' other wise it will return a new document ID.
If extractPageSuccess = 0 Then
MessageBox.Show("Page(s) could not be extracted.")
Else
MessageBox.Show("Page(s) successfully extracted.")
' First check to see if the extraction process worked
' and if it did, then save the results to a new file.
QP.SaveToFile(OutputFile)
System.Diagnostics.Process.Start(OutputFile)
End If
' Remove document from memory
QP.RemoveDocument(docID)
End Sub
Private Sub btnPrintDocument_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintDocument.Click
' This function prints a document
' Setup general parameters
Dim fileName As String = "C:\VT\Pomp11.pdf.pdf"
' Load the document that you want to print into memory
Dim docID As Integer = QP.LoadFromFile(fileName, "")
' Set the paramters for the PrintDocument function
Dim PrinterName As String = QP.GetDefaultPrinterName()
Dim StartPage As Integer = 1
' Set first page number
Dim EndPage As Integer = QP.PageCount()
' Set last page number
' Set the paramters for the PrintOptions function
Dim PageScaling As Integer = 0
Dim AutoRotateCenter As Integer = 0
Dim Title As String = fileName
' Assign the options for printing to an int variable
Dim Options As Integer = QP.PrintOptions(PageScaling, AutoRotateCenter, Title)
' Print the document with the required paramters and options specified
QP.PrintDocument(PrinterName, StartPage, EndPage, Options)
' Remove document from memory
QP.RemoveDocument(docID)
End Sub
Private Sub btnGetPrinterNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetPrinterNames.Click
' This function retrieves a list of all the local printers
' Setup general parameters
' Assign all of the printers to a string variable
Dim printers As String = QP.GetPrinterNames()
' Display the printer names in a message box
MessageBox.Show(printers)
End Sub
Private Sub btnDARenderPageToString_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDARenderPageToVariant.Click
' This function renders a page in a PDF to a variant which can be used
' to display the PDF in a window
' Setup general parameters
Dim fileName As String = "C:\VT\Pomp11.pdf"
Dim password As String = ""
Dim pageNumber As Integer = 1
' Open the file, get a file handle
Dim fileHandle As Integer = QP.DAOpenFile(fileName, password)
' Get a reference to the first page
Dim pageReference As Integer = QP.DAFindPage(fileHandle, pageNumber)
' Height and width in points (1/72 inch)
Dim pageHeight As Double = QP.DAGetPageHeight(fileHandle, pageReference)
Dim pageWidth As Double = QP.DAGetPageWidth(fileHandle, pageReference)
' Work out the smallest DPI needed to fit the entire
' page into the PictureBox
Dim horizontalDPI As Integer = Convert.ToInt32((PictureBox1.Width / pageHeight) * 72)
Dim verticalDPI As Integer = Convert.ToInt32((PictureBox1.Height / pageHeight) * 72)
Dim smallestDPI As Integer
If horizontalDPI < verticalDPI Then
smallestDPI = horizontalDPI
Else
smallestDPI = verticalDPI
End If
' Render the page to BMP format into the byte array
Dim bitmapData = QP.DARenderPageToString(fileHandle, pageReference, 0, smallestDPI)
' Put the byte array into a stream
Dim stream As New System.IO.MemoryStream(bitmapData)
' Create a new Image from the stream
PictureBox1.Image = Image.FromStream(stream)
' Close the file
QP.DACloseFile(fileHandle)
End Sub
Private Sub btnNewOptionalContentGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewOptionalContentGroup.Click
' This function creates a new Optional Content Group (known as a Layer in Acrobat)
' Setup general parameters
Dim OutputFileName As String = "C:\VT\Pomp11.pdf"
' Load the document that you want to print into memory
Dim docID As Integer = QP.NewDocument()
' Create the new Optional Content Group and assign it a name
Dim OCG1 As Integer = QP.NewOptionalContentGroup("OCG 1")
Dim ContentStream As Integer = QP.NewContentStream()
QP.SelectContentStream(ContentStream)
QP.DrawText(100, 750, "This text belongs to OCG1")
QP.SetContentStreamOptional(OCG1)
QP.SetOptionalContentGroupVisible(OCG1, 1)
' Save the new OCG to the specified file on the local disk
QP.SaveToFile(OutputFileName)
' Remove document from memory
QP.RemoveDocument(docID)
System.Diagnostics.Process.Start(OutputFileName)
End Sub
Private Sub btnOptionalContentGroupCount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOptionalContentGroupCount.Click
' This function counts the number of Optional Content Groups (aka Layers) in a document
' Setup general parameters
Dim FileName As String = "C:\VT\Pomp11.pdf"
' Load the document that you want to print into memory
' and assign the Document ID to an int variable
Dim docID As Integer = QP.LoadFromFile(FileName, "")
' Select the document using the Document ID
QP.SelectDocument(docID)
' Initiate the OptionalContentGroupCount function
' and assign the returned value to an int variable
Dim OCGs As Integer = QP.OptionalContentGroupCount()
' Convert the int value to a string
Dim CountOCGs As String = Convert.ToString(OCGs)
' Display the number of OCGs from the file in the message box
MessageBox.Show(CountOCGs)
' Remove document from memory
QP.RemoveDocument(docID)
End Sub
Private Sub btnNewOutline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewOutline.Click
' This function creates a new outline (aka bookmark) in a document
' Setup general parameters
Dim InputFileName As String = "C:\VT\Pomp11.pdf"
Dim OutputFileName As String = "..\..\Test Files\NewOutline.pdf"
' Load the document into memory
Dim docID As Integer = QP.LoadFromFile(InputFileName, "")
' Get the page height value for the position paramter in the NewOutline function
Dim pageHeight As Double = QP.PageHeight()
' Initiate the NewOutline function and set paramters
Dim nOutline As Integer = QP.NewOutline(0, "New Bookmark", 1, pageHeight)
' Check the value returned from the NewOutline function to see
' if it was successful.
If nOutline = 0 Then
MessageBox.Show("Sorry, the bookmark could not be added.")
Else
' Save the new outline to the document.
QP.SaveToFile(OutputFileName)
System.Diagnostics.Process.Start(OutputFileName)
End If
' Remove document from memory
QP.RemoveDocument(docID)
End Sub
Private Sub btnOutlineCount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOutlineCount.Click
' This function counts the number of outlines (aka bookmarks) in a document
' Setup general parameters
Dim FileName As String = "C:\VT\Pomp11.pdf"
' Load the document into memory
Dim docID As Integer = QP.LoadFromFile(FileName, "")
QP.SelectDocument(docID)
Dim numberOfOutlines As Integer = QP.OutlineCount()
Dim Outlines As String = Convert.ToString(numberOfOutlines)
MessageBox.Show(Outlines)
' Remove document from memory
QP.RemoveDocument(docID)
End Sub
Private Sub btnMergeDocument_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMergeDocument.Click
' This function merges two documents together
' Setup general parameters
Dim firstDoc As String = "..\..\Test Files\sample1.pdf"
Dim secondDoc As String = "..\..\Test Files\sample2.pdf"
Dim DestFileName As String = "..\..\Test Files\merged_samples.pdf"
' Load the document into memory
QP.LoadFromFile(firstDoc, "")
Dim MainDoc As Integer = QP.SelectedDocument()
QP.LoadFromFile(secondDoc, "")
Dim Append As Integer = QP.SelectedDocument()
QP.SelectDocument(MainDoc)
QP.MergeDocument(Append)
QP.SaveToFile(DestFileName)
System.Diagnostics.Process.Start(DestFileName)
' Remove document from memory
QP.RemoveDocument(MainDoc)
End Sub
Private Sub btnMergeFileList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMergeFileList.Click
' This function merges a list of documents together
' Setup general parameters
Dim ListName As String = "..\..\Test Files\Sample"
Dim firstFile As String = "..\..\Test Files\sample1.pdf"
Dim secondFile As String = "..\..\Test Files\sample2.pdf"
Dim OutputFile As String = "..\..\Test Files\MergeFileListSample.pdf"
' Add the first file to the file list
QP.AddToFileList(ListName, firstFile)
' Add the second file to the file list
QP.AddToFileList(ListName, secondFile)
' Merge all files in the file list and output a new file
QP.MergeFileList(ListName, OutputFile)
System.Diagnostics.Process.Start(OutputFile)
End Sub
Private Sub btnGetInformation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetInformation.Click
' This function retrieves document information
' Setup general parameters
Dim FileName As String = "C:\VT\Pomp11.pdf"
' Load and select document
Dim DocumentID As Integer = QP.LoadFromFile(FileName, "")
QP.SelectDocument(DocumentID)
' Retrieve information from document
Dim PDFversion As String = QP.GetInformation(0)
Dim Author As String = QP.GetInformation(1)
Dim Title As String = QP.GetInformation(2)
' Display retrieved information
Dim infoArray As String() = {PDFversion, Author, Title}
For Each info As String In infoArray
MessageBox.Show(info)
Next
End Sub
Private Sub btnFindImages_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindImages.Click
' This function counts the number of images in a document
' Setup general parameters
Dim FileName As String = "..\..\Test Files\sample3.pdf"
' Load and select document
Dim DocumentID As Integer = QP.LoadFromFile(FileName, "")
QP.SelectDocument(DocumentID)
' Find all images in selected document
Dim images As Integer = QP.FindImages()
' Show number of images found in documents
Dim numberOfImages As String = Convert.ToString(images)
MessageBox.Show(numberOfImages)
' Remove the document from memory
QP.RemoveDocument(DocumentID)
End Sub
End Class