pdf files

Discussions about document printing in GdPicture.NET using GdPictureImaging.
Post Reply
PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

pdf files

Post by PQSIK » Fri Mar 02, 2012 7:48 pm

Hi,

I'm having a problem printed PDF's in windows 7 and 8.
Installed the latest version of gdpictures.
I don't have the gdpicture pdf plugin.

I have a WPF project framework 4.0 and can print and see files in the viewer on a XP computer. But when I install the program on windows 7 or 8 nothing happens.

I tried gdviewer.DisplayFromFile("") and got nothing in the viewer also.

The target CPU is x86

Is there a problem with gdpictures on windows 7, 8

Any help would be great

Thanks

PQSIK

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: pdf files

Post by Loïc » Fri Mar 02, 2012 9:07 pm

Hello,

Are you able to reproduce the problem in a standalone application ?

Unfortunately with the information provided I can't do anything :(

Kind regards,

Loïc

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: pdf files

Post by PQSIK » Sat Mar 03, 2012 2:53 am

Hi there,

This is the error message I'm getting, does that help?
at System.Windows.Forms.UnsafeNativeMethods.PrintDlgEx(PRINTDLGEX lppdex)

at System.Windows.Forms.PrintDialog.ShowPrintDialog(IntPtr hwndOwner, PRINTDLGEX data)

at System.Windows.Forms.PrintDialog.RunDialog(IntPtr hwndOwner)

at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)

at gdpicture_ᜌ.gdpicture_ᜀ(IWin32Window A_0, Boolean A_1, Single A_2, Single A_3, Single A_4, Single A_5, Boolean A_6)

at GdPicture.GdPicturePDF.PrintDialog(IWin32Window owner)

at GdPicture.GdPicturePDF.PrintDialog()

at CCPrintDocsWpf.BGWorker.PrintDocsList()
PQSIK

Thanks

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: pdf files

Post by PQSIK » Sat Mar 03, 2012 3:06 am

The problem is with the PrintDialog()
comment it out and it works.

Code: Select all

Dim gdppdf As New GdPicture.GdPicturePDF
            gdppdf.PrintSetActivePrinter(Me.m_PrinterName)
            For intCount As Integer = 0 To m_DocData.Count - 1
                If Not Me.CancellationPending Then
                    Try
                        gdppdf.LoadFromFile(m_DocData.Item(intCount).DocPath, True)
comment out this line below and it works                       
 'gdppdf.PrintDialog()
                        gdppdf.Print()
                        gdppdf.CloseDocument()
                        m_DocData.Item(intCount).PrintedMassage = "Printed"
                        m_DocData.Item(intCount).DocHasPrinted = True
                    Catch ex As Exception
                       m_DocData.Item(intCount).PrintedMassage = ex.Message
                        m_DocData.Item(intCount).DocHasPrinted = False
                    End Try
                End If
            Next
Thanks

PQSIK

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: pdf files

Post by Loïc » Sat Mar 03, 2012 12:15 pm

Hello,

I can't use your snippet. I've tried something else without encountering any problem problem.
Please reproduce the issue in a standalone app.

Kind regards,

Loïc

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: pdf files

Post by PQSIK » Tue Mar 06, 2012 2:12 am

Hi,

The error did not show in a standalone project.

Now I'm getting blank print outs using the code below. The code to print the files is in a back ground worker, also I'm installing Its in a citrix environment, The printer has been tested and does print.

Is the code correct for printing a list of PDF files or I'm I missing something?

Code: Select all

Using gdp As New GdPicture.GdPictureImaging
            gdp.SetLicenseNumberUpgrade("","")
            For intCount As Integer = 0 To m_DocData.Count - 1
                If Not Me.CancellationPending Then
                    Try
                        Dim gdppdf As New GdPicture.GdPicturePDF
                        gdppdf.PrintSetActivePrinter("Printer Name")
                        gdppdf.LoadFromFile("File path")
                        gdppdf.Print()
                        gdppdf.CloseDocument()
                     Catch ex As Exception
                        
                     End Try
                End If
            Next
        End Using
Thanks

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: pdf files

Post by PQSIK » Tue Mar 06, 2012 5:40 pm

Sorry, I thought the support center was not part of this forum.

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: pdf files

Post by Loïc » Tue Mar 06, 2012 5:45 pm

Hello,

To identify the error you have to do 2 important things:

- 1: remove the try/catch block that do not handles thrown exceptions. Or keep it but handle correctly exceptions if any.
- 2: check all returned value of the GdPicture method used.

For example:

Code: Select all

        Const PRINTER_NAME As String = "Adobe PDF"
        Const FILE_PATH As String = "c:\1.pdf"

        Dim gdppdf As New GdPicture.GdPicturePDF
        If gdppdf.PrintSetActivePrinter(PRINTER_NAME) Then
            If gdppdf.LoadFromFile(FILE_PATH, False) = GdPictureStatus.OK Then
                gdppdf.Print()
                If gdppdf.PrintGetStat() <> GdPictureStatus.OK Then
                    gdppdf.CloseDocument()
                    Throw New Exception("Error printing the PDF document. Status: " + gdppdf.PrintGetStat().ToString)
                Else
                    gdppdf.CloseDocument()
                End If
            Else
                Throw New Exception("Error openning the PDF document: " + FILE_PATH)
            End If
        Else
            Throw New Exception("Error selecting Printer: " + PRINTER_NAME)
        End If
Hope this helps.

Kind regards,

Loïc

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: pdf files

Post by PQSIK » Tue Mar 06, 2012 6:52 pm

Hi there,

I got a error using your code

Status: PdfRenderingPageError

Can I send you the pdf but not here?

Thanks

PQSIK

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: pdf files

Post by Loïc » Tue Mar 06, 2012 7:00 pm

Yes, on the helpdesk: http://support.gdpicture.com

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: pdf files

Post by Loïc » Tue Mar 06, 2012 7:59 pm

I guess a you a permission issue for GDI spools creation.

Check your app can reach in read&write mode. WINNT\TEMP and WINNT\SYSTEM32\SPOOL

More information from this thread:
http://forums.citrix.com/thread.jspa?threadID=28573

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: pdf files

Post by PQSIK » Wed Mar 07, 2012 10:09 pm

Thanks for you help,

The pdf files are printing but not with GDPictures. I gave up and used the code below

Code: Select all

        Dim par As String = String.Format(" /print:printer=""{0}"" ""{1}", Me.m_PrinterName, filePath)
        Dim p As New ProcessStartInfo("C:\Program Files\Tracker Software\PDF Viewer\pdfxcview.exe", par)
PQSIK

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest