Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

Latests build cannot print PDF Options
serializer
Posted: Friday, April 5, 2019 8:33:35 AM
Rank: Advanced Member
Groups: Member

Joined: 5/9/2016
Posts: 56
There is a big problem with printing PDF in the newer builds. I have tested the two latest builds and they have the same problem. I know a build that works and that is: 18.3.46.0

What is happening is that I start a process which calls the print commands. I am able to print 1 document. Next time it hangs - and it hangs at:

Quote:
mt.WaitOne()


Again, this is not happening on 18.3.46.0. I am able to call this method as many times as I want. Here is the full code:

Quote:
Private Sub StartPDFPrintProcessEO(ByVal psc As PrinterSettingsClass)
If TaskProcess.Task.TaskDebugging Then
LogAPI.Log(False, LogClass.EventT.Debug, "StartPDFPrintProcessEO->Start", TaskProcess)
End If
'Create objects for printer and page settings and PrintDocument
AddHandler EO.Base.Runtime.Exception, AddressOf EOException

Dim ps As New System.Drawing.Printing.PrinterSettings()

Dim pgs As New System.Drawing.Printing.PageSettings()

pgs.Margins = New System.Drawing.Printing.Margins(psc.MarginLeft, psc.MarginRight, psc.MarginTop, psc.MarginBottom)

' print range
Select Case psc.PrintRange
Case EnmPrintRange.AllPages
' do nothing
Case EnmPrintRange.CurrentPage
pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.CurrentPage
Case EnmPrintRange.Selection
pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.Selection
Case EnmPrintRange.SomePages
pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.Selection
End Select


If TaskProcess.Task.TaskDebugging Then
LogAPI.Log(False, LogClass.EventT.Debug, "StartPDFPrintProcessEO->Setting printer: " & psc.SelectedPrinter, TaskProcess)
End If
'Set printer name
ps.PrinterName = psc.SelectedPrinter

'Set PageMargins (if required)
ps.DefaultPageSettings.Margins.Left = psc.MarginLeft
ps.DefaultPageSettings.Margins.Right = psc.MarginRight
ps.DefaultPageSettings.Margins.Top = psc.MarginTop
ps.DefaultPageSettings.Margins.Bottom = psc.MarginBottom

' copies
ps.Copies = psc.NoOfCopies
If TaskProcess.Task.TaskDebugging Then
LogAPI.Log(False, LogClass.EventT.Debug, "StartPDFPrintProcessEO->Adding printer settings", TaskProcess)
End If
pgs.PrinterSettings = ps

Dim pdfdoc As New PdfDocument(psc.File, psc.Password)

' add support for printing specific pages
If psc.SelectedPages IsNot Nothing Then
Dim selectedPages As String = GetSelectedPages(psc.SelectedPages)
Dim pages() As String = selectedPages.Split(",".ToCharArray)

' create integer list of pages to print
Dim intPagesToPrint As New List(Of Integer)
For Each strPage As String In pages
intPagesToPrint.Add(CInt(strPage))
Next

' create list of pdf pages to remove
Dim lstRemovePages As New List(Of PdfPage)
Dim i As Integer = 1
For Each pdfPage As PdfPage In pdfdoc.Pages
If Not intPagesToPrint.Contains(i) Then
lstRemovePages.Add(pdfPage)
End If
i += 1
Next

' remove pages from document
For Each pdfPage As PdfPage In lstRemovePages
pdfdoc.Pages.Remove(pdfPage)
Next
End If

Dim IsLandscape As Boolean = False
If pdfdoc.Pages.Count > 0 Then
IsLandscape = pdfdoc.Pages(0).Size.Width > pdfdoc.Pages(0).Size.Height
End If

Select Case psc.PageSettings.PaperOrientation
Case EnmOrientation.Landscape
pgs.PrinterSettings.DefaultPageSettings.Landscape = True
Case EnmOrientation.Portrait
pgs.PrinterSettings.DefaultPageSettings.Landscape = False
Case EnmOrientation.Auto
pgs.PrinterSettings.DefaultPageSettings.Landscape = IsLandscape
End Select

If TaskProcess.Task.TaskDebugging Then
LogAPI.Log(False, LogClass.EventT.Debug, "StartPDFPrintProcessEO->Before sending print", TaskProcess)
End If
mt = pdfdoc.Print(ps, pgs)
If TaskProcess.Task.TaskDebugging Then
LogAPI.Log(False, LogClass.EventT.Debug, "StartPDFPrintProcessEO->After sending print", TaskProcess)
End If
mt.WaitOne()

If TaskProcess.Task.TaskDebugging Then
LogAPI.Log(False, LogClass.EventT.Debug, "StartPDFPrintProcessEO->After mt.WaitOne", TaskProcess)
End If
RemoveHandler EO.Base.Runtime.Exception, AddressOf EOException
If TaskProcess.Task.TaskDebugging Then
LogAPI.Log(False, LogClass.EventT.Debug, "StartPDFPrintProcessEO->Removing exception", TaskProcess)
End If
End Sub
eo_support
Posted: Friday, April 12, 2019 9:54:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,194
Hi,

This is just let you know that we have posted a new build (build 19.1.11) that MAY have resolved this issue for you. While trying to reproduce your issue, we have discovered another issue related to loading a second PDF file into the same PdfViewer. The new build have fixed that issue. So please try to download it from our download page and see if it resolves your issue and we can then go from there.

Thanks!
serializer
Posted: Friday, April 12, 2019 9:55:28 AM
Rank: Advanced Member
Groups: Member

Joined: 5/9/2016
Posts: 56
Was just going to email/post back. This build indeed solves my problem too. Thanks
eo_support
Posted: Friday, April 12, 2019 10:58:38 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,194
serializer wrote:
Was just going to email/post back. This build indeed solves my problem too. Thanks


Great. Thanks for confirming the fix!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.