Print with and create PDF without borders (1 Viewer)

Vulcan1500

Registered User.
Local time
Today, 19:01
Joined
Nov 13, 2007
Messages
143
In my application an Access report can be selected and two buttons are than available. One button to print this report to the default printer and one to create a PDF file. Both work, but I'm struggling with white borders (margins). My default printer, like most of the other users of this application, is not capable to print without white borders, but that is due to the printer. The problem comes in as soon as a PDF is created of this report. If PDF is created also a backgound image is added to the selected report. This PDF should be A4-format with the image stretched to the size of the A4. The problem is that the result also shows white borders and I'm not able to cure this nasty problem. Maybe one of you can give me directions. Thanks in advance!
 

sneuberg

AWF VIP
Local time
Today, 11:01
Joined
Oct 17, 2014
Messages
3,506
From http://www.pcreview.co.uk/threads/setting-report-margins-in-vba.3068386/

You could change the margins doing somthing like shown below. You would have to do this for both buttons.

Code:
Dim lngMargin As Long
lngMargin = 1440  'In twips  1440 = 1 inch

DoCmd.OpenReport "Name of Report", acViewPreview, , , acHidden
With Reports![Name of Report].Printer
.TopMargin = lngMargin
.BottomMargin = lngMargin
.LeftMargin = lngMargin
.RightMargin = lngMargin
End With
 

Vulcan1500

Registered User.
Local time
Today, 19:01
Joined
Nov 13, 2007
Messages
143
Thanks for your swift reply. The one button is printing the report on A4 including margins. The second should print it to a PDF-file, but following needs to be done in VBA:
- stretch the width of the report to 21 cm (A4 width) without margins
- add image to backgroound which must be stretched to A4 format
With the help of sneuberg's answer it must be possible to reduce the margins to '0', but how to stretch the width to 21 cm an to add an image to backgound stretched to A4?
 

sneuberg

AWF VIP
Local time
Today, 11:01
Joined
Oct 17, 2014
Messages
3,506
Maybe it would just be easier to make a separate report for the PDF file output. You could make a copy of the existing one and start from there.
 

Vulcan1500

Registered User.
Local time
Today, 19:01
Joined
Nov 13, 2007
Messages
143
Also a way and I did that eventually to make progress, but from now more or less similar sheets to maintain. An issue is that when typing positions and/or sizes of controls Access (not always) is not saving this input. E.g. 15.5cm becomes 14.499 or 15.501. The other issue is that when selecting a control these small changes may happen. Both are :mad: and I do not find a setting to :) this. Can you help what I do wrong?
 

Users who are viewing this thread

Top Bottom