Another more about RPreview and Image2PDF

Post Reply
User avatar
Blessed
Posts: 243
Joined: Wed Sep 19, 2007 4:32 pm
Location: Honduras, C.A.
Contact:

Another more about RPreview and Image2PDF

Post by Blessed »

Hello friends of the forum.

I've been testing the evaluation Image2PDF DLL, I made use of "RPrevUserBtns" from the main program for which I work on all reports and works well:

Code: Select all

RPrevUserBtns( { | oPrev, oBar | MyButtons( oPrev, oBar ) } )  && Botones adicionales

...

FUNCTION MyButtons( oPreview, oBar )

   DEFINE BUTTON OF oBar RESOURCE "PDF" ACTION SavePDF( oPreview:oDevice ) ;
          TOOLTIP "Generar archivo PDF"

   DEFINE BUTTON OF oBar RESOURCE "Email" ACTION Send2Email( oPreview ) ;
          TOOLTIP "Enviar en email como archivo PDF adjunto"

   RETURN NIL
 
The code to use with Image2PDF (Posted below) only converts the text of the report, I can not see images in the preview, this is because the evaluation version or there is an error?
Someone has done a completely Image2PDF, I can help.

Code: Select all

FUNCTION SavePDF( oDevice, cMyNombrePDF )

   LOCAL error, hLibImg2PDF
   LOCAL imageFilename:=" "
   LOCAL cPdfFilename
   LOCAL nI, iErr:=0
   LOCAL aFiles:={}, cTemp

   cPdfFileName:= oApp:Path_PDF + oDevice:cDocument + ".Pdf"
   aFiles:=oDevice:aMeta
   hLibImg2PDF:=LoadLib32( "Image2PDF" )

   IF ValType(aFiles)=="A"
      I2PDF_License("LICENCIA")
      iErr:=IPMeta()              // Flag that his is a meta file
      iErr:=IPSize()              // Reset the size
      iErr:=IPMetaAdjustText()
      iErr:=IPSetDPI(0)           // Set DPI to the default for PDF's.  It works better
      FOR nI:=1 TO Len(aFiles)    // Build the pages using the array of temp files
         CursorWait()
         imageFilename:=aFiles[nI]
         iErr:=IPAddImg(imageFilename)
      NEXT nI
      CursorWait()
      iErr:=IPMakePDF(cPdfFileName,0,error,40)   // Create the PDF.
   ENDIF

   FreeLib32(hLibImg2PDF)
   CursorArrow()
   IF cMyNombrePDF != NIL
      cMyNombrePDF := cPdfFileName
   ELSE
      IF !File(cPdfFileName)
         MsgInfo("No se generó el archivo PDF.","Información!")
      ELSE
         ShellExecute(,"Open",cPdfFileName,"",".\",.T.)
      ENDIF
   ENDIF
   
RETURN (NIL)

//--- Wrappers ---------------------------------------------------------------//

   DLL32 STATIC FUNCTION I2PDF_License( code AS LPSTR) AS LONG;
   PASCAL FROM "I2PDF_License" LIB "IMAGE2PDF.dll"

   DLL32 STATIC FUNCTION IPMeta( ) AS LONG;
   PASCAL FROM "I2PDF_MetaToNativePDF" LIB "Image2PDF.dll"

   DLL32 STATIC FUNCTION IPMetaAdjustText() AS LONG;
   PASCAL FROM "I2PDF_MetaTextFitBoundingRect" LIB "Image2PDF.dll"

   DLL32 STATIC FUNCTION IPSize( ) AS LONG;
   PASCAL FROM "I2PDF_UseEMFDeviceSize" LIB "Image2PDF.DLL"

   DLL32 STATIC FUNCTION IPAddImg( cImage AS LPSTR ) AS LONG;
   PASCAL FROM "I2PDF_AddImage" LIB "Image2PDF.dll"

   DLL32 STATIC FUNCTION IPSetDpi( nDpi AS LONG ) AS LONG;
   PASCAL FROM "I2PDF_SetDPI" LIB "Image2PDF.dll"

   DLL32 STATIC FUNCTION IPMakePDF( cOutFile AS LPSTR, nOptions AS LONG, cErrTxt AS LPSTR, nMaxESize AS LONG ) AS LONG;
   PASCAL FROM "I2PDF_MakePDF" LIB "Image2PDF.dll"

   DLL32  FUNCTION COPYFILE( cExistName AS LPSTR, cNewName AS LPSTR, nFailIfExist AS LONG ) AS BOOL;
   PASCAL FROM "CopyFileA" LIB "kernel32.dll"

   DLL32 FUNCTION xI2PDF_BatesFormat( format AS LPSTR ) AS LONG;
   PASCAL FROM "I2PDF_BatesFormat" LIB "Image2PDF.dll"

   DLL32 FUNCTION xI2PDF_BatesLocation( verticalPosition AS LONG, horizontalPosition AS LONG, orientation AS LONG, margin AS LONG) AS LONG;
   PASCAL FROM "I2PDF_BatesLocation" LIB "Image2PDF.dll"

   DLL32 FUNCTION xI2PDF_BatesFont_Int( iSize AS LONG, FontID AS LPSTR, fillRed AS LONG, fillGreen AS LONG, fillBlue AS LONG, iStyle AS LONG, otherRed AS LONG, otherGreen AS LONG, otherBlue AS LONG) AS LONG;
   PASCAL FROM "I2PDF_BatesFont_Int" LIB "Image2PDF.dll"

   DLL32 FUNCTION xI2PDF_BatesBackground_Int( shape AS LONG, bkRed AS LONG, bkGreen AS LONG, bkBlue AS LONG, borderRed AS LONG, borderGreen AS LONG, borderBlue AS LONG  ) AS LONG;
   PASCAL FROM "I2PDF_BatesBackground_Int" LIB "Image2PDF.dll"

Thanks in advance.

Best regards :)
_ A. Martinez
http://www.multisofthn.com
Honduras, Centro America
xHarbour Enterprise 1.2.2, Fivewin 13.06
User avatar
Blessed
Posts: 243
Joined: Wed Sep 19, 2007 4:32 pm
Location: Honduras, C.A.
Contact:

