Trouble shooting PDF output

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Harris

    Trouble shooting PDF output

    Access XP
    WinXP
    Adobe Acrobat 5.0

    I'm playing with Keri Hardwick's "Save a report's output as a PDF file" and
    most of it still works. The problem is the ChangePdfFileNa me is not changing
    the file name and it is storing the file in "My Documents" with the standard
    report name. What appears to be going on is that the PDFWriter is not
    reading the PDFFilename from the Win.ini. It's reading the PDFFilename value
    from the registry if it exsists. If it doesn't exsist it just uses default
    values which I don't want.
    Here is the code so far:
    [color=blue][color=green][color=darkred]
    >>>Start Code[/color][/color][/color]

    Option Compare Database
    Option Explicit
    ' These functions used with procedures from
    ' Microsoft Access 95 How-To
    '(c) 1998 Ken Getz and Paul Litwin
    ' All rights reserved.

    Private drexisting As aht_tagDeviceRe c
    Const AcrobatName = "Acrobat PDFWriter"
    Const AcrobatDriver = "PDFWRITR"
    Const AcrobatPort = "LPT1:"
    Sub ResetDefaultPri nter()
    Call ahtSetDefaultPr inter(drexistin g)
    End Sub
    Function ChangeToAcrobat ()
    If ahtGetDefaultPr inter(drexistin g) Then
    Dim dr As aht_tagDeviceRe c
    With dr
    .drDeviceName = AcrobatName
    .drDriverName = AcrobatDriver
    .drPort = AcrobatPort
    End With
    Call ahtSetDefaultPr inter(dr)
    End If
    End Function

    Sub ChangePdfFileNa me(NewFileName As String)
    Call aht_apiWritePro fileString("Acr obat PDFWriter", "PDFFileNam e",
    NewFileName)
    End Sub
    [color=blue][color=green][color=darkred]
    >>>And Here is the trigger for the whole thing:[/color][/color][/color]

    Private Sub Command6_Click( )
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "RptDailyPD F"
    DoCmd.Close acReport, "RptDailyPD F"
    stLinkCriteria = "[ACCT#] = " & "'" & Me![ACCT#] & "'" & "and " &
    "[WSDate1] = " & "'" & Me![WSDate1] & "'"

    ChangeToAcrobat
    ChangePdfFileNa me ([ACCT#] & Format([WSDate1], "yyyymmdd") & ".PDF")
    DoCmd.OpenRepor t stDocName, acViewNormal, , stLinkCriteria
    ResetDefaultPri nter

    End Sub
    [color=blue][color=green][color=darkred]
    >>>End code[/color][/color][/color]

    Everything works except the file rename like I described. Any help is
    appriciated. Also, I haven't posted any questions in a very long time so if
    I've stepped on toes or violated a FAQ rule somewhere, just let me know and
    I'll reform my ways.

    Thanks,

    Michael Harris


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003


  • Alphonse Giambrone

    #2
    Re: Trouble shooting PDF output

    For Win NT, 2K, XP PDFWriter stores the file name in the registry, not in
    the ini file.
    Check the Acrobat SDK for the key.

    --

    Alphonse Giambrone
    Email: a-giam at customdatasolut ions dot us


    "Michael Harris" <michaelbharris @comcast.net> wrote in message
    news:vBznb.5206 7$HS4.235982@at tbi_s01...[color=blue]
    > Access XP
    > WinXP
    > Adobe Acrobat 5.0
    >
    > I'm playing with Keri Hardwick's "Save a report's output as a PDF file"[/color]
    and[color=blue]
    > most of it still works. The problem is the ChangePdfFileNa me is not[/color]
    changing[color=blue]
    > the file name and it is storing the file in "My Documents" with the[/color]
    standard[color=blue]
    > report name. What appears to be going on is that the PDFWriter is not
    > reading the PDFFilename from the Win.ini. It's reading the PDFFilename[/color]
    value[color=blue]
    > from the registry if it exsists. If it doesn't exsist it just uses default
    > values which I don't want.
    > Here is the code so far:
    >[color=green][color=darkred]
    > >>>Start Code[/color][/color]
    >
    > Option Compare Database
    > Option Explicit
    > ' These functions used with procedures from
    > ' Microsoft Access 95 How-To
    > '(c) 1998 Ken Getz and Paul Litwin
    > ' All rights reserved.
    >
    > Private drexisting As aht_tagDeviceRe c
    > Const AcrobatName = "Acrobat PDFWriter"
    > Const AcrobatDriver = "PDFWRITR"
    > Const AcrobatPort = "LPT1:"
    > Sub ResetDefaultPri nter()
    > Call ahtSetDefaultPr inter(drexistin g)
    > End Sub
    > Function ChangeToAcrobat ()
    > If ahtGetDefaultPr inter(drexistin g) Then
    > Dim dr As aht_tagDeviceRe c
    > With dr
    > .drDeviceName = AcrobatName
    > .drDriverName = AcrobatDriver
    > .drPort = AcrobatPort
    > End With
    > Call ahtSetDefaultPr inter(dr)
    > End If
    > End Function
    >
    > Sub ChangePdfFileNa me(NewFileName As String)
    > Call aht_apiWritePro fileString("Acr obat PDFWriter", "PDFFileNam e",
    > NewFileName)
    > End Sub
    >[color=green][color=darkred]
    > >>>And Here is the trigger for the whole thing:[/color][/color]
    >
    > Private Sub Command6_Click( )
    > Dim stDocName As String
    > Dim stLinkCriteria As String
    >
    > stDocName = "RptDailyPD F"
    > DoCmd.Close acReport, "RptDailyPD F"
    > stLinkCriteria = "[ACCT#] = " & "'" & Me![ACCT#] & "'" & "and " &
    > "[WSDate1] = " & "'" & Me![WSDate1] & "'"
    >
    > ChangeToAcrobat
    > ChangePdfFileNa me ([ACCT#] & Format([WSDate1], "yyyymmdd") & ".PDF")
    > DoCmd.OpenRepor t stDocName, acViewNormal, , stLinkCriteria
    > ResetDefaultPri nter
    >
    > End Sub
    >[color=green][color=darkred]
    > >>>End code[/color][/color]
    >
    > Everything works except the file rename like I described. Any help is
    > appriciated. Also, I haven't posted any questions in a very long time so[/color]
    if[color=blue]
    > I've stepped on toes or violated a FAQ rule somewhere, just let me know[/color]
    and[color=blue]
    > I'll reform my ways.
    >
    > Thanks,
    >
    > Michael Harris
    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003
    >
    >[/color]


    Comment

    • SA

      #3
      Re: Trouble shooting PDF output

      Mike:

      Keri's code will not work on any machine with Acrobat 4.0 and above if the
      os is NT / 2K / Xp. That is because the PDFWriter specs are now stored in
      the registry on those os under HKCU\Software\A dobe\Acrobat PDFWriter.

      If you want to not flail around writing the code, check out our PDF and Mail
      Library for Access which can make outputting PDF files with PDF Writer,
      Distiller or any a number of other PDF drivers quite easy. You'll find it
      on our web in the developer tools section.

      HTH
      --
      Steve Arbaugh
      ACG Soft


      "Michael Harris" <michaelbharris @comcast.net> wrote in message
      news:vBznb.5206 7$HS4.235982@at tbi_s01...[color=blue]
      > Access XP
      > WinXP
      > Adobe Acrobat 5.0
      >
      > I'm playing with Keri Hardwick's "Save a report's output as a PDF file"[/color]
      and[color=blue]
      > most of it still works. The problem is the ChangePdfFileNa me is not[/color]
      changing[color=blue]
      > the file name and it is storing the file in "My Documents" with the[/color]
      standard[color=blue]
      > report name. What appears to be going on is that the PDFWriter is not
      > reading the PDFFilename from the Win.ini. It's reading the PDFFilename[/color]
      value[color=blue]
      > from the registry if it exsists. If it doesn't exsist it just uses default
      > values which I don't want.
      > Here is the code so far:
      >[color=green][color=darkred]
      > >>>Start Code[/color][/color]
      >
      > Option Compare Database
      > Option Explicit
      > ' These functions used with procedures from
      > ' Microsoft Access 95 How-To
      > '(c) 1998 Ken Getz and Paul Litwin
      > ' All rights reserved.
      >
      > Private drexisting As aht_tagDeviceRe c
      > Const AcrobatName = "Acrobat PDFWriter"
      > Const AcrobatDriver = "PDFWRITR"
      > Const AcrobatPort = "LPT1:"
      > Sub ResetDefaultPri nter()
      > Call ahtSetDefaultPr inter(drexistin g)
      > End Sub
      > Function ChangeToAcrobat ()
      > If ahtGetDefaultPr inter(drexistin g) Then
      > Dim dr As aht_tagDeviceRe c
      > With dr
      > .drDeviceName = AcrobatName
      > .drDriverName = AcrobatDriver
      > .drPort = AcrobatPort
      > End With
      > Call ahtSetDefaultPr inter(dr)
      > End If
      > End Function
      >
      > Sub ChangePdfFileNa me(NewFileName As String)
      > Call aht_apiWritePro fileString("Acr obat PDFWriter", "PDFFileNam e",
      > NewFileName)
      > End Sub
      >[color=green][color=darkred]
      > >>>And Here is the trigger for the whole thing:[/color][/color]
      >
      > Private Sub Command6_Click( )
      > Dim stDocName As String
      > Dim stLinkCriteria As String
      >
      > stDocName = "RptDailyPD F"
      > DoCmd.Close acReport, "RptDailyPD F"
      > stLinkCriteria = "[ACCT#] = " & "'" & Me![ACCT#] & "'" & "and " &
      > "[WSDate1] = " & "'" & Me![WSDate1] & "'"
      >
      > ChangeToAcrobat
      > ChangePdfFileNa me ([ACCT#] & Format([WSDate1], "yyyymmdd") & ".PDF")
      > DoCmd.OpenRepor t stDocName, acViewNormal, , stLinkCriteria
      > ResetDefaultPri nter
      >
      > End Sub
      >[color=green][color=darkred]
      > >>>End code[/color][/color]
      >
      > Everything works except the file rename like I described. Any help is
      > appriciated. Also, I haven't posted any questions in a very long time so[/color]
      if[color=blue]
      > I've stepped on toes or violated a FAQ rule somewhere, just let me know[/color]
      and[color=blue]
      > I'll reform my ways.
      >
      > Thanks,
      >
      > Michael Harris
      >
      >
      > ---
      > Outgoing mail is certified Virus Free.
      > Checked by AVG anti-virus system (http://www.grisoft.com).
      > Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003
      >
      >[/color]


      Comment

      • Michael Harris

        #4
        Re: Trouble shooting PDF output

        Thanks to both of you for your responses.

        Ok, yes I've figured that out. So I guess what I need to know now is how do
        I add the registry key from Access? I already know SaveSetting won't work.
        Any other ideas?


        "SA" <~fake.address@ nspm.com> wrote in message
        news:bnolsk$d21 $1@ngspool-d02.news.aol.co m...[color=blue]
        > Mike:
        >
        > Keri's code will not work on any machine with Acrobat 4.0 and above if the
        > os is NT / 2K / Xp. That is because the PDFWriter specs are now stored in
        > the registry on those os under HKCU\Software\A dobe\Acrobat PDFWriter.
        >
        > If you want to not flail around writing the code, check out our PDF and[/color]
        Mail[color=blue]
        > Library for Access which can make outputting PDF files with PDF Writer,
        > Distiller or any a number of other PDF drivers quite easy. You'll find it
        > on our web in the developer tools section.
        >
        > HTH
        > --
        > Steve Arbaugh
        > ACG Soft
        > http://ourworld.compuserve.com/homepages/attac-cg
        >
        > "Michael Harris" <michaelbharris @comcast.net> wrote in message
        > news:vBznb.5206 7$HS4.235982@at tbi_s01...[color=green]
        > > Access XP
        > > WinXP
        > > Adobe Acrobat 5.0
        > >
        > > I'm playing with Keri Hardwick's "Save a report's output as a PDF file"[/color]
        > and[color=green]
        > > most of it still works. The problem is the ChangePdfFileNa me is not[/color]
        > changing[color=green]
        > > the file name and it is storing the file in "My Documents" with the[/color]
        > standard[color=green]
        > > report name. What appears to be going on is that the PDFWriter is not
        > > reading the PDFFilename from the Win.ini. It's reading the PDFFilename[/color]
        > value[color=green]
        > > from the registry if it exsists. If it doesn't exsist it just uses[/color][/color]
        default[color=blue][color=green]
        > > values which I don't want.
        > > Here is the code so far:
        > >[color=darkred]
        > > >>>Start Code[/color]
        > >
        > > Option Compare Database
        > > Option Explicit
        > > ' These functions used with procedures from
        > > ' Microsoft Access 95 How-To
        > > '(c) 1998 Ken Getz and Paul Litwin
        > > ' All rights reserved.
        > >
        > > Private drexisting As aht_tagDeviceRe c
        > > Const AcrobatName = "Acrobat PDFWriter"
        > > Const AcrobatDriver = "PDFWRITR"
        > > Const AcrobatPort = "LPT1:"
        > > Sub ResetDefaultPri nter()
        > > Call ahtSetDefaultPr inter(drexistin g)
        > > End Sub
        > > Function ChangeToAcrobat ()
        > > If ahtGetDefaultPr inter(drexistin g) Then
        > > Dim dr As aht_tagDeviceRe c
        > > With dr
        > > .drDeviceName = AcrobatName
        > > .drDriverName = AcrobatDriver
        > > .drPort = AcrobatPort
        > > End With
        > > Call ahtSetDefaultPr inter(dr)
        > > End If
        > > End Function
        > >
        > > Sub ChangePdfFileNa me(NewFileName As String)
        > > Call aht_apiWritePro fileString("Acr obat PDFWriter", "PDFFileNam e",
        > > NewFileName)
        > > End Sub
        > >[color=darkred]
        > > >>>And Here is the trigger for the whole thing:[/color]
        > >
        > > Private Sub Command6_Click( )
        > > Dim stDocName As String
        > > Dim stLinkCriteria As String
        > >
        > > stDocName = "RptDailyPD F"
        > > DoCmd.Close acReport, "RptDailyPD F"
        > > stLinkCriteria = "[ACCT#] = " & "'" & Me![ACCT#] & "'" & "and " &
        > > "[WSDate1] = " & "'" & Me![WSDate1] & "'"
        > >
        > > ChangeToAcrobat
        > > ChangePdfFileNa me ([ACCT#] & Format([WSDate1], "yyyymmdd") & ".PDF")
        > > DoCmd.OpenRepor t stDocName, acViewNormal, , stLinkCriteria
        > > ResetDefaultPri nter
        > >
        > > End Sub
        > >[color=darkred]
        > > >>>End code[/color]
        > >
        > > Everything works except the file rename like I described. Any help is
        > > appriciated. Also, I haven't posted any questions in a very long time so[/color]
        > if[color=green]
        > > I've stepped on toes or violated a FAQ rule somewhere, just let me know[/color]
        > and[color=green]
        > > I'll reform my ways.
        > >
        > > Thanks,
        > >
        > > Michael Harris
        > >
        > >
        > > ---
        > > Outgoing mail is certified Virus Free.
        > > Checked by AVG anti-virus system (http://www.grisoft.com).
        > > Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003
        > >
        > >[/color]
        >
        >[/color]


        ---
        Outgoing mail is certified Virus Free.
        Checked by AVG anti-virus system (http://www.grisoft.com).
        Version: 6.0.532 / Virus Database: 326 - Release Date: 10/28/2003


        Comment

        Working...