I was very enthusiastic about your pdf printing sdk and If I can get the demo to print I am certain we will be making a purchase, However, your demo does not seem to work. I get no errors but nothing is ever sent to the printer. I've tried using the printer name that we use, but it just does not print at all.
The code seems straightforward enough. Do I need an actual license key to work with the demo? Other than pathing to the dll and the printer name I have changed nothing in your code example. However neither this code nor your compiled applications will print. The documentation with the demo is pretty skimpy and insufficient for me to be able to figure out what is going on, I am hoping the documentaiton in your licensed version is more comprehensive.
The code I've used is below, I get the same result with this that I do when I run your compiled apps. Always a return code of -4. Nothing more and nothing prints. I really want to use your solution if it can be made to actually work. Please help so I can present this to my superiors as a viable solution to our pdf printing requirements.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private static string LicenseKey = null;
private static string PrintCommandTemplate = "pdfprint -$ \"[LicenseKey]\" -printer \"<PrinterName>\" \"<DocFullPath>\"";
public Form1()
{
InitializeComponent();
}
[DllImport("c:\\pdfprint_sdk\\bin\\pdfprintsdk.dll")]
public static extern int VeryPDF_PDFPrint(string CommandLine);
public static long PrintDoc(string FullDocumentName, string PrinterName)
{
string PrintCommand = PrintCommandTemplate;
if (LicenseKey != null)
PrintCommand = PrintCommand.Replace("[LicenseKey]", LicenseKey);
else
PrintCommand = PrintCommand.Replace("[LicenseKey]", "XXXXXXXXXXXXXXXX");
PrintCommand = PrintCommand.Replace("<PrinterName>", PrinterName).Replace("<DocFullPath>", FullDocumentName);
MessageBox.Show(PrintCommand);
return VeryPDF_PDFPrint(PrintCommand);
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
string strPDFFile = (appPath + "\\readme.pdf");
//long nRet = PrintDoc(strPDFFile, "docPrint");
long nRet = PrintDoc(strPDFFile, "E1BO-XWC5687");
MessageBox.Show(nRet.ToString());
}
}
}
==========================================================
Please refer to following return codes,
int WINAPI VeryPDF_PDFPrint(LPCTSTR lpCommand)
Return values:
0: Print PDF file successfully.
-10: PDFPrint Library is damaged.
-11: Something is wrong in the command line options.
-101: Can't start "spooler" service, please start "spooler" service from Service Manager by manual.
-4: Can't locate specify printer in this computer.
-12: Can't open specify printer.
-13: Something is wrong when set options to printer.
-5: No input PDF file for printing.
9: Password Required to open this PDF file.
Other values: Something is wrong during render PDF file.
"-4" is "Can't locate specify printer in this computer.", just for checking, do you have full control permission to "E1BO-XWC5687" printer in your system?
Also, we suggest you may download PDFPrint Command Line product from our website to try,
https://www.verypdf.com/pdfprint/index.html#dl
you can add -debug parameter to print the detailed log message, for example,
pdfprint.exe -debug -printer "E1BO-XWC5687" C:\test.pdf