Solved

Access 2013 - Not Printing Photos

Posted on 2014-04-09
36
649 Views
Last Modified: 2014-04-28
I have an access database that produces customized field checklist as pdf files.

When I embed floor plans as jpg Images (linked) they only print if they are less than 100kb

Is there some way to link images and print them when they are larger like the one attached?

Thanks
MBA-1ST-FLOOR-Working--02--04-10.jpg
0
Comment
Question by:rogerdjr
  • 12
  • 12
  • 8
  • +1
36 Comments
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39990488
Are you able to print the image by itself? and, if so, is it feasible to print 'multiple' reports, one after each other, the first being the normal one, and the rest just images?
0
 

Author Comment

by:rogerdjr
ID: 39990629
Yes the image prints fine by itself

its embedded as an image

I can print the jpg separately and can also insert it in the report PDF after printed but this is a lot of extra of extra formatting

Images appear within the text pages

Note - I don't actually make a paper copy - I generate a pdf and then wok on the combined pdf on a tablet.
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39990653
If you cant print the images as  separate reports (as 'addendums' to the document) it sounds like you have to reduce the size of the image - possibly a lower resolution?
0
 

Author Comment

by:rogerdjr
ID: 39992724
I was hoping that I could get a "magic cure" to print larger .jpg files in the body of the report.
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39993108
sorry - I got nudda - maybe try ms directly?
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40014440
Try this:
1. Install Bullzip
2. 'Print' your report to the Bullzip printer.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40015360
I gotta ask: How good are your VBA skills?
Because it can be done.
Our outfit record is 265 1600 x 1200 images imbedded into a report, but it did take me years to understand the underpinnings of how Access deals with pictures to be able to code a solution that will print an unlimited number of digital pictures of arbitrary original size.

What I have learned is that Access prints in 96 DPI.  To be able to print an unlimited number of pictures, I needed to be determine how large the image control is and use an external library to dynamically resize the pictures down to 96 DPI x the dimensions of the control, stuff the resized images into a temporary location, render the report and then clean up.

It involves FileSystemObject, WIA, a freeware program called PhotoResize, batch files and a good bit of VBA code. (I could have probably done away with PhotoResize and the batch files after I came to understand how WIA worked--but it works, so why break it?)

So, what are you up for?  :)
If all of that scares the hell out of you, you could do it manually.
The key thing is that Access prints at 96 DPI -- so there is absolutely no point in embedding an image with greater resolution than that.  The image you posted is 5330 x 6484.  Let's say that you wanted it in an image control that was 4.86" x 4" (preserving aspect ratio)   You'd resize your image down to 467 x 396 and embed that.  It will print.  Moreover, it will print with the same fidelity as the huge image, since Access is doing that resizing anyway.

In production, I cheat a bit on that.  The image control is 3.5556 x 2.6667 and I resize dynamically to 700 x 525, which is more like 200 DPI.  And I have successfully printed 265 images in a single report.  Because the resizing is time-intensive, I cheat on the front-side too.  As the image is being linked into the database, if it is larger than 1600 x 1200, I'll store the original, and resize it down to 1600 x 1200 and link to the smaller image.  When the report renders, I resize the already smaller image down to 700 x 525 on the fly and embed that--and it works.

Originally, depending on the oomph of the rendering machine and the size of the original images, I could get about 20 images on a report before running into grief.  By resizing, I don't know what the upper limit is yet--we haven't hit it :)

Nick67
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40015419
If you can render your png files into PDFs (not too difficult), you can use PDFTK (or some similar utility) to concatenate the Access produced pages of text with the image-laden PDFs.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40015658
Ok.
Here's a nice little sample.
Unzip it into c:\ so the path is c:\printit.
It takes your image.
Resizes it dynamically to three different sizes
2.43 x 2
4.86 x 4
7.84 x 10
Assigns the resized images to controls and it will print them.
Look in the VBA for a reference to Microsoft Windows Image Acquisition 2.0 which makes it all go around.

Nick67
PrintIt.zip
0
 

Author Comment

by:rogerdjr
ID: 40015703
Nick

I am game to move through the process I have a number of "complicated" exercises like this that I have pieced together and would like to try to solve this problem like you suggested.

Where do we start???

Attached are an image (.jpg) of a drawing and an oversized photo from my iPhone that are typical of the "raw files" I am starting with.
IMG-0930.JPG
02-MBA-1ST-FLOOR-Working--02--04.jpg
0
 

