#1
|
|||
|
|||
Adjust Page Size Using PrintOut Method for File Print to PDF by VBA
Hi,
I use this code to print the document by "Application.PrintOut" method to PDF file, I don't want it by "ExportAsFixedFormat" because I have an issue with this method (italic text loses formatting). Code:
Sub SaveAsPDF() Dim sPrinter As String Dim strDocName As String Dim strPath As String Dim intPos As Integer 'Find position of extension in filename strDocName = ActiveDocument.Name strPath = ActiveDocument.Path & "\" intPos = InStrRev(strDocName, ".") strDocName = Left(strDocName, intPos - 1) strDocName = strPath & strDocName & ".pdf" On Error GoTo lbl_Exit sPrinter = Application.ActivePrinter ActivePrinter = "Microsoft Print to PDF" Application.DisplayAlerts = False ActiveDocument.PrintOut _ OutputFileName:=strDocName, _ PrintToFile:=True lbl_Exit: Application.DisplayAlerts = True Application.ActivePrinter = sPrinter Exit Sub End Sub I always use A4 (210*297 mm), when I use ExportAsFixedFormat method, the output file is the same size as my document size, but when I use "Application.PrintOut" method, the output file size is 215*279 mm, which is different from A4 size and causes some problems when printing on paper. I changed the default paper size in "Microsoft Print to PDF" printer, but the problem persists, (see attached files). Test_PrintOut_Method.pdf Test_ExportAsFixedFormat_Method.pdf So how to fix this issue? Thanks |
#2
|
||||
|
||||
I'm guessing that the default paper size for that particular printer driver must be set to US Letter instead of A4.
Have you had a look at the default Printer Settings in Windows for that driver?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with page number printout on booklet file in word2007 | kenbrash | Word | 5 | 09-12-2023 03:59 PM |
worksheet row to print on two or more printout lines | rh62 | Excel | 1 | 06-18-2017 12:55 PM |
The best practice to print 20,000 rows of 6-columns each in pdf landscape A3 page size while to repe | Majdoleen | Excel | 0 | 04-25-2017 01:02 PM |
Want to print a file on a page size of 4.25"x5.5" | noname | Word | 1 | 11-23-2014 10:55 PM |
vba word 2003: printout prints only the first page of the file | kar64 | Word VBA | 2 | 02-15-2013 02:42 PM |