wmf in pdf

246 views
Skip to first unread message

Quique

unread,
Jul 21, 2021, 6:16:53 PM7/21/21
to Harbour Users
Is it possible load in pdf (HPDF) a file .wmf?

How?

I tried loading as img with HPDF_LoadPngImageFromFile(), HPDF_LoadPngImageFromFile() and HPDF_LoadRawImageFromFile() and I can't do it.

Shaji Thomas

unread,
Jul 22, 2021, 12:23:20 AM7/22/21
to Harbour Users
Hi,

Try this (from harupdf sample prg)
I am using this for logo printing..

 image :=  HPDF_LoadPngImageFromFile( pdf, cImage )
  iw       :=   HPDF_Image_GetWidth( image )
  ih        :=   HPDF_Image_GetHeight( image )

  HPDF_Page_SetLineWidth( page, 0.5 )

  // Draw image to the canvas. (normal-mode with actual size.) 
  HPDF_Page_DrawImage( page, image, x, y, iw, ih )
--------------------------------------------------------------------------------------------------------------------------------


pdf          -  HPDF_New()
page -  HPDF_AddPage( pdf )
cImage   -  PNG file
x,y            -  Image co-ordinates

Quique

unread,
Jul 22, 2021, 2:12:37 AM7/22/21
to Harbour Users
Thanks you, but i have

         page := hPdf_addPage( oDoc )

         image := HPDF_LoadPngImageFromFile( oDoc, cExt )  // oDoc is pdf pointer, cExt is wmf file

         iw := hpdf_image_GetWidth( image )

? iw // <----------In this point, you can see the image doesn't was loaded, because it show 0 (zero)
         ih := hPdf_image_GetHeight( image )

         hPdf_page_setWidth( page, iw )
         hPdf_page_setHeight( page, ih )

         hPdf_page_drawImage( page, image, 0, 0, iw, ih )


Shaji Thomas

unread,
Jul 22, 2021, 2:54:21 AM7/22/21
to Harbour Users
Try with a PNG file instead of WMR

Shaji Thomas

unread,
Jul 22, 2021, 2:58:47 AM7/22/21
to Harbour Users
Remove these lines..
hPdf_page_setWidth( page, iw )
hPdf_page_setHeight( page, ih )

include path name for PNG file

hmpaquito

unread,
Jul 22, 2021, 6:12:41 AM7/22/21
to Harbour Users
Habría que hacerlo en dos pasos, transformar el wmf a imagen (.bmp o .png) y despues empotrarlo en un .pdf.

Te recomiendo encarecidamente que uses IrfanView, añadiendo el plugin para pdf

Ademas, con Fwh tambien se puede pegar una imagen en un .pdf

Quique

unread,
Jul 22, 2021, 6:03:36 PM7/22/21
to Harbour Users
With png works fine, but I need wmf files.

Quique

unread,
Jul 22, 2021, 6:06:19 PM7/22/21
to Harbour Users
No es la solución que realmente busco, porque en ese caso tendré que distribuir, o mejor dicho decir que descarguen irfanView a todos los clientes, pero por lo pronto, para salir del paso con el problema que tengo, es una excelente opción, muchas gracias.

hmpaquito

unread,
Jul 23, 2021, 4:59:54 AM7/23/21
to Harbour Users
Otra "solucion" sería que tuvieras un "servicio conversor". Imaginate que tienes un webservice con modHarbour. Llamas al web-servicio con un .wmf y te devuelve un .pdf.
Con eso salvarías algunos limitantes no inhabilitantes, los que tu comentas y algunos otros más, que yo veria.

Appliserver

unread,
Jul 24, 2021, 1:03:53 AM7/24/21
to harbou...@googlegroups.com
Il 23/07/2021 10:59, hmpaquito ha scritto:
> Otra "solucion" sería que tuvieras un "servicio conversor". Imaginate
> que tienes un webservice con modHarbour. Llamas al web-servicio con un
> .wmf y te devuelve un .pdf.
> Con eso salvarías algunos limitantes no inhabilitantes, los que tu
> comentas y algunos otros más, que yo veria.
>
HMG apart (it has the BosTaurus graphic library embedded) one can use
FreeImage or ImageMagik.

I used on a Linux machine to call ImageMagick (via shell command) to
perform any kind of conversion/resize.

To work with PDF there is Ghostview, to use via shell command, again.

No need to convert files manually - but customers should install
ImageMagick and/or Ghostview if you don't go for FreeImage or HMG.

Dan


Maurizio la Cecilia

unread,
Jul 24, 2021, 3:08:42 AM7/24/21
to Harbour User Group
For people interested: I'd changed Bos Taurus lib to be HMG independent.
For sure that library is able to convert on fly from wmf to PNG (or other) format.
Best regards.
--
Maurizio

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/0895f2bf-f0ee-bd8e-50a8-b2b1bc3fc4e7%40appliserver.com.

Auge & Ohr

unread,
Jul 25, 2021, 1:14:52 AM7/25/21
to Harbour Users
hi,

it say " JPG,PNG" and i have not test it with WMF ...
try

@ <nRow> , <nCol> HPDFPRINT IMAGE <cImage> ;
    WIDTH <nWidth> ;
    HEIGHT <nheight> ;
    [ <stretch : STRETCH> ] ;
   [ TYPE <cType:JPG,PNG> ]

Jimmy
p.s. can "that" WMF file show by IMAGE ?

Appliserver

unread,
Jul 25, 2021, 4:30:49 AM7/25/21
to harbou...@googlegroups.com

That's good news - BosTaurus in my experience is excellent. Thanks Maurizio!

Dan

Quique

unread,
Jul 28, 2021, 12:02:53 PM7/28/21
to Harbour Users
De hecho, si me serviría ese servicio conversor, pero no con modharbour, porque la idea es que esto trabaja en web, pero no uso modharbour. y la solución de irfanView si funciona, pero tuve que hacer malabares, porque si tengo la imágen en "tmp20210728396168591\1825183.wmf" y estando el directorio y i_view32.exe o i_view64.exe en el mismo directorio, marca error de que no puede interpretar la cabecera de la imágen.

Quique

unread,
Jul 28, 2021, 12:09:41 PM7/28/21
to Harbour Users
Where can I found  Bos Taurus lib? Because I try find it in google, and some links apear, but nothing of programing

hmpaquito

unread,
Jul 29, 2021, 3:32:27 AM7/29/21
to Harbour Users

Bernard Mouille

unread,
Jul 29, 2021, 10:24:29 AM7/29/21
to Harbour Users
Hello,
I do not knowqs if the attached code can help you.
It is a dirty solution to conver wmf to jpg ( bmp if you modify )
Regards,
Bernard.
Test.txt
Reply all
Reply to author
Forward
0 new messages