PDA

View Full Version : [SOLVED:] silent print to PDF



aresthegod
08-04-2020, 04:18 AM
I am looking for help as I am not a programmer. I would like to be able to do the following:



to silently pdf the open Word document (no dialogues)
the output file name the same as the input file name
the output folder the same the input folder
automatically overwrite if the pdf file already exists
photographs in the text not downsized below 600 dpi


There is a code (see below) that does all of the above but the last point . It uses "save as" function in MS Word which reduces the dpi of photographs to too low level. For the documents with photographs I need to manually use the "Microsoft print to PDF" which gives decent quality of pictures.

A macro that prints using the "Microsoft print to PDF" meeting all of the criteria above points would be great. Could anybody help ?

Sub Silent_save_to_PDF()
'
' Silent Save_to_PDF Macro
'
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
Replace(ActiveDocument.FullName, ".docx", ".pdf") , _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, Item:= _
wdExportDocumentContent, IncludeDocProps:=False, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
End Sub

gmayor
08-04-2020, 05:37 AM
The following two images are from a document that contains a high resolution image. The first image was printed to pdf, the other saved using your macro. Both are at 800% zoom view in Adobe Acrobat. I doubt anyone would discern any difference at 100%.

26943 26944

aresthegod
08-04-2020, 07:28 AM
Thanks for the reply. Indeed, the difference is not big for graphics but it is significant for text. My photographs often contain text. Laboratory sample labels etc. I compare my outcomes below.

top: Save as with macro, pdf file size 100kb, mag. 800x in Acrobat reader
bottom: Microsoft print to pdf, pdf file size 160kb, magnification 800x in Adobe reader

26945
Original MS Word document file size: 10 Mb

gmayor
08-04-2020, 08:17 PM
Maybe https://www.gmayor.com/pdfcreator_addin.htm will help?

aresthegod
08-05-2020, 04:55 AM
Thanks a lot ! It works perfect.
Exactly what I was looking for.