Boa tarde, quando uso a impressora conectada ao pc o preview sai perfeito mas quando tenho que usar uma impressora da rede o preview e o relatorio sai
todo bagunçado, existe solução pra esse problema ???
Obrigado pela atenção !!!
Moderador: Moderadores
#include "FiveWin.ch"
#include "set.ch"
#include "struct.ch"
#define TA_LEFT 0
#define TA_RIGHT 2
#define TA_CENTER 6
#define ETO_OPAQUE 2
#define ETO_CLIPPED 4
#define HORZSIZE 4
#define VERTSIZE 6
#define HORZRES 8
#define VERTRES 10
#define LOGPIXELSX 88
#define LOGPIXELSY 90
#define MM_TEXT 1
#define MM_LOMETRIC 2
#define MM_HIMETRIC 3
#define MM_LOENGLISH 4
#define MM_HIENGLISH 5
#define MM_TWIPS 6
#define MM_ISOTROPIC 7
#define MM_ANISOTROPIC 8
#define PAD_LEFT 0
#define PAD_RIGHT 1
#define PAD_CENTER 2
// Defines for the oPrn:SetPage(nPage) method (The printer MUST support it)
#define DMPAPER_LETTER 1 // Letter 8 1/2 x 11 in
#define DMPAPER_LETTERSMALL 2 // Letter Small 8 1/2 x 11 in
#define DMPAPER_TABLOID 3 // Tabloid 11 x 17 in
#define DMPAPER_LEDGER 4 // Ledger 17 x 11 in
#define DMPAPER_LEGAL 5 // Legal 8 1/2 x 14 in
#define DMPAPER_STATEMENT 6 // Statement 5 1/2 x 8 1/2 in
#define DMPAPER_EXECUTIVE 7 // Executive 7 1/4 x 10 1/2 in
#define DMPAPER_A3 8 // A3 297 x 420 mm
#define DMPAPER_A4 9 // A4 210 x 297 mm
#define DMPAPER_A4SMALL 10 // A4 Small 210 x 297 mm
#define DMPAPER_A5 11 // A5 148 x 210 mm
#define DMPAPER_B4 12 // B4 250 x 354
#define DMPAPER_B5 13 // B5 182 x 257 mm
#define DMPAPER_FOLIO 14 // Folio 8 1/2 x 13 in
#define DMPAPER_QUARTO 15 // Quarto 215 x 275 mm
#define DMPAPER_10X14 16 // 10x14 in
#define DMPAPER_11X17 17 // 11x17 in
#define DMPAPER_NOTE 18 // Note 8 1/2 x 11 in
#define DMPAPER_ENV_9 19 // Envelope #9 3 7/8 x 8 7/8
#define DMPAPER_ENV_10 20 // Envelope #10 4 1/8 x 9 1/2
#define DMPAPER_ENV_11 21 // Envelope #11 4 1/2 x 10 3/8
#define DMPAPER_ENV_12 22 // Envelope #12 4 \276 x 11
#define DMPAPER_ENV_14 23 // Envelope #14 5 x 11 1/2
#define DMPAPER_CSHEET 24 // C size sheet
#define DMPAPER_DSHEET 25 // D size sheet
#define DMPAPER_ESHEET 26 // E size sheet
#define DMPAPER_ENV_DL 27 // Envelope DL 110 x 220mm
#define DMPAPER_ENV_C5 28 // Envelope C5 162 x 229 mm
#define DMPAPER_ENV_C3 29 // Envelope C3 324 x 458 mm
#define DMPAPER_ENV_C4 30 // Envelope C4 229 x 324 mm
#define DMPAPER_ENV_C6 31 // Envelope C6 114 x 162 mm
#define DMPAPER_ENV_C65 32 // Envelope C65 114 x 229 mm
#define DMPAPER_ENV_B4 33 // Envelope B4 250 x 353 mm
#define DMPAPER_ENV_B5 34 // Envelope B5 176 x 250 mm
#define DMPAPER_ENV_B6 35 // Envelope B6 176 x 125 mm
#define DMPAPER_ENV_ITALY 36 // Envelope 110 x 230 mm
#define DMPAPER_ENV_MONARCH 37 // Envelope Monarch 3.875 x 7.5 in
#define DMPAPER_ENV_PERSONAL 38 // 6 3/4 Envelope 3 5/8 x 6 1/2 in
#define DMPAPER_FANFOLD_US 39 // US Std Fanfold 14 7/8 x 11 in
#define DMPAPER_FANFOLD_STD_GERMAN 40 // German Std Fanfold 8 1/2 x 12 in
#define DMPAPER_FANFOLD_LGL_GERMAN 41 // German Legal Fanfold 8 1/2 x 13 in
// Defines for the oPrn:SetBin(nBin) method (The printer MUST support it)
#define DMBIN_FIRST DMBIN_UPPER
#define DMBIN_UPPER 1
#define DMBIN_ONLYONE 1
#define DMBIN_LOWER 2
#define DMBIN_MIDDLE 3
#define DMBIN_MANUAL 4
#define DMBIN_ENVELOPE 5
#define DMBIN_ENVMANUAL 6
#define DMBIN_AUTO 7
#define DMBIN_TRACTOR 8
#define DMBIN_SMALLFMT 9
#define DMBIN_LARGEFMT 10
#define DMBIN_LARGECAPACITY 11
#define DMBIN_CASSETTE 14
#define DMBIN_LAST DMBIN_CASSETTE
#define DMORIENT_PORTRAIT 1
#define DMORIENT_LANDSCAPE 2
static oPrinter
//----------------------------------------------------------------------------//
CLASS TPrinter
DATA oFont
DATA hDC, hDCOut
DATA aMeta
DATA cDir, cDocument, cModel
DATA nPage, nXOffset, nYOffset, nPad, nOrient
DATA lMeta, lStarted, lModified, lPrvModal
METHOD New( cDocument, lUser, lMeta, cModel, lModal ) CONSTRUCTOR
MESSAGE StartPage() METHOD _StartPage()
MESSAGE EndPage() METHOD _EndPage()
METHOD End()
METHOD Say( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad )
METHOD CmSay( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad );
INLINE ;
(::Cmtr2Pix(@nRow, @nCol),;
::Say( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad ))
METHOD InchSay( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad );
INLINE ;
(::Inch2Pix(@nRow, @nCol),;
::Say( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad ))
METHOD SayBitmap( nRow, nCol, cBitmap, nWidth, nHeight, nRaster )
METHOD SayImage( nRow, nCol, oImage, nWidth, nHeight, nRaster )
METHOD SetPos( nRow, nCol ) INLINE MoveTo( ::hDCOut, nCol, nRow )
METHOD Line( nTop, nLeft, nBottom, nRight, oPen ) INLINE ;
MoveTo( ::hDCOut, nLeft, nTop ),;
LineTo( ::hDCOut, nRight, nBottom,;
If( oPen != nil, oPen:hPen, 0 ) )
METHOD Box( nRow, nCol, nBottom, nRight, oPen ) INLINE ;
Rectangle( ::hDCOut, nRow, nCol, nBottom, nRight,;
If( oPen != nil, oPen:hPen, 0 ) )
METHOD RoundBox( nRow, nCol, nBottom, nRight, nWidth, nHeight, oPen, nBGColor )
METHOD Arc( nTop, nLeft, nBottom, nRight, nXB, nYB, nXE, nYE, oPen ) INLINE ;
Arc( ::hDCOut, nLeft, nTop, nRight, nBottom, nXB, nYB, nXE, nYE, ;
If( oPen != nil, oPen:hPen, 0 ) )
METHOD Chord( nTop, nLeft, nBottom, nRight, nXB, nYB, nXE, nYE, oPen ) INLINE ;
Chord( ::hDCOut, nLeft, nTop, nRight, nBottom, nXB, nYB, nXE, nYE, ;
If( oPen != nil, oPen:hPen, 0 ) )
METHOD Ellipse( nRow, nCol, nBottom, nRight, oPen ) INLINE ;
Ellipse( ::hDCOut, nCol, nRow, nRight, nBottom, ;
If( oPen != nil, oPen:hPen, 0 ) )
METHOD Pie( nTop, nLeft, nBottom, nRight, nxStartArc, nyStartArc, nxEndArc, nyEndArc, oPen ) INLINE ;
Pie( ::hDCOut, nTop, nLeft, nBottom, nRight, nxStartArc, nyStartArc, nxEndArc, nyEndArc, ;
If( oPen != nil, oPen:hPen, 0 ) )
METHOD GetPixel( nRow, nCol, nRGBColor ) INLINE ;
SetPixel( ::hDCOut, nCol, nRow, nRGBColor )
METHOD SetPixel( nRow, nCol ) INLINE ;
SetPixel( ::hDCOut, nCol, nRow )
METHOD Cmtr2Pix( nRow, nCol )
METHOD DraftMode( lOnOff ) INLINE (DraftMode( lOnOff ),;
::Rebuild() )
METHOD Inch2Pix( nRow, nCol )
METHOD Pix2Mmtr(nRow, nCol) INLINE ;
( nRow := nRow * 25.4 / ::nLogPixelX() ,;
nCol := nCol * 25.4 / ::nLogPixelY() ,;
{nRow, nCol} )
METHOD Pix2Inch(nRow, nCol) INLINE ;
( nRow := nRow / ::nLogPixelX() ,;
nCol := nCol / ::nLogPixelY() ,;
{nRow, nCol} )
METHOD CmRect2Pix(aRect)
METHOD nVertRes() INLINE GetDeviceCaps( ::hDC, VERTRES )
METHOD nHorzRes() INLINE GetDeviceCaps( ::hDC, HORZRES )
METHOD nVertSize() INLINE GetDeviceCaps( ::hDC, VERTSIZE )
METHOD nHorzSize() INLINE GetDeviceCaps( ::hDC, HORZSIZE )
METHOD nLogPixelX() INLINE GetDeviceCaps( ::hDC, LOGPIXELSX )
METHOD nLogPixelY() INLINE GetDeviceCaps( ::hDC, LOGPIXELSY )
METHOD SetPixelMode() INLINE SetMapMode( ::hDC, MM_TEXT )
METHOD SetTwipsMode() INLINE SetMapMode( ::hDC, MM_TWIPS )
METHOD SetLoInchMode() INLINE SetMapMode( ::hDC, MM_LOENGLISH )
METHOD SetHiInchMode() INLINE SetMapMode( ::hDC, MM_HIENGLISH )
METHOD SetLoMetricMode() INLINE SetMapMode( ::hDC, MM_LOMETRIC )
METHOD SetHiMetricMode() INLINE SetMapMode( ::hDC, MM_HIMETRIC )
METHOD SetIsotropicMode() INLINE SetMapMode( ::hDC, MM_ISOTROPIC )
METHOD SetAnisotropicMode() INLINE SetMapMode( ::hDC, MM_ANISOTROPIC )
METHOD SetWindowExt( nUnitsWidth, nUnitsHeight ) INLINE ;
SetWindowExt( ::hDC, nUnitsWidth, nUnitsHeight )
METHOD SetViewPortExt( nWidth, nHeight ) INLINE ;
SetViewPortExt( ::hDC, nWidth, nHeight )
METHOD GetTextWidth( cText, oFont ) INLINE ;
GetTextWidth( ::hDC, cText, ::SetFont(oFont):hFont)
METHOD GetTextHeight( cText, oFont ) INLINE Abs( ::SetFont(oFont):nHeight )
METHOD Preview() INLINE If( ::lMeta .and. Len( ::aMeta ) > 0 .and. ::hDC != 0,;
RPreview( Self ), ::End() )
MESSAGE FillRect( aRect, oBrush ) METHOD _FillRect( aRect, oBrush )
METHOD ResetDC() INLINE ResetDC( ::hDC )
METHOD GetOrientation() INLINE PrnGetOrientation()
METHOD SetLandscape() INLINE ( PrnLandscape( ::hDC ),;
::Rebuild() )
METHOD SetPortrait() INLINE ( PrnPortrait( ::hDC ),;
::Rebuild() )
METHOD SetCopies( nCopies ) INLINE ;
( PrnSetCopies( nCopies ),;
::Rebuild() )
METHOD SetSize( nWidth, nHeight ) INLINE ;
( PrnSetSize( nWidth, nHeight ),;
::Rebuild() )
METHOD SetPage( nPage ) INLINE ;
( PrnSetPage( nPage ),;
::Rebuild() )
METHOD SetBin( nBin ) INLINE ;
( PrnBinSource( nBin ),;
::Rebuild() )
METHOD GetModel() INLINE PrnGetName()
METHOD GetDriver() INLINE PrnGetDrive()
METHOD GetPort() INLINE PrnGetPort()
METHOD GetPhySize()
METHOD Setup() INLINE ( PrinterSetup(),;
::Rebuild() )
METHOD Rebuild()
METHOD SetFont( oFont )
METHOD CharSay( nRow, nCol, cText )
METHOD CharWidth()
METHOD CharHeight()
METHOD ImportWMF( cFile )
METHOD ImportRAW( cFile )
METHOD SizeInch2Pix( nHeight, nWidth )
ENDCLASS
//----------------------------------------------------------------------------//
#include <hmg.ch>
#include <harupdf.ch> // incluido pra testes / mr.
Function Main()
define window main at 0, 0 width 300 height 300 main title 'HMG HPDF Document'
define button create
row 100
col 100
caption 'HMG HPDF UNICODE'
//HPDF_PDFA_SetPDFAConformance('HMG_HPDF_UNI.pdf', HPDF_PDFA_1B) // teste mr p/pdfa.
action pdf_create()
end button
end window
main.center
main.activate
Return
function pdf_create()
local lSuccess := .f.
local cLB := chr( 10 )
SELECT HPDFDOC 'HMG_HPDF_UNI.pdf' TO lSuccess papersize HPDF_PAPER_A4
if lSuccess
HPDF_PDFA_SetPDFAConformance('HMG_HPDF_UNI.pdf', HPDF_PDFA_1B) // teste mr p/pdfa.
START HPDFDOC
START HPDFPAGE
//HPDF_PDFA_SetPDFAConformance('HMG_HPDF_UNI.pdf', HPDF_PDFA_1B) // teste mr p/pdfa.
/* UTF8 */
// msginfo( str( HPDF_UseUTFEncodings( _HMG_SYSDATA[ 150 ][ 1 ] ) ) )
// msginfo( str( HPDF_SetCurrentEncoder( _HMG_SYSDATA[ 150 ][ 1 ], 'UTF-8' ) ) )
// SET HPDFDOC ENCODING TO "UTF-8"
// HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], 'latha.ttf', "UTF-8" )
@ 280, 10 HPDFPRINT UNICODE '@ 290, 10 HPDFPRINT "The font is பொது குறிப்புகள்" ' to 300, 300 size 12
END HPDFPAGE
END HPDFDOC
endif
//HPDF_PDFA_SetPDFAConformance('HMG_HPDF_UNI.pdf', HPDF_PDFA_1B) // teste mr p/pdfa.
execute file 'HMG_HPDF_UNI.pdf'
return nil
Usuários vendo este fórum: Bing [Bot] e 6 visitantes