[AccessD] Make pdf report

John Colby jwcolby at gmail.com
Mon Oct 10 17:18:41 CDT 2016


This is the header of what I use.

No idea whether it runs under Windows 10 etc.

If this is NOT what you use and would like the rest of it (the actual 
code) I can send it to you off line.


'DEVELOPED AND TESTED UNDER MICROSOFT ACCESS 2000 through A2003
' Can be converted to A97 but you must modify the RelationSip window Blob
' structures to the A97 specific versions. You can find these structure 
declarations
' in the RelationShip Views project on my site.
'
'Copyright: Stephen Lebans - Lebans Holdings 1999 Ltd.


'Distribution:

' Plain and simple you are free to use this source within your own
' applications, whether private or commercial, without cost or 
obligation, other that keeping
' the copyright notices intact. No public notice of copyright is required.
' You may not resell this source code by itself or as part of a collection.
' You may not post this code or any portion of this code in electronic 
format.
' The source may only be downloaded from:
' www.lebans.com
'
'Name:      ConvertReportToPDF
'
'Version:   7.85
'
'Purpose:
'
' 1) Export report to Snapshot and then to PDF. Output exact duplicate 
of a Report to PDF.
'
'­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
'
'Author:    Stephen Lebans
'
'Email:     Stephen at lebans.com
'
'Web Site:  www.lebans.com
'
'Date:      May 16, 2008, 11:11:11 PM
'
'Dependencies: DynaPDF.dll  StrStorage.dll  clsCommonDialog
'
'Inputs:    See inline Comments for explanation

'Output:    See inline Comments for explanation
'
'Credits:   Anyone who wants some!
'
'BUGS:      Please report any bugs to my email address.
'
'What's Missing:
'           Enhanced Error Handling
'
'How it Works:
' A SnapShot file is created in the normal manner by code like:
'       'Export the selected Report to SnapShot format
'       DoCmd.OutputTo acOutputReport, rptName, "SnapshotFormat(*.snp)", _
'       strPathandFileName
'
' rptName is the desired Report we are working with.
' strPathandFileName can be anything, in this Class it is a
' Temporary FileName and Path created with calls to the
' GetTempPath and GetUniqueFileName API's.
'
' We then pass the FileName to the SetupDecompressOrCopyFile API.
' This will decompress the original SnapShot file into a
' Temporary file with the same name but a "tmp" extension.
'
' The decompressed Temp SnapShot file is then passed to the
' ConvertUncompressedSnapshotToPDF function exposed by StrStorage.DLL.
' The declaration for this call is at the top of this module.
' The function uses the Structured Storage API's to
' open and read the uncompressed Snapshot file. Within this file,
' there is one Enhanced Metafile for each page of the original report.
' Additionally, there is a Header section that contains, among other things,
' a copy of the Report's Printer Devmode structure. We need this to
' determine the page size of the report.

'The StrStorage DLL exposes the function:
'Public Function ConvertUncompressedSnapshotToPDF( _
'UnCompressedSnapShotName As String, _
'OutputPDFname As String = "", _
'Optional CompressionLevel As Long = 0, _
'Optional PasswordOpenAs String = "" _
'Optional PasswordOwner As String = "" _
'Optional PasswordRestrictions as Long = 0, _
'Optional ByVal PDFNoFontEmbedding As Long = 0, _
'Optional ByVal PDFUnicodeFlags As Long = 0 _
') As Boolean

' Now we call the ConvertUncompressedSnapshotToPDF funtion exposed by 
the StrStorage DLL.
'
'blRet = ConvertUncompressedSnapshot(sFileName as String, sPDFFileName 
as String)
' Please note that sFileName must include a full valid path(folder) or 
it will default
' to your My Documents folder. For example "C:\MyPDFs\MonthlyReport.PDF"

' All other parameters are optional.
'
'Have Fun!
'
'

' Version 7.85
' Please note that the function signatures for both 
ConvertUncompressedSnapshotToPDF and ConvertReportToPDF
' have changed. An optional parameter has been added to expose the 
conversion of the
' Metafile to PDF. Flags now include broader support for Unicode and 
BiDi languages. Finer control
' over how the Metafile is interpreted is exposed as well.

' Added Security/Encryption
' Added/Exposed Flags for Unicode
' Fixed Bug in 11 x 17 paper size
' Fixed Landscape/Portrait bug
'

' Version 7.75
' Added Merge function to merge 2 PDF documents
'
' ******************************************************


On 10/10/2016 1:24 PM, Rocky Smolin wrote:
> Dear List:
>
>   
>
> I developed some code to create a report as a pdf and attach it to an email
> many years ago in A2003.  It doesn't work any more.
>
>   
>
> Is there a 'moderne' way to accomplish this? Sending the attachment by email
> is, I think the less important part of the task - getting the report output
> in pdf form is the sticker.
>
>   
>
> MTIA
>
>   
>
>   
>
> Rocky Smolin
>
> Beach Access Software
>
> 760-683-5777
>
>   <http://www.bchacc.com> www.bchacc.com
>
>   <http://www.e-z-mrp.com> www.e-z-mrp.com
>
> Skype: rocky.smolin
>
>   
>
>   
>

-- 
John W. Colby



More information about the AccessD mailing list