Print pdf

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
mol
Posts: 3723
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Print pdf

Post by mol »

Every work of hmg'eers i interestimg. Maybe not needed at this time, but might be useful insame strange moment.
So, share!
User avatar
vagblad
Posts: 160
Joined: Tue Jun 18, 2013 12:18 pm
DBs Used: MySQL,DBF
Location: Thessaloniki, Greece

Re: Print pdf

Post by vagblad »

Red2 wrote: Wed Feb 21, 2024 4:21 pm 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
It is very very interesting and i would love to see your progress. It is something we were thinking about doing as well, because we would like to have a small "form generator" application under a GUI. At the moment our forms are being saved in database files so our goal was to actually make a similar app which could handle all of that and give the user an easy way to design or edit its own forms.

PS. On the matter at hand, i used a premade PNG file as a background for the "invoice" form and it prints really fine. The quality is much better than a .jpg one as well. Once more thank you to everyone for their insights and help.
Vagelis Prodromidis
Email: vagblad@gmail.com, Skype: vagblad
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Print pdf

Post by Red2 »

Hi All,

My sincere thanks to everyone who has helped me with your ideas.

I now have some proof of concept code that is basically working.
By tomorrow (23 February) I should be able to post some sample code.

Thanks again,
Red
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Print pdf

Post by Red2 »

Hello All,

The following is my simple proof of concept project code.
It shows a form with a PDF file inside a PICTURE Control.

When a mouse clicks on the PDF then a red "X" marks the location.
A MsgInfo box displays the ROW and COLUMN values.
These values are also written to a text file, CursorLocations.TXT.
This, a proof of concept, and all that currently happens.

To Do:
These RAW x/y locations should be useful when properly imported into the program that actually places the user data over the PDF (image).
I now plan to determine what ratio calculation is needed to accurately use them in my REPORT FORM.

Please let us all know your ideas, improvements, and corrections.

Red
Attachments
CursorLocations_22February.7z
(147.95 KiB) Downloaded 37 times
User avatar
serge_girard
Posts: 3167
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Print pdf

Post by serge_girard »

Thanks!
There's nothing you can do that can't be done...
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Print pdf

Post by Red2 »

Hi,

This archive has a more "normal" PNG.
CursorLocations_23February.7z
(239.62 KiB) Downloaded 40 times
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: Print pdf

Post by Red2 »

How the (Cursor) Locations program can be used.

1) Create a PNG from the original PDF.
This PNG will display as a background image in your REPORT FORM.
(SumatraPDF worked well for me here).

2) Create the basic REPORT FORM. The PNG (of the PDF) is the background.

3) Using this REPORT FORM, by trial and error, create one initial data ROW and COLUM "anchor" location.
Note these ROW and COL locations. This REPORT FORM output nicely overprints its corresponding area on the PNG.
EXAMPLE:
ROW: 207
COL: 180


4) Use the "Locations" program. It shows the PNG.
Click on the (same) "anchor" location as above. Note these ROW and COL values.
EXAMPLE
Row: 756
Column: 642


5) Generate the two calculation RATIOS.
Example results using the values found above:
"ROW" ratio (756 / 207): 3.652173913043478
"COL" ratio (642 / 180): 3.566666666666667


6) Calculate the remaining REPORT FORM's data overprint locations.
Apply these ratios to the (rest of) the ROW and COL coordinates in CursorLocations.TXT.
These ROW and COL coordinates should be where you want these REPORT FORM's data to overprint the PDF.

I hope that this is helpful to anyone who wants to print above a background PDF.
Thanks again to everyone who generously helped me here.

Red
Post Reply