6 Replies Latest reply on Jan 16, 2018 11:48 AM by Joel_Geraci

    addWaterMarkFromText embed same font multiple times


      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


                      'Bates Number
                      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!