Have PDF Convert 2.1 and it is working fine from within our applications capturing printed output we generate. One option we have is to capture print output from other applications.
Have a little standalone VB exe (some of the code is below).
The user clicks Ready when ready to capture the other jobs output, then
clicks Done when printing is completed.
Any app I test (Notepad, WORD, even Print Test Page from the PDF Printer Driver) give an error like the printer is not ready. Notepad says 'a startdocprinter was not issued', word wants the printer checked, print test page says page could not be printed.
The printer was installed using install.exe and all the necessary files are in the correct place (especially since the internal print jobs work fine).
Am on Windows 2000, VB 6
Private Sub cmdDone_Click()
DriverEnd hPDF
' pdf file should exist here
End Sub
Private Sub cmdReady_Click()
'
' NO errors it inits and does everything seemingly OK
'
hPDF = DriverInit(CF_PDF_PRINTERNAME)
If hPDF <> 0 Then
Status = EnablePrinter(hPDF, "CPASoftware", CFPDF_Key)
If Status = 1 Then
sAttachedPDF = GetVFCTempFile("CFTemp.PDF")
SetResolution hPDF, 300&
SetDefaultConfigEx hPDF
SetDefaultFileName hPDF, sAttachedPDF
SetFileNameOptions hPDF, CFPDF_NoPrompt + CFPDF_UseFileName + CFPDF_Concatenate
Me.WindowState = vbMinimized
Else
MsgBox "Error with PDF Capture - Ensure Printer " & CF_PDF_PRINTERNAME & " exists", vbInformation, "PDF Error"
End If
End If
End Sub
Any ideas
Thanks
Bill Corbin
PDF Converter Developer Version
-
- Posts: 1
- Joined: Tue Apr 01 2003
- Location: Pensacola
- Contact:
Hell Bill,
In version 2.1 of the driver you need to call EnablePrinter() before each printout.
If you want to insitialize the PDF Printer from VB and then print to It from Word or Excel, you need to call EnablePrinter from the EnablePre event fired by the printer.
For more information please check details about 'EnablePrinter' functions and the 'message handling events' in the new manual 'Common Driver Interface 210.pdf'
Hope this helps.
In version 2.1 of the driver you need to call EnablePrinter() before each printout.
If you want to insitialize the PDF Printer from VB and then print to It from Word or Excel, you need to call EnablePrinter from the EnablePre event fired by the printer.
For more information please check details about 'EnablePrinter' functions and the 'message handling events' in the new manual 'Common Driver Interface 210.pdf'
Hope this helps.
-
- Posts: 2
- Joined: Mon Oct 20 2003
PDF Convert Developer 2.09
Hi,
I use PDF Convert 2.09 Developer and,then my application is running and I call my function that usa the libray of Amyuni ,the application give this error :"A StartDocPrinter call was not issued".
This is the code of the my function :
Dim WithEvents printer As New System.Drawing.Printing.PrintDocument()
....
Private Sub PrintTIFInPdf(ByVal inputFileName As String, ByVal objPDFWeb As CDIntf.CDIntf)
Try
objPDFWeb.DefaultDirectory = getObjFile().DirectoryName
objPDFWeb.DefaultFileName = TargetPdfDocument()
objPDFWeb.FileNameOptionsEx = 1 + 2 + 131072
img = New System.Drawing.Bitmap(inputFileName)
printer = New System.Drawing.Printing.PrintDocument()
numPages = img.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page) - 1
currentPage = 0
printer.PrinterSettings.PrinterName = PDFPrinter
printer.Print()
Catch Exc As Exception
Throw New Exception(Exc.Message)
Finally
printer.Dispose()
printer = Nothing
End Try
End Sub
and in handler Print Page ....
Private Sub printer_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printer.PrintPage
If currentPage < numPages Then
e.HasMorePages = True
Else
e.HasMorePages = False
End If
img.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, currentPage)
currentPage = currentPage + 1
e.Graphics.DrawImage(img, 0, 0)
End Sub
You have a solution for my problem????
Thanks
Marica
I use PDF Convert 2.09 Developer and,then my application is running and I call my function that usa the libray of Amyuni ,the application give this error :"A StartDocPrinter call was not issued".
This is the code of the my function :
Dim WithEvents printer As New System.Drawing.Printing.PrintDocument()
....
Private Sub PrintTIFInPdf(ByVal inputFileName As String, ByVal objPDFWeb As CDIntf.CDIntf)
Try
objPDFWeb.DefaultDirectory = getObjFile().DirectoryName
objPDFWeb.DefaultFileName = TargetPdfDocument()
objPDFWeb.FileNameOptionsEx = 1 + 2 + 131072
img = New System.Drawing.Bitmap(inputFileName)
printer = New System.Drawing.Printing.PrintDocument()
numPages = img.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page) - 1
currentPage = 0
printer.PrinterSettings.PrinterName = PDFPrinter
printer.Print()
Catch Exc As Exception
Throw New Exception(Exc.Message)
Finally
printer.Dispose()
printer = Nothing
End Try
End Sub
and in handler Print Page ....
Private Sub printer_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printer.PrintPage
If currentPage < numPages Then
e.HasMorePages = True
Else
e.HasMorePages = False
End If
img.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, currentPage)
currentPage = currentPage + 1
e.Graphics.DrawImage(img, 0, 0)
End Sub
You have a solution for my problem????
Thanks
Marica
Hello Marica,
We have taken a closer look at your code snippet and it does really point to a specfic issue. I have included a snippet of C# code that prints using the printer object. Let us know if this helps you.
const Int64 sNoPrompt = 0x01;
const Int64 sUseFileName = 0x02;
private void btnPrintTextObject_Click(object sender, System.EventArgs e)
{
CDIntfExClass PDF = new CDIntfExClass();
PDF.DriverInit ( PDFprinter);
PDF.DefaultDirectory = "c:\\temp";
PDF.DefaultFileName = "c:\\temp\\fromCsharp.pdf";
PDF.FileNameOptionsEx = (int)(sNoPrompt + sUseFileName);
PDF.SetDefaultPrinter();
printDocument1.Print();
PDF.RestoreDefaultPrinter();
PDF.FileNameOptions = 0;
}
// The PrintPage event is raised for each page to be printed.
private void printDocument1_PrintPage_1(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
//Turn on antialias for text
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
//Print a string at the origin
System.Drawing.Font pFont = new System.Drawing.Font("Comic Sans MS",20);
e.Graphics.DrawString ("this is a test from C#",pFont,Brushes.Green,0,0);
}
Thanks
We have taken a closer look at your code snippet and it does really point to a specfic issue. I have included a snippet of C# code that prints using the printer object. Let us know if this helps you.
const Int64 sNoPrompt = 0x01;
const Int64 sUseFileName = 0x02;
private void btnPrintTextObject_Click(object sender, System.EventArgs e)
{
CDIntfExClass PDF = new CDIntfExClass();
PDF.DriverInit ( PDFprinter);
PDF.DefaultDirectory = "c:\\temp";
PDF.DefaultFileName = "c:\\temp\\fromCsharp.pdf";
PDF.FileNameOptionsEx = (int)(sNoPrompt + sUseFileName);
PDF.SetDefaultPrinter();
printDocument1.Print();
PDF.RestoreDefaultPrinter();
PDF.FileNameOptions = 0;
}
// The PrintPage event is raised for each page to be printed.
private void printDocument1_PrintPage_1(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
//Turn on antialias for text
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
//Print a string at the origin
System.Drawing.Font pFont = new System.Drawing.Font("Comic Sans MS",20);
e.Graphics.DrawString ("this is a test from C#",pFont,Brushes.Green,0,0);
}
Thanks
-
- Posts: 2
- Joined: Mon Oct 20 2003
Hi Jose,
I have tried to use the code that you have written to me but I have not found the CDIntfExClass class.(also in C#)
The classes that I find in package the CDIntf are only these:
CDIntf.CDIntf
CDIntf.CDIntfClass
CDIntf.Document
CDIntf.DocumentClass
CDIntf.ICDIntf
CDIntf.IDIDocument
I you remember that I use the version 2.09
For the rest I have not found other differences between mine and your code,only the value of FileNameOptionsEx.
You can still help me?
Thanks
Marica
I have tried to use the code that you have written to me but I have not found the CDIntfExClass class.(also in C#)
The classes that I find in package the CDIntf are only these:
CDIntf.CDIntf
CDIntf.CDIntfClass
CDIntf.Document
CDIntf.DocumentClass
CDIntf.ICDIntf
CDIntf.IDIDocument
I you remember that I use the version 2.09
For the rest I have not found other differences between mine and your code,only the value of FileNameOptionsEx.
You can still help me?
Thanks
Marica