Use PDF a background for report. (1 Viewer)

selvsagt

Registered User
Joined
Jun 29, 2006
Messages
99
Hi!

I have a DB that is split to a back and frontend.

The FrontEnd is published on a Citrix server, so is the backend. It works well, but I have issues with images in report.

We have a lot of suppliers that demand that we use their standardized forms for entering customer information.

Most of these forms are quite simple and basic (logo in the corner and so on), and this does not represent an issue to just mock them in a new report.

However, one of our suppliers has multiple pictures, their own font for text, "complicated" boxes with text (for example they do not use rectangles, but cut of corner rectangles) and so on. It's a nightmare to recreate.

The FrontEnd file was about 25mb when i startet, and after creating 2 reports of 6 pages, the frontEnd size increased to over 350mb.

I have saved the pdf as an image (jpg). I need high resolution because of small tekst in the pdf that needs to be visible. I have managed to get the size down to 2mb, some 4mb. Any lower and the image is unreadable. I have also tried BMP (I've heard that bmp i preferable).

All of this is quite time consuming, and I have used hours after hours recreating these reports, without satisfactory results.

Sometimes the images are visible on the print, other times not. The same with the print preview.

I need a stable solution.
So my question is... How can I "create" a report, based on a PDF?
Any help in this matter is greatly appreciated !!!
 

Minty

AWF VIP
Joined
Jul 26, 2013
Messages
6,539
You might find it easier to create the report in word - there is a merge to word report generator I used a long time ago I believe it came from Albert Kallal...

http://kallal.ca/wordmerge/index.html

From memory it took a little setting up, but gave you the flexibility of using word docs as the template for the report, directly from Access. Ideal for really difficult to get right reports.

Alternatively you could just send an electronic data file of the data to save the poor saps at the other end retyping your carefully electronically stored data . . . .
 

selvsagt

Registered User
Joined
Jun 29, 2006
Messages
99
Hi.
Thank you for your reply.

I have looked at kallals solution, and it seems alright. The former version of my application used excel for the same feature, and it worked really good. I assumed Access would be able to do the same, There must be some solution to this problem!

I think, however, that I might be closer to a solution by formatting the images differently. I know that bitmap is the prefered image in access, but in my case, most of the images are "mostly white spaces", and its only the text boxes that i need to work on.

First I tried to cut out the different images in the pdf as unbound images, linked images and so on. That didnt work. The images, even with dramatically reduced file size did not print. Why I have no idea. I think its difficult to read the documentation on images in access. Why does it not show on print? I am down to 900K now on the report.

Another solution I am working on right now is to use png instead of bitmap. I get the same filesize, about 900k, but still the image does not print.

In both cases the images show up in print preview, but not on the actual print, or in the pdf file i use to generate from the report.

Is there a "simple" recipe to to image handling in access?
To store the image in the db does not work. The filesize gets huge.
Should I use the activeX image control, or unbound image. Or is it some other configuration I should look at?
 

sxschech

Registered User
Joined
Mar 2, 2010
Messages
636
If you have the full version of adobe acrobat (not reader), it can be done with Access and VBA code. Let me know and I'll try to find the code.
 

CJ_London

Super Moderator
Staff member
Joined
Feb 19, 2013
Messages
11,574
I would use a jpg rather than png, store the images outside of the db in a directory and link an image control to the file.

I've attached a simple sample db to demonstrate, together with a couple of simple forms - put these forms in your C:\ directory and open report1.

The position of controls are stored in the ctrlpos table and the data in tblData, including the form to be used - you can get more sophisticated than this if required.

To set the control positions for another report, open the report in Layout view and drag each control to the required position - make a note of the top and left values and enter in the ctrlpos table, converting to twips (multiple cm x 567 or inches x 1440) - again, you can store as the actual measurement and convert in the code if you want.

Then all you need to do is output the report to a pdf.
 

Attachments

Galaxiom

Super Moderator
Staff member
Joined
Jan 20, 2009
Messages
11,824
Another alternative would be to print the report to pdf then use pdftoolkit to insert the original pdf as a background.
 

selvsagt

Registered User
Joined
Jun 29, 2006
Messages
99
Thank you so very much!
The problem is now solved.

The biggest problem was actually to get the filesize small enough, but still within access limitations.

First i converted each pdf page as png. Because most of the pages are white, that eliminated a lot of the file size. I then compressed it to 150 dpi, which is 1240 pixels in width on a A4 page. I still had about 600kb pr page, and it didnt print in access, but when i then saved the image as GIF (reduced color quality, but thats ok), most of the images ended up being about 100-150kb, and the report now both preview nicely, and prints nicely. Jpg ended up to big no matter what I did. The lowest readable resoution ended in about 400kb.

I made a master report, with a subreport for each "pdf-page", inserted linked images on each sub. The biggest report was about 12 different "pdf-image" pages, and it works like a charm. I had to use 1 main report, with 2 subreport, that also had subreports. Some fidling to get it to work, but it is now stable enough, and i am quity happy i am finished with this task.
The quality of the image is not optimal, but good enough.
 

Galaxiom

Super Moderator
Staff member
Joined
Jan 20, 2009
Messages
11,824
JPG is the most misused image format. Its name stands for Joint Photographic experts Group. Note the word "Photographic".

JPG is ONLY intended for photographs. It is entirely unsuited to line art, text and anything else with sharp changes in colour. There are many jpg renditions of cartoons and other line art online and they look terrible because they have big smudged areas around the text.

GIF has limited colour capacity. Note however you can also control the number of colours used in PNG from a lot more than a GIF can handle right down to two.
 

CJ_London

Super Moderator
Staff member
Joined
Feb 19, 2013
Messages
11,574
JPG is ONLY intended for photographs. It is entirely unsuited to line art, text and anything else with sharp changes in colour
So that's why. all these years I never knew that Learn something every day:)
 
Last edited:

DucatiWiz

New member
Joined
Mar 4, 2016
Messages
2
I know this is an old thread, but in case anyone else has this problem, I thought I'd share my favoured solution:

Firstly a little background, for those who don't know, there are two very different types of image file: Bitmaps and Vectors.

Bitmaps are a collection of different coloured dots and are not very suitable for printing text/lines etc as to get sharp images you have to have high resolutions and therefore larger files sizes. BMP, JPG, PNG, EPS, GIF etc are all bitmap files.

Vector files contain the text and graphics in computer code. The files tend to be much smaller and the text/graphics will be razor shape at any size when printed as the files hold mathematical "outline and fill" information within the file, not a collection of dots. Files such as WMF (windows meta files) AutoCAD images, Ai (Adobe Illustrator images) are all examples of vector image files.

Finally there are hybrid files such as PDF, which are a kind of container file which can have both bitmaps and vector files inside. Unfortunately, as you've found out, Access doesn't support these as a background image file.

My favoured solution to this is to create a vector or hybrid PDF of the form you are trying to produce. Remember that you can't just scan a paper form to PDF as that will just be a PDF file with a bitmap inside it, you need the form in text and graphic format, say from Word or Excel. There are some programs that will convert bitmap files into vector files (OCR does this) but that aren't always that accurate depending on the content.

Next you need some software which converts a PDF to a WMF (windows meta file). Adobe Illustrator does this very well.

Convert the PDF to WMF then simply set it as the background to the report. Then you can overlay the form data simply by adding fields to the report in the usual way. This gives a sharp printed form and small file size.

Hope that helps.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom