Programming to "Print" using CUTE PDF!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Baker

    Programming to "Print" using CUTE PDF!

    HI;

    I feel like a fool..I put CUTE FTP in my last request for help --it should have been CUTE
    PDF! I have FTP on my mind because I have been working on a web based application, and
    somehow my brain got stuck on it..sorry!

    Hi:

    I need some help writing code that will "print" a report using Cute PDF.

    Specifically, I need to set up a "Button" which, when clicked, will:


    a. Create an PDF "Print" file of the report using Cute PDF. The file needs to be given a
    unique name based on data that will be in the report and on the query that generates the
    report.

    b. Store the result in a predefined folder..

    I really would appreciate some pointers as to how to do this using MS Access 2000. The
    application will be running on W98, 2000 and WXP!

    Thanks in advance for any help you can give me.

    Regards

    John Baker


  • Albert D. Kallal

    #2
    Re: Programming to "Print&quo t; using CUTE PDF!

    That pdf creator does not supprot automation..and thus you can't set the
    file name as far as I know...



    --
    Albert D. Kallal (MVP)
    Edmonton, Alberta Canada
    pleasenonoSpamK allal@msn.com



    Comment

    • John Baker

      #3
      Re: Programming to "Print&quo t; using CUTE PDF!

      Thanks for that info.

      Do you know if any of the other PDF writers support automation? If so which one? I gather
      some version of Adobe does, but am uncertain how this works or which version.

      Any follow up info you could provide would be appreciated. If I have to buy a PDF writer I
      certainly want to support automation with it.

      Best Regards

      John Baker

      "Albert D. Kallal" <kallal@msn.com > wrote:
      [color=blue]
      >That pdf creator does not supprot automation..and thus you can't set the
      >file name as far as I know...[/color]

      Comment

      • Tony Toews

        #4
        Re: Programming to &quot;Print&quo t; using CUTE PDF!

        John Baker <Baker.JH@Veriz on.net> wrote:
        [color=blue]
        >Do you know if any of the other PDF writers support automation? If so which one? I gather
        >some version of Adobe does, but am uncertain how this works or which version.[/color]

        There's a list of such Creating PDF files from within Microsoft Access


        Tony
        --
        Tony Toews, Microsoft Access MVP
        Please respond only in the newsgroups so that others can
        read the entire thread of messages.
        Microsoft Access Links, Hints, Tips & Accounting Systems at

        Comment

        • Steve Jorgensen

          #5
          Re: Programming to &quot;Print&quo t; using CUTE PDF!

          Cool - I didn't know about the new GPL PDF Creator. I've used
          RedMon/Ghostscript successfully, but it does take some time to set up
          properly.

          On Fri, 30 Apr 2004 02:18:58 GMT, Tony Toews <ttoews@teluspl anet.net> wrote:
          [color=blue]
          >John Baker <Baker.JH@Veriz on.net> wrote:
          >[color=green]
          >>Do you know if any of the other PDF writers support automation? If so which one? I gather
          >>some version of Adobe does, but am uncertain how this works or which version.[/color]
          >
          >There's a list of such Creating PDF files from within Microsoft Access
          >http://www.granite.ab.ca/access/pdffiles.htm
          >
          >Tony[/color]

          Comment

          • TR

            #6
            Re: Programming to &quot;Print&quo t; using CUTE PDF!

            FinePrint's PDFFactory can be printed to prgammatially from Access. Not really via automation,
            but you can use VBA to set registry values to provide filenames/locations and print 'silently'
            without user intervention. Works very well.


            John Baker wrote:
            [color=blue]
            > Thanks for that info.
            >
            > Do you know if any of the other PDF writers support automation? If so which one? I gather
            > some version of Adobe does, but am uncertain how this works or which version.
            >
            > Any follow up info you could provide would be appreciated. If I have to buy a PDF writer I
            > certainly want to support automation with it.
            >
            > Best Regards
            >
            > John Baker
            >
            > "Albert D. Kallal" <kallal@msn.com > wrote:
            >[color=green]
            > >That pdf creator does not supprot automation..and thus you can't set the
            > >file name as far as I know...[/color][/color]

            Comment

            • John Baker

              #7
              Re: Programming to &quot;Print&quo t; using CUTE PDF!

              TR:

              Thanks for that info.

              Have you used PDFFactory that way? Are there detailed code instructions as to how to set
              it up? I'm not highly skilled in VBA, and need a "cook book" to do things like that.
              PDFFactory appears to be the least expensive solution that is capable of being controlled
              through Access ($109.95), but I want to be certain I can set it up properly before I
              invest in it.

              Regards

              John Baker

              TR <t_NoSpam_redic k@Mind_NoSpam_s pring.com> wrote:
              [color=blue]
              >FinePrint's PDFFactory can be printed to prgammatially from Access. Not really via automation,
              >but you can use VBA to set registry values to provide filenames/locations and print 'silently'
              >without user intervention. Works very well.
              >www.fineprint.com
              >
              >John Baker wrote:
              >[color=green]
              >> Thanks for that info.
              >>
              >> Do you know if any of the other PDF writers support automation? If so which one? I gather
              >> some version of Adobe does, but am uncertain how this works or which version.
              >>
              >> Any follow up info you could provide would be appreciated. If I have to buy a PDF writer I
              >> certainly want to support automation with it.
              >>
              >> Best Regards
              >>
              >> John Baker
              >>
              >> "Albert D. Kallal" <kallal@msn.com > wrote:
              >>[color=darkred]
              >> >That pdf creator does not supprot automation..and thus you can't set the
              >> >file name as far as I know...[/color][/color][/color]

              Comment

              • John Baker

                #8
                Re: Programming to &quot;Print&quo t; using CUTE PDF!

                Thanks Tony, a very useful site. However some of the downloads don't appear to work, which
                is a snag.

                Best

                John

                Tony Toews <ttoews@teluspl anet.net> wrote:
                [color=blue]
                >John Baker <Baker.JH@Veriz on.net> wrote:
                >[color=green]
                >>Do you know if any of the other PDF writers support automation? If so which one? I gather
                >>some version of Adobe does, but am uncertain how this works or which version.[/color]
                >
                >There's a list of such Creating PDF files from within Microsoft Access
                >http://www.granite.ab.ca/access/pdffiles.htm
                >
                >Tony[/color]

                Comment

                • TR

                  #9
                  Re: Programming to &quot;Print&quo t; using CUTE PDF!

                  There is some information here:


                  Basically you are just setting registry values, and then your report can be preset to print to
                  PDFFactory (the basic version is only 49.95?)
                  Here is a function that I have used. I edited out some stuff specific to my use, and it calls some
                  registry functions from the Access Developers Handbook that I have not included(but you could
                  substitute any similar functions, there are many examples available on the net). Hopefully you can
                  get an idea of whats involved from this.

                  Private Function PrintToPDF()
                  'Purpose : uses a recordset to print individual reports to pdf files
                  'Comments : requires Fineprint PDF printer,
                  ' and a report with Fineprint PDF printer set,
                  ' selected items are written out to the selected items table
                  ' a recordset is used to group the selected item on the appropriate field
                  ' so that a seperate report can be printed.
                  'Parameters:
                  'Sets :
                  'Returns :
                  'Created by:
                  'Created : 03/25/2002 4:05:12 PM
                  'Modified : 03/25/2002 4:05:12 PM

                  On Error GoTo PrintToPDF_ERR

                  Dim dbs As Database
                  Dim rstFaxList As Recordset
                  Dim strSQL As String
                  Dim tblPickedItems As String
                  Dim strScheduleTabl e As String
                  Dim intFaxCount As Integer
                  Dim intFaxDone As Integer
                  Dim lngRetVal As adhRegErrors
                  Dim strRegValue As Variant
                  Dim strCurrentPDFOu tput As String
                  Dim varCurrentPDFSh owDlg As Variant
                  Dim strUserPDFOutpu t As String
                  Dim strDefOutputFil e As String
                  Dim strNewOutputFil e As String

                  'save users current default pdf output path
                  strRegValue = Space(adhcMaxDa taSize)
                  lngRetVal = adh_accRegGetVa l(adhcHKEY_CURR ENT_USER, _
                  "Software\FineP rint Software\pdfFac tory", _
                  "AutoSaveDi r", strRegValue, Len(strRegValue ))
                  If lngRetVal = adhcAccErrSucce ss Then
                  strCurrentPDFOu tput = strRegValue
                  Else
                  'no defined output, assume no pdf factory installed
                  MsgBox "You do not have PDF Factory installed, cannot print to PDF"
                  GoTo PrintToPDF_EXIT
                  End If

                  'save users current default pdf output view
                  strRegValue = Space(adhcMaxDa taSize)
                  lngRetVal = adh_accRegGetVa l(adhcHKEY_CURR ENT_USER, _
                  "Software\FineP rint Software\pdfFac tory\FinePrinte rs\FinePrint
                  pdfFactory\Prin terDriverData", _
                  "ShowDlg", strRegValue, Len(strRegValue ))
                  If lngRetVal = adhcAccErrSucce ss Then
                  varCurrentPDFSh owDlg = Asc(Mid(strRegV alue, 1, 1))
                  Else
                  'no defined output, assume no pdf factory installed
                  MsgBox "You do not have PDF Factory installed, cannot print to PDF"
                  GoTo PrintToPDF_EXIT
                  End If

                  'set output path for pdf files
                  strUserPDFOutpu t = GetPathPart_TSB (CStr(CurrentDb .Name)) & "PDF_" & CurrentUser() & "_" &
                  Format(Now(), "yyyymmdd_hhnns s")
                  MkDir strUserPDFOutpu t
                  lngRetVal = adh_accRegWrite Val( _
                  adhcHKEY_CURREN T_USER, _
                  "Software\FineP rint Software\pdfFac tory", _
                  "AutoSaveDi r", strUserPDFOutpu t, adhcREG_SZ)
                  If lngRetVal = adhcAccErrSucce ss Then
                  'ok
                  Else
                  MsgBox "Unable to set required parameters, cannot print to PDF"
                  GoTo PrintToPDF_EXIT
                  End If

                  'set dialog mode to silent
                  lngRetVal = adh_accRegWrite Val( _
                  adhcHKEY_CURREN T_USER, _
                  "Software\FineP rint Software\pdfFac tory\FinePrinte rs\FinePrint
                  pdfFactory\Prin terDriverData", _
                  "ShowDlg", 4, adhcREG_DWORD)
                  If lngRetVal = adhcAccErrSucce ss Then
                  'ok
                  Else
                  MsgBox "Unable to set required parameters, cannot print to PDF"
                  GoTo PrintToPDF_EXIT
                  End If

                  'get recordset of sites to print
                  Set dbs = CurrentDb()
                  strSQL = "SELECT DISTINCT siteno From tblSites "
                  Set rstFaxList = dbs.OpenRecords et(strSQL, dbOpenSnapshot, dbReadOnly)
                  If Not rstFaxList.EOF And Not rstFaxList.BOF Then
                  rstFaxList.Move Last
                  rstFaxList.Move First
                  intFaxCount = rstFaxList.Reco rdCount
                  End If
                  intFaxDone = 0
                  ' for each siteno in recordset
                  Do Until rstFaxList.EOF
                  'set output filename via pdfFacory key
                  'the key is erased by pdfFactory after file is created
                  'print report for siteno
                  strNewOutputFil e = strUserPDFOutpu t & "\Site_Schedule r_Report(Site " & rstFaxList!site no &
                  ").PDF"
                  lngRetVal = adh_accRegWrite Val( _
                  adhcHKEY_CURREN T_USER, _
                  "Software\FineP rint Software\pdfFac tory", _
                  "OutputFile ", strNewOutputFil e, adhcREG_SZ)
                  If lngRetVal = adhcAccErrSucce ss Then
                  'ok
                  Else
                  MsgBox "Unable to set output file (" & strNewOutputFil e & "), cannot print to PDF"
                  GoTo PrintToPDF_EXIT
                  End If
                  DoCmd.OpenRepor t "rptScheduler_P DF", acViewNormal, , "siteno = '" & rstFaxList!site no & "'"

                  DoEvents
                  'there is some time lag between printing, and erasing the ouput file key
                  'loop here until outputfile key no longer found
                  strRegValue = Space(adhcMaxDa taSize)
                  lngRetVal = adhcAccErrSucce ss
                  Do Until lngRetVal <> adhcAccErrSucce ss
                  DoEvents
                  lngRetVal = adh_accRegGetVa l(adhcHKEY_CURR ENT_USER, _
                  "Software\FineP rint Software\pdfFac tory", _
                  "OutputFile ", strRegValue, Len(strRegValue ))
                  Loop
                  'next site
                  intFaxDone = intFaxDone + 1
                  rstFaxList.Move Next
                  Loop
                  'restore user's pdf settings for default output path and show dialog
                  lngRetVal = adh_accRegWrite Val( _
                  adhcHKEY_CURREN T_USER, _
                  "Software\FineP rint Software\pdfFac tory", _
                  "AutoSaveDi r", strCurrentPDFOu tput, adhcREG_SZ)
                  lngRetVal = adh_accRegWrite Val( _
                  adhcHKEY_CURREN T_USER, _
                  "Software\FineP rint Software\pdfFac tory\FinePrinte rs\FinePrint
                  pdfFactory\Prin terDriverData", _
                  "ShowDlg", varCurrentPDFSh owDlg, adhcREG_DWORD)

                  PrintToPDF_EXIT :
                  On Error Resume Next
                  If Not (rstFaxList Is Nothing) Then rstFaxList.Clos e: Set rstFaxList = Nothing
                  If Not (dbs Is Nothing) Then Set dbs = Nothing
                  Exit Function

                  PrintToPDF_ERR:
                  Select Case Err
                  Case 0 'insert Errors you wish to ignore here
                  Resume Next
                  Case Else 'All other errors will trap
                  Msgbox "Error: " & Err & ", " & Error,vbExclama tion,"Error in PrintToPDF"
                  Resume PrintToPDF_EXIT
                  End Select
                  End Function



                  John Baker wrote:
                  [color=blue]
                  > TR:
                  >
                  > Thanks for that info.
                  >
                  > Have you used PDFFactory that way? Are there detailed code instructions as to how to set
                  > it up? I'm not highly skilled in VBA, and need a "cook book" to do things like that.
                  > PDFFactory appears to be the least expensive solution that is capable of being controlled
                  > through Access ($109.95), but I want to be certain I can set it up properly before I
                  > invest in it.
                  >
                  > Regards
                  >
                  > John Baker
                  >
                  > TR <t_NoSpam_redic k@Mind_NoSpam_s pring.com> wrote:
                  >[color=green]
                  > >FinePrint's PDFFactory can be printed to prgammatially from Access. Not really via automation,
                  > >but you can use VBA to set registry values to provide filenames/locations and print 'silently'
                  > >without user intervention. Works very well.
                  > >www.fineprint.com
                  > >
                  > >John Baker wrote:
                  > >[color=darkred]
                  > >> Thanks for that info.
                  > >>
                  > >> Do you know if any of the other PDF writers support automation? If so which one? I gather
                  > >> some version of Adobe does, but am uncertain how this works or which version.
                  > >>
                  > >> Any follow up info you could provide would be appreciated. If I have to buy a PDF writer I
                  > >> certainly want to support automation with it.
                  > >>
                  > >> Best Regards
                  > >>
                  > >> John Baker
                  > >>
                  > >> "Albert D. Kallal" <kallal@msn.com > wrote:
                  > >>
                  > >> >That pdf creator does not supprot automation..and thus you can't set the
                  > >> >file name as far as I know...[/color][/color][/color]

                  Comment

                  • TR

                    #10
                    Re: Programming to &quot;Print&quo t; using CUTE PDF!

                    Also, I believe you can download a trial version and try this out as well.

                    John Baker wrote:
                    [color=blue]
                    > TR:
                    >
                    > Thanks for that info.
                    >
                    > Have you used PDFFactory that way? Are there detailed code instructions as to how to set
                    > it up? I'm not highly skilled in VBA, and need a "cook book" to do things like that.
                    > PDFFactory appears to be the least expensive solution that is capable of being controlled
                    > through Access ($109.95), but I want to be certain I can set it up properly before I
                    > invest in it.
                    >
                    > Regards
                    >
                    > John Baker
                    >
                    > TR <t_NoSpam_redic k@Mind_NoSpam_s pring.com> wrote:
                    >[color=green]
                    > >FinePrint's PDFFactory can be printed to prgammatially from Access. Not really via automation,
                    > >but you can use VBA to set registry values to provide filenames/locations and print 'silently'
                    > >without user intervention. Works very well.
                    > >www.fineprint.com
                    > >
                    > >John Baker wrote:
                    > >[color=darkred]
                    > >> Thanks for that info.
                    > >>
                    > >> Do you know if any of the other PDF writers support automation? If so which one? I gather
                    > >> some version of Adobe does, but am uncertain how this works or which version.
                    > >>
                    > >> Any follow up info you could provide would be appreciated. If I have to buy a PDF writer I
                    > >> certainly want to support automation with it.
                    > >>
                    > >> Best Regards
                    > >>
                    > >> John Baker
                    > >>
                    > >> "Albert D. Kallal" <kallal@msn.com > wrote:
                    > >>
                    > >> >That pdf creator does not supprot automation..and thus you can't set the
                    > >> >file name as far as I know...[/color][/color][/color]

                    Comment

                    • John Winterbottom

                      #11
                      Re: Programming to &quot;Print&quo t; using CUTE PDF!

                      "John Baker" <Baker.JH@Veriz on.net> wrote in message
                      news:de5390h3k2 ipa7e8o5rjgtl76 lb2359ve1@4ax.c om...[color=blue]
                      > Thanks for that info.
                      >
                      > Do you know if any of the other PDF writers support automation? If so[/color]
                      which one? I gather[color=blue]
                      > some version of Adobe does, but am uncertain how this works or which[/color]
                      version.[color=blue]
                      >
                      > Any follow up info you could provide would be appreciated. If I have to[/color]
                      buy a PDF writer I[color=blue]
                      > certainly want to support automation with it.
                      >[/color]


                      pdf995 stores output file name and folder info in an .ini file. All you need
                      to do is edit the .ini file in code. It's simple and very inexpensive..


                      Comment

                      • John Winterbottom

                        #12
                        Re: Programming to &quot;Print&quo t; using CUTE PDF!

                        "John Winterbottom" <assaynet@hotma il.com> wrote in message
                        news:c6ts95$g62 ac$1@ID-185006.news.uni-berlin.de...[color=blue]
                        > "John Baker" <Baker.JH@Veriz on.net> wrote in message
                        > news:de5390h3k2 ipa7e8o5rjgtl76 lb2359ve1@4ax.c om...[color=green]
                        > > Thanks for that info.
                        > >
                        > > Do you know if any of the other PDF writers support automation? If so[/color]
                        > which one? I gather[color=green]
                        > > some version of Adobe does, but am uncertain how this works or which[/color]
                        > version.[color=green]
                        > >
                        > > Any follow up info you could provide would be appreciated. If I have to[/color]
                        > buy a PDF writer I[color=green]
                        > > certainly want to support automation with it.
                        > >[/color]
                        >
                        >
                        > pdf995 stores output file name and folder info in an .ini file. All you[/color]
                        need[color=blue]
                        > to do is edit the .ini file in code. It's simple and very inexpensive..
                        >[/color]


                        pdf995 is the fast, affordable way to create professional-quality documents in the popular PDF file format. (Win 95, 98, 2000 and Me, NT 4.0 and XP).



                        Comment

                        • Steve Jorgensen

                          #13
                          Re: Programming to &quot;Print&quo t; using CUTE PDF!

                          On Fri, 30 Apr 2004 11:47:27 -0400, "John Winterbottom" <assaynet@hotma il.com>
                          wrote:
                          [color=blue]
                          >"John Winterbottom" <assaynet@hotma il.com> wrote in message
                          >news:c6ts95$g6 2ac$1@ID-185006.news.uni-berlin.de...[color=green]
                          >> "John Baker" <Baker.JH@Veriz on.net> wrote in message
                          >> news:de5390h3k2 ipa7e8o5rjgtl76 lb2359ve1@4ax.c om...[color=darkred]
                          >> > Thanks for that info.
                          >> >
                          >> > Do you know if any of the other PDF writers support automation? If so[/color]
                          >> which one? I gather[color=darkred]
                          >> > some version of Adobe does, but am uncertain how this works or which[/color]
                          >> version.[color=darkred]
                          >> >
                          >> > Any follow up info you could provide would be appreciated. If I have to[/color]
                          >> buy a PDF writer I[color=darkred]
                          >> > certainly want to support automation with it.
                          >> >[/color]
                          >>
                          >>
                          >> pdf995 stores output file name and folder info in an .ini file. All you[/color]
                          >need[color=green]
                          >> to do is edit the .ini file in code. It's simple and very inexpensive..
                          >>[/color]
                          >
                          >
                          >http://www.pdf995.com
                          >[/color]

                          One of my clients has used pdf995 from Access this way and had good things to
                          say about it.

                          Comment

                          • John Winterbottom

                            #14
                            Re: Programming to &quot;Print&quo t; using CUTE PDF!

                            "Steve Jorgensen" <nospam@nospam. nospam> wrote in message
                            news:t0u4901pje vr6s53hchdk4bob eug8lcvvc@4ax.c om...[color=blue]
                            > On Fri, 30 Apr 2004 11:47:27 -0400, "John Winterbottom"[/color]
                            <assaynet@hotma il.com>[color=blue]
                            > wrote:
                            >[color=green]
                            > >
                            > >
                            > >http://www.pdf995.com
                            > >[/color]
                            >
                            > One of my clients has used pdf995 from Access this way and had good things[/color]
                            to[color=blue]
                            > say about it.[/color]


                            I think it's a good solution. It's certainly the most cost-effective one
                            that I've found. Quality is acceptable. The only problem I've found is when
                            running under terminal services; there is only one .ini file - you can't
                            specify a different .ini file for each user, even if you have multiple
                            licenses. So you have to make sure only one person is generating pdf's at
                            any one time or else there can be a clash.


                            Comment

                            • Steve

                              #15
                              Re: Programming to &quot;Print&quo t; using CUTE PDF!

                              On Thu, 29 Apr 2004 23:52:21 GMT, John Baker <Baker.JH@Veriz on.net>
                              wrote:
                              [color=blue]
                              >Do you know if any of the other PDF writers support automation? If so which one? I gather
                              >some version of Adobe does, but am uncertain how this works or which version.[/color]

                              I use WIn2PDF and automate the generation of PDFs from both Access and
                              Excel, including assiging the file name, using Registry entries.
                              However, it does require Windows XP, NT, or 2000.

                              See


                              Win2PDF 11 is an easy to use Print To PDF solution that includes features to merge PDF files, email PDF files, and automatically name PDF files.



                              Steven Zuch
                              Cogent Management Inc.


                              Comment

                              Working...