logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Paul Rayman Posted: Monday, January 22, 2018 6:45:04 PM(UTC)
 
Guest Posted: Saturday, January 20, 2018 5:31:50 PM(UTC)
 
Hi
Trying to use pdfium to print a pdf document straight to printer from vb .net winforms project.
Deployment environment is four computers accessing a single network drive. Setup files are on the network drive, install the program from network drive onto each of the four workstations. Every aspect of the program works fine on deployment except printing pdf documents. Can generate the document and view or email it but cant print it without first displaying in default pdf viewer.

Downloaded Pdfium.Net.SDK and Pdfiumviewer from NuGet.
In the following code the first line PdfCommon.Initialize gives me error: Unable to load DLL 'pdfium.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

<code>
Try
PdfCommon.Initialize()
Dim doc As Patagames.Pdf.Net.PdfDocument = Patagames.Pdf.Net.PdfDocument.Load(strPDF)
Dim printDoc As New PdfPrintDocument(doc)
Dim PrintController As PrintController = New StandardPrintController()
printDoc.PrintController = PrintController
printDoc.Print()
Return True
Catch ex As Exception
MessageBox.Show(ex.Message, ex.GetType.ToString)
Return False
End Try
</code>

In my project folder (PPM) are subfolders x64 and x86 both of which contain a single file called pdfium.dll
In PPM\Debug\Bin are patagames and pdfiumviewer dlls as well as subfolders x64 and x86 each of which contain just pdfium.dll
On my development computer I can get it to print only if I include the path C:\...\Projects\PPM\PPM\x64\pdfium.dll in the initialise statement, obviously however the path on deployment will be different. If I leave the path out it doesn't work either on my development or deployment computers
My project has references to Patagames.pdf, Patagames.pdf.winforms, patagames.pdf.wpf, pdfiumviewer and pdffilewriter (all are set to copy local = true)
In Solution Explorer are subfolders x64 and x86 and the pdfium.dll in both those are set to Copy Always.
The class module containing this code has Imports System.Drawing.Printing, Imports System.IO, Imports Patagames.Pdf.Net, Imports Patagames.Pdf.Net.Controls.WinForms

Clearly I am doing something wrong as pdfium.dll is not being found on the deployment computers (or on the development computer unless I specify the path)

Ive been trying to get this to work for several weeks now without bothering you but now at wits end.
Grateful for any suggestions.