PDA

View Full Version : Printing problems


delbeke
July 3rd, 2006, 01:35 AM
Hi

I have problems using the FPDF_RenderPage function with some printers

On the first printer (Lexmark X215) all works perfectly. the second one (LexMark C752) the text is correctly printed but graphics elements are printed with a more higher resolution (a fisrt sight, 6x more accurate)

He is a portion of my vb5 code

If cmnDlg.ShowPrinter Then
frmImpr.Show 0, Me 'show printing form
Printer.Copies = cmnDlg.Copies
If Printer.Copies = cmnDlg.Copies Then
NbCopies = 1
Else
'the driver do'nt hangle multi-copies
NbCopies = cmnDlg.Copies
End If
'look for first page's orient
mvarFPDFVIEWERhPdfDoc = FPDF_LoadDocument(mvarPdfFileName, "")
hPdfPage = FPDF_LoadPage(mvarFPDFVIEWERhPdfDoc, cmnDlg.FromPage - 1)
PdfPageWidth = ScaleX(FPDF_GetPageWidth(hPdfPage), vbPoints, vbPixels)
PdfPageHeight = ScaleY(FPDF_GetPageHeight(hPdfPage), vbPoints, vbPixels)
FPDF_ClosePage hPdfPage
If PdfPageWidth > PdfPageHeight Then
PrnOrient = 2
Else
PrnOrient = 1
End If
Printer.Orientation = PrnOrient
Printer.ScaleMode = vbPixels
Printer.Print " " 'to got a clean hdc
dc = Printer.hDc
'read printer's offsets/margins
PrnOffsetX = GetDeviceCaps(dc, PHYSICALOFFSETX)
PrnOffsetY = GetDeviceCaps(dc, PHYSICALOFFSETY)
PrnWidth = GetDeviceCaps(dc, HORZRES)
PrnHeight = GetDeviceCaps(dc, VERTRES)
For iPnt = 1 To NbCopies 'for each copy
For lPnt = cmnDlg.FromPage To cmnDlg.ToPage 'for each selected page
frmImpr.lblPage = "Page : " & CStr(lPnt): DoEvents
hPdfPage = FPDF_LoadPage(mvarFPDFVIEWERhPdfDoc, lPnt - 1)
If hPdfPage = 0 Then
MsgBox "Erreur rendering page n° " & CStr(lPnt)
Else
'control for orient change
PdfPageWidth = ScaleX(FPDF_GetPageWidth(hPdfPage), vbPoints, vbPixels)
PdfPageHeight = ScaleY(FPDF_GetPageHeight(hPdfPage), vbPoints, vbPixels)
If PdfPageWidth > PdfPageHeight Then
TestPrnOrient = 2
Else
TestPrnOrient = 1
End If
If lPnt > cmnDlg.FromPage Then
'if not the fisrt page
If TestPrnOrient = PrnOrient Then
'same orient
Printer.NewPage
Else
'orient changed => end the doc and start a new one
Printer.EndDoc
PrnOrient = TestPrnOrient
Printer.Orientation = PrnOrient
Printer.ScaleMode = vbPixels
Printer.Print " " 'got a clean hdc
dc = Printer.hDc
'read printer's offsets/margins
PrnOffsetX = GetDeviceCaps(dc, PHYSICALOFFSETX)
PrnOffsetY = GetDeviceCaps(dc, PHYSICALOFFSETY)
PrnWidth = GetDeviceCaps(dc, HORZRES)
PrnHeight = GetDeviceCaps(dc, VERTRES)
End If
End If
'render the page
FPDF_RenderPage dc, hPdfPage, PrnOffsetX + 100, PrnOffsetY + 100, PrnWidth - PrnOffsetX - 200, PrnHeight - PrnOffsetY - 200, Rot, 0
'close the page
FPDF_ClosePage hPdfPage
End If
If frmImpr.Canceled Then
'if canceled , do'nt draw others pages
Exit For
End If
Next
Printer.EndDoc
Next
'close the document
FPDF_CloseDocument mvarFPDFVIEWERhPdfDoc
End If
'===================


All work fine on the display and the pdf is rendered corectly

Note : i've not succed aataching a sample
I've sent you an email with samples to Support@foxitsoftware.com



Best regars

william
July 5th, 2006, 02:14 AM
hi delbeke,

It seems to be an old bug and doesn't exist in the new version of sdk.
We have already compile a new version and sent it to your email address.
Please check it out and let us know if the problem persists.

delbeke
July 7th, 2006, 12:09 AM
Thanks you very much
I'll try it right now.

Bets regards

delbeke
July 7th, 2006, 02:41 AM
Well done, every thing is perfect, now

Thanks very much