Author Comment

by:rogerdjr
ID: 40015708
Nick

Thanks for the sample - I'll take a look this evening.

A bit swamped today
0
 

Author Comment

by:rogerdjr
ID: 40015751
Nick

I had a chance to look at the code - very nice. This should work great for photos.

Is it possible to get access to print at 600 dpi instead of 96 dpi? For my checklists I would like to be able to zoom in on details and the lower resolution images lose the detail (like the door numbers on the drawing I posted).
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40015785
<<I would have first said>>
As far as I know, nope.
Through experimentation (bind a small image to a very large control in .SizeMode = clip, print and measure with a ruler) all versions of Access that I've works with (2003 - 2013) print the images at 96 DPI.  Binding images that are much larger that the control size * 96 DPI does not cause Access to change the DPI upward, it cause Access to internally resize the image downward.  I haven't been able to get print quality improvements by feeding in a larger sized image in experiments.  Large images just make the printing slow, hang-y, or crash-y.  Not better.

<<but>>

Although, having said that, I just did the experiment.  I changed
    IP.Filters(1).Properties("MaximumWidth") = Me.Controls("Image" & x).Width * 96 / 1440 '96 dpi * control width / twips per inch
    IP.Filters(1).Properties("MaximumHeight") = Me.Controls("Image" & x).Height * 96 / 1440 '96 dpi * control height /twips per inch

Open in new window

to
 IP.Filters(1).Properties("MaximumWidth") = Me.Controls("Image" & x).Width * 600 / 1440 '600 dpi * control width / twips per inch
    IP.Filters(1).Properties("MaximumHeight") = Me.Controls("Image" & x).Height * 600 / 1440 '600 dpi * control height /twips per inch

Open in new window


The image quality for that floor plan with the tiny text is much better in previewing and zooming, and reasonably better on paper, too.  Try it yourself.  Most of my stuff is photographs where no improvement is noticeable.
0
 

Author Comment

by:rogerdjr
ID: 40015836
tried it at 600 dpi - still to fuzzy
tried at 1200 dpi - larger file 3,588 kb has enough detail but doesn't print.

I think I need to find a way to get access to accept the larger file?
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40015905
try my suggestions
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40015946
You are discovering the upper limits.
I'm thinking that you should split your larger images into pieces
The farther you stray from 96 DPI the harder Access has to work to jam that image in there.
The more images you have the harder Access has to work at it too.

Most laser printers don't do much better than 600 dpi, either.
The OEM may claim that they do, but the eye test can't discern it.
Like I joke with my guys, 'I'm a miracle worker, not a god'

Here's the sample, with a textbox to let you select the DPI, defaulting to 96 DPI
I've split your image into two parts, and made the report show all the images.
Play with it
PrintIt.zip
0
 

Author Comment

by:rogerdjr
ID: 40015967
aikimark

Tried bullzip - did not print the high definition pdfs.

I don't understand your second solution - If you can render your png files into PDFs (not too difficult), you can use PDFTK (or some similar utility) to concatenate the Access produced pages of text with the image-laden PDFs. ?
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 45

Expert Comment

by:aikimark
ID: 40017120
The applicability of this solution path depends on the format of your report.  If your report text is all in one place on the report (beginning or end), then you stop trying to get Access to produce the images and just combine the images with the report text after your report text PDF has been created.
0
 

Author Comment

by:rogerdjr
ID: 40017466
It might help saw an "abbreviated version" of the final report. An actual report can be 700-1000 pages

Images (not the same ones) on nearly every page
Sample-CASp-Report-Overall-Rpt-2.pdf
0
 

Author Comment

by:rogerdjr
ID: 40017507
A sample check list where I zoom in to get small fine detail.

In this case I cut and pasted images into the pdf - this type checklist gets run every day with different checklists and different images depending on the planned inspections for the day

I use the PDF on a tablet to enter data

See dropbox link

https://www.dropbox.com/s/ghmwmv9qfcc9wrn/14003.000-01%20%28All%20in%20One%29%20StandardCheckList_FieldWkgListRpt%204-22-2014%20Working.pdf
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40017678
These large images do not appear in isolation on their respective pages.  There is a page number line an a page footer.  My idea would have been to split up the Access report into two reports -- the pages before and pages after these large images.  I don't think that idea will work with the non-image (mixed) content.