Re: Another more about RPreview and Image2PDF

Post by Blessed »

Hello again

I just wanted to make mention that the images, are on the same page.
I know I can add pictures in a different page.

With the instruction:

Code: Select all

iErr:=IPAddImg(imageFilename)
Sooner or later, but I need the image is on the same page.

Thanks in advance.

Best regards :)
_ A. Martinez
http://www.multisofthn.com
Honduras, Centro America
xHarbour Enterprise 1.2.2, Fivewin 13.06
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Another more about RPreview and Image2PDF

Post by Richard Chidiak »

There is no problem having images in the same page , i don't know about ehe evaluation version , maybe ...

try adding this

iErr := I2PDF_MetaToNativePDF()
iErr := I2PDF_MetaTextFitBoundingRect()
iErr := I2PDF_UseEMFDeviceSize( )
iErr := I2PDF_SetDPI(0) // Set PDF DPI to the same as the image
iErr := I2PDF_MetamMargins()

I use Image2pdf since several years and it is an excellent product

HTH

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Blessed
Posts: 243
Joined: Wed Sep 19, 2007 4:32 pm
Location: Honduras, C.A.
Contact:

Re: Another more about RPreview and Image2PDF

Post by Blessed »

Richard, I appreciate your time.

Try suggesting, not turned, and still more, download the trial version 2.52, and neither, I will be inclined to think that being a demo.

Yet despite that, engaging in the purchase.

Best regards
_ A. Martinez
http://www.multisofthn.com
Honduras, Centro America
xHarbour Enterprise 1.2.2, Fivewin 13.06
Miguel Salas
Posts: 132
Joined: Sun Oct 23, 2005 4:09 pm
Location: Pánuco,Ver. México

Re: Another more about RPreview and Image2PDF

Post by Miguel Salas »

hola
necesito convertir wmf a pdf, pero en este codigo no veo como enviar el oPreview...¿?

alguien tiene el codigo completo
gracias
saludos
Post Reply