Hi, I am trying to use Excel VBA to add some text to the bottom of some PDF files. Everything works great, except that the file size is extremely large after calling addWaterMarkFromText multiple times.
|Call jso.addWaterMarkFromText(Replace(oSetting.Confidentiality, "\r", vbCrLf), jso.app.Constants.Align.Left, _|
|jso.Font.Helv, 11, _|
|jso.Color.Black, 0, intPgCount - 1, True, True, True, _|
|jso.app.Constants.Align.Left, jso.app.Constants.Align.Bottom, _|
|5, 5, False, 1, False, 0, 1)|
|For i = 0 To intPgCount|
|strBatesNumber = strPrefix + Format(i, "00000")|
|Call jso.addWaterMarkFromText(strBatesNumber, jso.app.Constants.Align.Right, _|
|jso.Font.Helv, 11, _|
|jso.Color.Black, i, i, True, True, True, _|
|jso.app.Constants.Align.Right, jso.app.Constants.Align.Bottom, _|
|-5, 5, False, 1, False, 0, 1)|
The script will add the same text to the bottom left, and different page number to the bottom right of each page.
The code that add the same text to the bottom left only increase the file size by maybe 500k, which is totally fine. But the code to add different page number inside the for loop will increase the file size by about 500K every time it is called. So a 28 page file will come out to be 15MB (original size is 200K).
Is there a way to do it so that Adobe will reuse the existing font and not embedding the same font for each addWaterMarkFromText call? I am using font.Helv, which I assume is built in and don't even need to be embedded.
If I open the PDF in Adobe and save as another PDF, the file size will shrink significanly to about 1MB, so it seemed to consolidate the same font at that. But I don't know how to do that VBA.
Any help is greatly appreciated!
I would suggest adding form fields to every page with the bates number, then flattening them all out, and performing a saveAs, which will clean up an residue from adding the form fields.
I was going to go with addField option, then I saw that the font didn't get embedded multiple time if I used Font.CourB, or Font.Cour and the file size didn't get blown up like Font.Helv. So I am ok for now (until I need to use a different font )
Type 1 fonts are all built-in. So in a way they are always pre-embedded
Thom: I think you mean the base 16, not Type 1.
Ahh! I missed it But you are only partially correct. I believe they are the Base 14 fonts, because there are 14 of them