One other approach would be to have two versions of these large image files.  One is a low resolution image that Access can easily render in the report.  You post a high-res image in the cloud.  In your Access report, you add a link to the high-res file underneath each low-res image.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40017801
OK
http://msdn.microsoft.com/en-us/library/windows/desktop/ms630819(v=vs.85).aspx#itemCrop

I haven't used this before now, but it looks promising.
You can use WIA to crop a loaded image.
In principle then, you can use VBA to detect a feature (the size or something in the name) of the original, and dynamically break it into chunks to be displayed.  The chunks can overlap so you'll be able to see all the features of the original, and then they can be downsized to ~600 DPI so that they print without choking Access, but still zoom with good fidelity.

It'll take me a bit to rework the sample.
Play with it yourself and see what you think.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40017869
That's pretty slick, Nick.
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 500 total points
ID: 40018009
Ok,

Here's the altered sample, and it is pretty heavily altered from the other one.
We've got a new table, tblTempPics, that gets cleaned out and stores the paths to the split and shrunk components of the large image.  The report now draws on that table as the record source.  There's only one image control, and the Detail event points the control to the right chunk of the image.

450 DPI works and the images look good
Even 96 DPI is pretty good
PrintIt.zip
PrintIt.pdf
PrintIt450.pdf
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40018112
@Nick

Is that the version of the code that you used in your article?
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40018125
The article deals strictly with resizing, like we've done here
The cropping is not part of that shim.
You can see from the msdn link that there's a fair bit of stuff you can do with WIA.

In production, we use WIA to get images off of camera devices.  We save the originals in case the engineer wants to look REALLY close up, and resize on the fly to 1600 x 1200 and save those too.  When the reports print, the images are resized on the fly again down to 700 x 525 into a temporary location.

The WIA device dialog box has some unhappy limitations.  It doesn't remember it's previous size or location and it MUST by default have an item selected (nominally the first image)  This causes problems when the operator forgets to click on the first desired item, and THEN hold CTRL and click-select the rest of the items they'd like.

To get around that, I have the VBA shell out to a wscript routine to invoke the WIA device dialog box.  I can the get the VBA to use Windows API code to resize and position it, and (although this isn't as robust as I'd like) de-select the intial item
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40019144
If you can put together an entire WIA series of articles I suspect they will be well received.  If I were still a PE, I'd have suggested that during the editing process.
0
 

Author Closing Comment

by:rogerdjr
ID: 40027734
Nick

Thanks for the help - in the end I have a very useful tool for resizing photos. A big time saver

As for the very detailed drawings for the checklists I'm still in a manual cut & paste mode into acrobat.

Maybe someday Access will come up with a way to allow images that have more detail in their reports.

Thanks again for all your help.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40027830
You can manipulate Acrobat from VBA.  It is conceivable that you could use WIA to put a 96 DPI image of those detailed drawings into the report, render it to PDF, and then open the pdf with VBA and replace the 96 DPI images with the originals.

That's waaaaaaaaaaaaaaaaaay past my skillset, and the Acrobat documentation is very sketchy, too
0
 

Author Comment

by:rogerdjr
ID: 40028313
Interesting Issue arising - this process appears to rotate photos 90 degrees in some cases - is there a way to prevent this?
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40028413
WIA is more than capable of rotating images

IP.Filters.Add IP.FilterInfos("RotateFlip").FilterID
IP.Filters(1).Properties("RotationAngle") = 90


Or 180º or 270º

I don't know if you can do less than 90º increments.
Now, what may be causing the unwanted rotation is something I can only guess at.
IS it WIA trying to preserve aspect ratio, or Access in fitting the picture to the control?
Or something else?

So the money question is What is  "...in some cases" and can you detect it?
Are portrait images being flipped?
You can query height and width once they are loaded to test for it
Img.Width and Img.Height will give those dimensions in pixels.
They are read-only and we manipulate them through Filters with the code you and I developed.

Look in the temporary images that get created.
Are they all good?
Then it is something in Access's controls that's doing it.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40028447
Interesting bit of verbose code.
Throw it on a form and change Command4 to whatever button you use to fire it.
It'll list out EXACTLY what you can do with WIA.Filters
Private Sub Command4_Click()
Dim IP 'As ImageProcess
Dim i 'As Integer

Set IP = CreateObject("WIA.ImageProcess")

