I am trialling VeryPDF Print SDK but am unable to get this working from a 64-bit application

Hi,

I am trialling VeryPDF Print SDK but am unable to get this working from a 64-bit application.

https://www.verypdf.com/app/pdf-print-cmd/index.html

Running a 32-bit application I am able to load the function directly from pdfprintsdk.dll and this works without issue:

[DllImport("pdfprintsdk.dll")]
public static extern int VeryPDF_PDFPrint(string CommandLine);

As per your documentation this DLL is 32-bit and to access it from a 64-bit application, I must use the interop DLL.

I have installed the COM interface by running "pdfprintcom.exe /regserver" from a elevated command prompt. I then created a x64 bit C# project that includes this interop. I can see "Interop.pdfprintcom" under Dependencies\COM of the project.

My code, which compiles without issue, to execute the print is as follows (this code is "using pdfprintcom;"):

var pdfPrint = new pdfprint();
var ret = pdfPrint.com_PDFPrint(COMMAND);

I have also ensured the following DLLs are present in the output directory of the application:

wget.dll
xpssdk.dll
cimage.dll
GdiPlus.dll
mscorlib.dll
pdfprintsdk.dll

When I run the application I get the following error on the call to new up the pdfprint interface:

System.BadImageFormatException: 'Retrieving the COM class factory for component with CLSID {20539EDE-6840-4AEC-859F-DA155CC7B8FB} failed due to the following error: 800700c1 is not a valid Win32 application. (0x800700C1).'

From researching online I have read a few articles from your site and can confirm I have followed the notes as per:

https://www.verypdf.com/wordpress/201306/how-to-call-pdfprintcom-exe-com-from-64bit-c-source-code-to-print-pdf-file-37200.html

Please let me know if you need any further information.

Kind regards,
Customer
----------------------------

image

When you call PDFPrint SDK from your 64bit application, please forget "pdfprintsdk.dll" library, please by following steps to integrate PDFPrint SDK into your 64bit application,

1. Please run following command line with administrator privilege to register pdfprintcom.exe into your system first,

pdfprintcom.exe /regserver

image

2. Please create a C# project, add a reference to "pdfprintcom" from this C# project, then you can use following C# code to call PDFPrint SDK function,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using pdfprintcom;

namespace WindowsFormsApplication1
{
     public partial class Form1 : Form
     {
         public Form1()
         {
             InitializeComponent();
         }

        private void button1_Click(object sender, EventArgs e)
         {
             pdfprintcom.pdfprint pdfPrintObj = new pdfprintcom.pdfprint();
             pdfPrintObj.com_PDFPrint("pdfprint -printer \"docPrint\" D:\\temp\\5.pdf");

         }
     }
}

3. OK, you should be able to print PDF files from your 64bit application now.

If you encounter any problem in above steps, please feel free to let us know, we are glad to assist you asap.

VeryPDF

✅ See Also:

System.BadImageFormatException encountered in Pdfprintsdk.dll
https://www.verypdf.com/wordpress/201310/system-badimageformatexception-encountered-in-pdfprintsdk-dll-38919.html

How to call pdfprintcom.exe COM from 64bit C# source code to print PDF file?
https://www.verypdf.com/wordpress/201306/how-to-call-pdfprintcom-exe-com-from-64bit-c-source-code-to-print-pdf-file-37200.html

How to call PDFPrint SDK from Windows 64bit (x64) system?
https://www.verypdf.com/wordpress/201301/how-to-call-pdfprint-sdk-from-windows-64bit-x64-system-34115.html

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!