none
SaveAs PDF options RRS feed

  • Question

  • Hi,
    somebody knows how can we specify the PDF options when saving a document in PDF format programmatically (WdSaveFormat.wdFormatPDF). These options we can see when manually open Word and selecting "Save As -> PDF or XPS" menu item. Then there is "Options" button with additional options. Specifically I need the "ISO 19005-1 compliant (PDF/A)" option. It seems that when saving PDF programmatically, this option is unchecked. And this causes problems on some documents. Some software (e.g. Ghostscript) cannot work with some  of such PDF.

    Thanks,
    Constantine.


    Tuesday, May 6, 2008 12:58 PM

Answers

  • Hi Constantine,

     

    I record a Macro, save a document into pdf in both scenario, the "ISO 19005-1 compliant" option on and off.

    See the following different Macro codes. Instead of SaveAs method, we use Document.ExportAsFixedFormat method to do that.

     

    Code Snippet

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    '

        ActiveDocument.ExportAsFixedFormat OutputFileName:= _
            "C:\Users\v-jzho\Desktop\Doc1.pdf", ExportFormat:=wdExportFormatPDF, _
            OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
            wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
            IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
            wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
            True, UseISO19005_1:=True
       
       
        ActiveDocument.ExportAsFixedFormat OutputFileName:= _
            "C:\Users\v-jzho\Desktop\Doc2.pdf", ExportFormat:=wdExportFormatPDF, _
            OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
            wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
            IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
            wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
            True, UseISO19005_1:=False
    End Sub

     

     

     

    So, I think you can specify the last parameter to achieve what you want. Hope this helps.

     

     

    Thanks,

    ji

     

    Friday, May 9, 2008 3:14 AM
    Moderator

All replies

  • Please see this message thread where this question has come up before.

     

    Tuesday, May 6, 2008 1:26 PM
    Moderator
  • Hi Constantine,

     

    I record a Macro, save a document into pdf in both scenario, the "ISO 19005-1 compliant" option on and off.

    See the following different Macro codes. Instead of SaveAs method, we use Document.ExportAsFixedFormat method to do that.

     

    Code Snippet

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    '

        ActiveDocument.ExportAsFixedFormat OutputFileName:= _
            "C:\Users\v-jzho\Desktop\Doc1.pdf", ExportFormat:=wdExportFormatPDF, _
            OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
            wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
            IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
            wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
            True, UseISO19005_1:=True
       
       
        ActiveDocument.ExportAsFixedFormat OutputFileName:= _
            "C:\Users\v-jzho\Desktop\Doc2.pdf", ExportFormat:=wdExportFormatPDF, _
            OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
            wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
            IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
            wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
            True, UseISO19005_1:=False
    End Sub

     

     

     

    So, I think you can specify the last parameter to achieve what you want. Hope this helps.

     

     

    Thanks,

    ji

     

    Friday, May 9, 2008 3:14 AM
    Moderator