How to reduce file size produced by Microsoft Print to PDF?
To add on to dsungaro's answer referencing the microsoft article, here are the code additions I made to successfully add resolution options.
Print to pdf Resolution options
*Option: ResOption2
{
*Name: "400 x 400"
*PrintSchemaNamespace: "http://schemas.microsoft.com/windows/2015/02/printing/printschemakeywords/microsoftprinttopdf"
*SpotDiameter: 100
*DPI: PAIR(400, 400)
*TextDPI: PAIR(400, 400)
}
*Option: ResOption3
{
*Name: "300 x 300"
*PrintSchemaNamespace: "http://schemas.microsoft.com/windows/2015/02/printing/printschemakeywords/microsoftprinttopdf"
*SpotDiameter: 100
*DPI: PAIR(300, 300)
*TextDPI: PAIR(300, 300)
}
*Option: ResOption4
{
*Name: "200 x 200"
*PrintSchemaNamespace: "http://schemas.microsoft.com/windows/2015/02/printing/printschemakeywords/microsoftprinttopdf"
*SpotDiameter: 100
*DPI: PAIR(200, 200)
*TextDPI: PAIR(200, 200)
}
This is added to the .gpd file below the following code
*Option: ResOption1
{
*Name: "600 x 600"
*PrintSchemaNamespace: "http://schemas.microsoft.com/windows/2015/02/printing/printschemakeywords/microsoftprinttopdf"
*SpotDiameter: 100
*DPI: PAIR(600, 600)
*TextDPI: PAIR(600, 600)
}
And this is the code added to the pdc file
<ns0000:ResOption2 psf2:psftype="Option" psf2:default="false">
<psk:ResolutionX psf2:psftype="ScoredProperty" xsi:type="xsd:integer">400</psk:ResolutionX>
<psk:ResolutionY psf2:psftype="ScoredProperty" xsi:type="xsd:integer">400</psk:ResolutionY>
</ns0000:ResOption2>
<ns0000:ResOption3 psf2:psftype="Option" psf2:default="false">
<psk:ResolutionX psf2:psftype="ScoredProperty" xsi:type="xsd:integer">300</psk:ResolutionX>
<psk:ResolutionY psf2:psftype="ScoredProperty" xsi:type="xsd:integer">300</psk:ResolutionY>
</ns0000:ResOption3>
<ns0000:ResOption4 psf2:psftype="Option" psf2:default="false">
<psk:ResolutionX psf2:psftype="ScoredProperty" xsi:type="xsd:integer">200</psk:ResolutionX>
<psk:ResolutionY psf2:psftype="ScoredProperty" xsi:type="xsd:integer">200</psk:ResolutionY>
</ns0000:ResOption4>
right after this code
<ns0000:ResOption1 psf2:psftype="Option" psf2:default="true">
<psk:ResolutionX psf2:psftype="ScoredProperty" xsi:type="xsd:integer">600</psk:ResolutionX>
<psk:ResolutionY psf2:psftype="ScoredProperty" xsi:type="xsd:integer">600</psk:ResolutionY>
</ns0000:ResOption1>
I found that Microsoft Print to PDF will give 300k+ file size, but using "save as pdf" will actually give files around 50k. It only saves the current sheet (for example if you have more than a sheet in a workbook) but you can select otherwise by clicking "options" after doing "save as" and selecting "pdf" in the drop down of file types. All in all, checking the properties of the 2 files in Acrobat, the difference of length might be due to the fonts that Msft embeds while saving or printing... They are different. Saving as PDF yielded True Type fonts being embedded, whereas printing to PDF yielded True Type (CID) fonts. You can check in Properties and select the "Fonts" tab.
I found out that the "Microsoft Print to PDF" printer can be tricked into using a lower resolution than 600x600 DPI. Follow the instructions here, but do not add a paper size, but change the resolution (almost at the end of the two files) from 600x600 to 300x300 or even 150x150. Then the resulting file size is smaller.
An alternative is the Win2PDF printer, where one can set the resolution using the printer settings dialog.