For i = 1 To IP.FilterInfos.Count
    IP.Filters.Add IP.FilterInfos(i).FilterID
    ListProperties IP.Filters(1)
    IP.Filters.Remove 1
Next
End Sub


Function StringValue(v)
    If TypeName(v) = "String" Then
        StringValue = """" & v & """"
    Else
        StringValue = v
    End If
End Function

Function ListValues(v)
    Dim i 'As Integer

    ListValues = ""
    For i = 1 To v.Count
        ListValues = ListValues & StringValue(v(i))
        If i <> v.Count Then
            ListValues = ListValues & ", "
        End If
    Next
End Function

Sub ListProperties(filter)
Dim p 'As Property
Dim s 'As String
Dim i 'As Integer

s = filter.Name & " (" & filter.FilterID & ")" & vbCrLf & _
    "==================================================" & vbCrLf & _
    filter.Description & vbCrLf & _
    "==================================================" & vbCrLf

For Each p In filter.Properties
    If Not IsObject(p.Value) Then
        s = s & "IP.Filters(1).Properties(""" & p.Name & """) = " & _
            StringValue(p.Value)

        Select Case p.SubType
        Case FlagSubType
            s = s & " '[valid values formed by using the OR operator with the following bit flags: " & _
                ListValues(p.SubTypeValues) & "]" & vbCrLf
        Case ListSubType
            s = s & " '[valid values from the following list: " & _
                ListValues(p.SubTypeValues) & "]" & vbCrLf
        Case RangeSubType
            s = s & " '[valid values in the range: Min = " & p.SubTypeMin & _
                ", Max = " & p.SubTypeMax & ", Step = " & p.SubTypeStep & "]" & _
                vbCrLf
        Case Else 'UnspecifiedSubType
            s = s & vbCrLf
        End Select
    Else
        s = s & "IP.Filters(1).Properties(""" & p.Name & """) = " & _
            TypeName(p.Value) & vbCrLf
    End If
Next

MsgBox s
End Sub

Open in new window

0
 
LVL 26

Expert Comment

by:Nick67
ID: 40028454
One of the things is see is that "Scale" has a PreserveAspectRatio Boolean that defaults to true.
0
 

Author Comment

by:rogerdjr
ID: 40028494
it appears that photos taken in landscape (width is greater than height) print fine and portrait (height is greater than width) rotate 90 degree to the left
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40028503
So you can check for that and compensate
Dim s As String
Dim BuiltPath As String
Dim TempPath As String
Dim x As Integer
Dim Img As WIA.ImageFile
Dim DesiredDPI As Integer

Dim IP As ImageProcess
Set IP = CreateObject("WIA.ImageProcess")

Dim fs As Object 'our friend the filesystemobject
Set fs = CreateObject("Scripting.FileSystemObject")

IP.Filters.Add IP.FilterInfos("Scale").FilterID
'IP.Filters(1).Properties("MaximumWidth") = 1600 'you can hand code an exact size
'IP.Filters(1).Properties("MaximumHeight") = 1200 'you can hand code an exact size
           
'variables for a recordset in tblTempPictures which stores the path to the new images
Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM [tbltempPics]", dbOpenDynaset, dbSeeChanges)


BuiltPath = PicPath 'rs!Path 'where the original is
TempPath = CurrentProject.Path & "\Resized\" ' a place to store dynamically generated images

DesiredDPI = Nz(Forms!frmOpenReports!txtDesiredDPI, 96) ' from the form

Set Img = CreateObject("WIA.ImageFile")
Img.LoadFile (BuiltPath) 'load the stored jpg in WIA
IP.Filters(1).Properties("MaximumWidth") = 6 * DesiredDPI '96 or whatever dpi * control width / twips per inch
IP.Filters(1).Properties("MaximumHeight") = 6 * DesiredDPI '96 or whatever dpi * control height /twips per inch

If Img.Height > Img.Width Then
    'we've already add scale as FilterId =1 so
    IP.Filters.Add IP.FilterInfos("RotateFlip").FilterID
    IP.Filters(2).Properties("RotationAngle") = 90
'roll it back to the right if it is Portrait
End If
Set Img = IP.Apply(Img)
s = Left(PicPath, Len(PicPath) - 4) & "-small.jpg"
Img.SaveFile (s)

With rs
    .AddNew
    !Path = s
    .Update
End With
Set Img = Nothing

Open in new window

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now