Hi all,
i have a problem with printing from an Access Application to PDF-XChange.
Within a VBA-Code a PDF-XChange Object is created, PDF-Options are done, set as default printer and then a report is opened to be printed.
I do not create and destroy the object for each print job, because i have to print thousands of documents at one time. Recreating the object cost to much time.
So after printing so documents the printing dialog in Access hangs (see Screenshot). When stopping the process PDFSaver4.exe Access goes on with printing.
System:
Windows XP SP3
PDF-Xchange 4.0.197.0
Access 2007 SP2
My Source:
Option Compare Database
Option Explicit
Public sError As String
Public PaperSize As AcPrintPaperSize
Public Orientation As AcPrintOrientation
Private Const olPrinterPDFXChange As String = "PDF-XChange 4.0"
Private moPDFPrinter As PXCComLib.CPXCPrinter
Private moPrinter As Access.Printer
Private iCounter As Integer
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Public Function bStore(sReport As String, sRecordSource As String, sFilter As String, sPath As String, sFilename As String) As Boolean
Dim bOpenReport As Boolean
Dim oReport As Report
Dim oStandardPrinter As Printer
' PDF-XChange initialize
Call msGetPDFPrinter(Me.msInitPDFPrinter)
' Save Standardprinter
Set oStandardPrinter = Application.Printer
' Set PDF-XChange as Standardprinter
Set Application.Printer = moPrinter
' Set PDF-XChange Options
Call Me.msSetPDFOptions(sPath & sFilename, sFilename)
bOpenReport = oReport Is Nothing
If bOpenReport Then
If Len(sRecordSource) > 0 And Len(sFilter) > 0 Then
DoCmd.OpenReport sReport, acPreview, sRecordSource, sFilter, acHidden
ElseIf Len(sRecordSource) > 0 Then
DoCmd.OpenReport sReport, acPreview, sRecordSource, , acHidden
ElseIf Len(sFilter) > 0 Then
DoCmd.OpenReport sReport, acPreview, , sFilter, acHidden
Else
--> here's the line to open and print
DoCmd.OpenReport sReport, acViewNormal, , , acWindowNormal
-->
End If
End If
' Restore Standardprinter
Set Application.Printer = oStandardPrinter
bStore = True
endd:
' Destroy Objects
Set oStandardPrinter = Nothing
Set oReport = Nothing
--> A Try to reset PDF-XChange each 100 documents DOES NOT HELP!
iCounter = iCounter + 1
If iCounter >= 1000 Then
Set moPDFPrinter = Nothing
DoEvents
DoCmd.Hourglass True
Sleep 75000 ' Wait to give pdfSaver4.exe time to exit
DoCmd.Hourglass False
iCounter = 0
End If
Exit Function
errh:
sError = Err.Description
Resume endd
End Function
Public Function msInitPDFPrinter() As String
If moPDFPrinter Is Nothing Then
Dim oPrinterTools As New OLSysPrint51.PrinterTools
Set moPDFPrinter = oPrinterTools.oGetPDFPrinter(goMandant.oLicense)
moPDFPrinter.SetAsDefaultPrinter
moPDFPrinter.RestoreDefaultPrinter
Set oPrinterTools = Nothing
End If
msInitPDFPrinter = moPDFPrinter.Name
End Function
Public Function msSetPDFOptions(sFilename As String, _
sTitle As String, _
Optional bRunApp As Boolean = False) As String
Dim sFile As String
Dim sPath As String
sPath = gsExtractPath(sFilename)
If sPath = "" Then
sPath = gsGetSpecialFolder
End If
sFile = gsFilenameRemoveChars(gsExtractFile(sFilename))
sFile = gsTrimExtension(sFile) & ".pdf"
If Not moPDFPrinter Is Nothing Then
moPDFPrinter.ResetDefaults
With moPDFPrinter
.Option("Save.SaveType") = "Save"
.Option("Save.ShowSaveDialog") = "No"
.Option("Save.WhenExists") = "Overwrite"
.Option("Save.RunApp") = bRunApp
.Option("Save.Path") = sPath
.Option("Save.File") = sFile
.Option("DocInfo.Enabled") = "Yes"
.Option("DocInfo.Title") = sTitle
.Option("DocInfo.Subject") = sTitle
.Option("DocInfo.Author") = gsCStr(goMandant.vntProperty(1))
.Option("DocInfo.Creator") = gsString(2) & _
" " & _
Left$(gsLibraryVersion, Len(gsLibraryVersion) - 1) & _
"." & _
Right$(gsLibraryVersion, 1)
.Option("Saver.ShowProgress") = "No"
.Option("Fonts.EmbedAll") = "Yes"
End With
msSetPDFOptions = sPath & sFile
End If
End Function
Private Sub msGetPDFPrinter(sPDFPrinter As String)
If moPrinter Is Nothing Then
Set moPrinter = Printers(sPDFPrinter)
End If
End Sub
PDFSaver4.exe hangs
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
-
- User
- Posts: 3
- Joined: Wed Aug 17, 2011 9:11 am
PDFSaver4.exe hangs
- Attachments
-
- Screenshot.zip
- Screenshot of hanging PDVSaver4.exe
- (15.96 KiB) Downloaded 245 times
- Tracker Supp-Stefan
- Site Admin
- Posts: 17908
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: PDFSaver4.exe hangs
Hello rainerraebiger,
I spoke with the guys from the dev team, and they told me that they will need some time to investigate this case. So they are requesting for your patience while they manage to get to the problem. We hope to be able to answer you around the middle of next week.
Best,
Stefan
I spoke with the guys from the dev team, and they told me that they will need some time to investigate this case. So they are requesting for your patience while they manage to get to the problem. We hope to be able to answer you around the middle of next week.
Best,
Stefan
-
- User
- Posts: 3
- Joined: Wed Aug 17, 2011 9:11 am
Re: PDFSaver4.exe hangs
Hi Stefan,
this is ok. I would wait even two weeks to get a solution.
Regards
Rainer
this is ok. I would wait even two weeks to get a solution.
Regards
Rainer
- Tracker Supp-Stefan
- Site Admin
- Posts: 17908
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: PDFSaver4.exe hangs
Thanks for the understanding Rainer,
And we will try to find a solution for you as fast as possible, and will post here in the forums as soon as we have any news.
Best,
Stefan
And we will try to find a solution for you as fast as possible, and will post here in the forums as soon as we have any news.
Best,
Stefan
- Ivan - Tracker Software
- Site Admin
- Posts: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: PDFSaver4.exe hangs
Could you please send me (attach to the forum topic or send to my email: Ivan@tracker-software.com) the Access file you are using with which I could try to reproduce the problem?
Tracker Software (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
-
- User
- Posts: 3
- Joined: Wed Aug 17, 2011 9:11 am
Re: PDFSaver4.exe hangs
Hi Ivan,Ivan - Tracker Software wrote:Could you please send me (attach to the forum topic or send to my email: Ivan@tracker-software.com) the Access file you are using with which I could try to reproduce the problem?
sorry for this late reply. This Access Addin is part of a large ERP-Systems based on Access. I'm not sure if having only this Addin will really help you.
Are there other ways i can support you?
Regards
Rainer Raebiger
- Ivan - Tracker Software
- Site Admin
- Posts: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: PDFSaver4.exe hangs
Please try to kill pdfSaver4.exe process before printing, run it manually (by default pdfSaver4.exe is located into PDF-XChange installation folder), and check if the problem still exists.
Tracker Software (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.