Page 1 of 2
Print pdf
Posted: Mon Feb 19, 2024 12:45 pm
by vagblad
Hello all,
Is there a way to "print" a whole .pdf file inside a "START PRINTPAGE" block?
Something like the following:
Code: Select all
START PRINTDOC
START PRINTPAGE
*Insert PRINT FILE TEST.PDF HERE*
10,20 PRINT "SOMETHING" FONT "ARIAL" SIZE 12
//etc
END PRINTPAGE
END PRINTDOC
The reason for the above is that i want to read a pdf file(or a coreldraw file or a libreoffice file) which has a layout designed already(lines drawn, logos, etc) and then i can print the data i want on top of it. When i am done, to be able to send the whole thing to the printer.
It works with PRINT IMAGE but the printing resolution is not good. Tried with jpg,png.
Thanks a lot
Re: Print pdf
Posted: Mon Feb 19, 2024 12:57 pm
by mustafa
Hola amigo:
Puedes utilizar HPDFPRINT
una vez creado el Pdf , tienes la opción de Imprimir
No se si es lo que necesitas ?
Saludos
Mustafa
Code: Select all
*------------------------------------------------*
Func PrintPDF()
*------------------------------------------------*
cNombre := "Documento.pdf"
SELECT HPDFDOC cNombre ORIENTATION HPDF_ORIENT_LANDSCAPE PAPERSIZE HPDF_PAPER_A4 // <--- Horizontal
* SELECT HPDFDOC cNombre ORIENTATION HPDF_ORIENT_PORTRAIT PAPERSIZE HPDF_PAPER_A4 // <--- Vertical
*---------------------------------------- Código Caracteres ANSI (Latinos) -------------------------------*
SET HPDFDOC ENCODING TO "WinAnsiEncoding"
* SET HPDFDOC ENCODING TO "CP1252"
*----------------------------------------------------------------------------------------------------------*
START HPDFDOC
START HPDFPAGE
@ 005,005 HPDFPRINT RECTANGLE TO 292, 206 PENWIDTH 1 ROUNDED CURVE 1
@ 007,007 HPDFPRINT RECTANGLE TO 290, 204 ROUNDED CURVE 1
*-----------------------------------------------------------------------------------------------*
@ 13, 110 HPDFPRINT "Facturación" FONT "Arial" SIZE 18 BOLD
@ 30 ,24 HPDFPRINT IMAGE "Logo.png" WIDTH 290 HEIGHT 73 TYPE PNG
END HPDFPAGE
END HPDFDOC
Execute File cNombre
Return
Re: Print pdf
Posted: Mon Feb 19, 2024 4:10 pm
by vagblad
mustafa wrote: ↑Mon Feb 19, 2024 12:57 pm
Hola amigo:
Puedes utilizar HPDFPRINT
una vez creado el Pdf , tienes la opción de Imprimir
No se si es lo que necesitas ?
Saludos
Mustafa
Hello Mustafa, thanks for your help.
It's not what i am looking for. I want to insert a whole pdf inside my document and then print on it. Imagine a pre-designed invoice document, with everything on it(logos, panels, boxes etc). And then just insert on it the various data like prices, customer details, product details etc. And then when it's done send the whole thing for printing.
[Google translate]
Hola Mustafa, gracias por tu ayuda.
No es lo que estoy buscando. Quiero insertar un pdf completo dentro de mi documento y luego imprimirlo. Imagine un documento de factura prediseñado, con todo lo que contiene (logotipos, paneles, cajas, etc.). Y luego simplemente inserte en él los diversos datos como precios, detalles del cliente, detalles del producto, etc. Y luego, cuando esté listo, envíe todo para imprimir
Re: Print pdf
Posted: Mon Feb 19, 2024 5:22 pm
by Red2
Hi vagblad,
If I understand your question correctly here is something that worked for me.
Summary:
1) I first converted the .PDF into a
.PNG.
2) I placed this .PNG in my Report Form's
Header. Its dimensions made it cover the entire page.
3) The Report Form details simply printed my information over this .PNG background image.
That is, the original .PDF's contents was simply in a "layer"
below and my information was a "layer"
above.
Essentially, the .PNG is a big watermark.
Here is a link to an earlier post I made regarding this approach:
https://www.hmgforum.com/viewtopic.php? ... g_1#p68057
I hope that this may helpful.
Kind regards,
Red2
Re: Print pdf
Posted: Mon Feb 19, 2024 5:33 pm
by franco
Hello Vagblad, I build my own pdf invoice to print or send in email with a .jpg logo if there is one. I first save it in a folder called Send off Current.
And then attach it to an email or print it. In doing it this way you have total control on how it looks. You can do it your way and double
print the pdf but you have to go back to the start and lay out each line to go over the other print out. I think more work.
I could show a sample of my complete estimate/invoice I email to customers and they can print it. It add logos, mem files if there
are one.
Franco
Re: Print pdf
Posted: Mon Feb 19, 2024 8:00 pm
by mol
Is it possible to Insert your text into .pdf file. Look at the forum, I'll try to search something.
I hope it is that you need.
Maybe KDJ posts? He's absent from years, he had a lot of knowledge...
Re: Print pdf
Posted: Tue Feb 20, 2024 8:37 pm
by EduardoLuis
Hi Vagblad:
The suggestion make by Mustafa is the best way to get a full feature PDF file.-
I use it for invoices, and works fine.-
The proper way is getting logos, boxex, lines, etc, as individual *.jpg files and you can put them in the place you want, or create a *.jpg full sheet containing a blank form, that of course you must print, and then put data on every place you want.-
After making all, you get a full feature PDF file with all data inserted.- Then you can, save it, print it, or send it on a mail app.-
On SAMPLES folder, you will find a folder HPDF file where all these is explained on detail.-
If what you want is to fill a pdf file with data, you cant do it from HMG, you must use a Adobe Livecycle pdf file, which will use a datasource that will be inserted on a PDF.-
In my opinion, you will get better results with hmg HPDF, and you will expend less time.-
Take a look, perhaps, you will find the solution you need.-
With regards.
Eduardo
Re: Print pdf
Posted: Wed Feb 21, 2024 10:30 am
by vagblad
Thank everyone for the responses,
From what i've gathered my best shot is to do exactly what Red2 is doing. Load a png image of the invoice's "background". Then fill in the data and finally send the whole thing for printing.
Ive tried something similar with jpg picture but the final print quality wasn't very good. I'll give it a go with .png as well and get back to you guys.
Thanks again to everyone!
Re: Print pdf
Posted: Wed Feb 21, 2024 4:21 pm
by Red2
Hello vagblad,
Thank you for your generous response to my "Location of a Mouse click on a PICTURE control?" question.
I am making an application that lets the user simply click on a PICTURE control displaying
a graphic (i.e. PNG). It returns the ROW and COL locations of the user's clicks.
These calculated values will DIRECTLY apply when creating the REPORT FORM.
Why? To place a REPORT FORM's detail data's (ROW and COL), by trial and
error guesses, directly over the "background" PNG takes lots of time.
It's a work in progress. Let me know if this might be of interest to you, I'd be glad to share.
Red
Re: Print pdf
Posted: Thu Feb 22, 2024 7:54 am
by serge_girard
Red,
Please share !
Serge