In:
http://groups.google.com/group/comp....3dcf952fc3e3d3
I said:
'-----
In:
http://groups.google.com/group/comp..../msg/c368352c1...
I posted VBA code for obtaining the pixel information from a BMP image
for use in PDF documents created directly from Access. I discovered
that the carry locations for the pixel sizes are incorrect. When the H
or W of the image is 256 or more the technique shown for reading the
values from the BMP file directly will produce values that are too
small. I suspect that bytes 20 and 24 should be used instead of bytes
21 and 25 for this case but I have not tested it. As a temporary
workaround for larger images I am passing the height and width values
into the subroutine directly.
'-----
Testing this out with 255X255, 256X256 and 513X513 pixel bitmaps seems
to suggest:
lngPixelWidth = Asc(Mid(strL1, 20, 1)) * 256 + Asc(Mid(strL1, 19, 1))
lngPixelHeight = Asc(Mid(strL1, 24, 1)) * 256 + Asc(Mid(strL1, 23, 1))
instead of:
lngPixelWidth = Asc(Mid(strL1, 21, 1)) * 16 + Asc(Mid(strL1, 19, 1))
lngPixelHeight = Asc(Mid(strL1, 25, 1)) * 16 + Asc(Mid(strL1, 23, 1))
Getting the image attributes of .bmp files automatically for images
with a dimension larger than 255 pixels instead of passing the value in
will help me streamline the process of putting image streams into
Access generated PDF files.
BTW, here's a function I omitted in the original post:
'----
Public Function HexToDecimal(st rIn As String) As Long
Dim intTemp As String
Dim strTemp As String
'This function assumes input is a single character
strTemp = UCase(strIn)
Select Case strTemp
Case "0" To "9": intTemp = Asc(strIn) - 48
Case "A" To "F": intTemp = Asc(strIn) - 55
Case Else:
MsgBox ("Non-hexadecimal input to function HexToDecimal.")
intTemp = 0
End Select
HexToDecimal = CLng(intTemp)
End Function
'-----
I have not discovered any other errors in this code, but note that I
have not tried to find out what happens in the PDF file if I put a
space after the final pixel value in the output stream. I hope to be
able to show an example of using this technique, for both compressed
and uncompressed streams, to place an image in a PDF file. I am able
to do both now, but compression takes too many steps in its present
form and obtaining and using an uncompressed stream can cause the PDF
file to take a couple of seconds or more to appear. The compressed
image streams produce PDF files that are quite compact. In addition,
if an image will show up on every page, the existing compressed stream
stored once in the PDF file can be used repeatedly with only a small
amount of text used to translate, scale and display the image. For
example:
q
1 0 0 1 36 770 cm
125 0 0 -90.981 0 0 cm
/ImLogo Do
Q
The image object seems to be represented as an upside down 1 X 1 point
that is scaled to the required size, so images take slightly more
planning to get the origin correct in the PDF output file.
James A. Fortune
CD********@Fort uneJames.com