Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print photos for passport in Word using QM
#1
How can I

using image (file).
modify size image to 25x32 mm
arrange n images in page to print

using QM & Word or another way?
#2
I tried save macro in word to convert to QM

Selection.InlineShapes.AddPicture FileName:= _
"C:\test.jpg" _
, LinkToFile:=False, SaveWithDocument:=True

Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Solid
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalse
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 70.85
Selection.InlineShapes(1).Width = 50.15
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#

but I don't know how set Height in mm, position of image...
#3
with tables...

ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, NumColumns:= _
8, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
Selection.MoveRight Unit:=wdCell
Selection.Paste
End Sub
#4
IrfanView is an image editor that uses command line programming that is easily automated through QM "run" command.

http://www.irfanview.com/

First you'll need to consider what dpi you'll use to print and then calculate the dimensions of the picture accordingly.

To set the dpi of an image using IrfanView:
i_view32.exe c:\passport.jpg /dpi=(x,y)

Size the picture using IrfanView:
i_view32.exe c:\passport.jpg /resize=(x,y) /aspectratio

To merge files using IrfanView:
Syntax: /panorama=(X,file1,...,fileN) First parameter (X) is the direction: 1 = horizontal, 2 = vertical.
i_view32.exe /panorama=(1,c:\c:\passport.jpg,c:\passport.jpg,c:\passport.jpg,c:\passport.jpg)
i_view32.exe /panorama=(2,c:\c:\passport.jpg,c:\passport.jpg,c:\passport.jpg,c:\passport.jpg)

This will print to your default printer. There is a way to specify printer as well:
i_view32.exe c:\passport.jpg /print

To specify an output file:
/convert "passport2.jpg"
#5
I'm not sure if this is exactly right, but you would need to take this stuff into consideration to figure out how to size the image for print resolution:
Function Function108
Code:
Copy      Help
str image="c:\passport.jpg"
str image2="c:\passport2.jpg"
double xmm ymm inches dpi
int xpixels ypixels
xmm=25
ymm=32
dpi=300
inches=xmm/25.4
xpixels=(inches*dpi)+0.5
inches=ymm/25.4
ypixels=(inches*dpi)+0.5

str Command=
F
;{image} /resize=({xpixels},{ypixels})
;/aspectratio
;/dpi=({dpi},{dpi})
;/panorama=(1,{image},{image},{image},{image})
;/convert={image2}
Command.findreplace("[]")
run "$program files$\IrfanView\i_view32.exe" Command "" "" 0x400
Command=
F
;/panorama=(2,{image2},{image2},{image2},{image2})
;/print
Command.findreplace("[]")
run "$program files$\IrfanView\i_view32.exe" Command

Have to run IrfanView twice because won't allow /panorama to be used twice in on thread.
#6
Thank you very much, but I was looking for something like this:

Function Photo_passport
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "4 6"
str e4 e6
if(!ShowDialog("Photo_passport" &Photo_passport &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Photo_passport"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 22 18 26 14 "File"
;4 Edit 0x54030080 0x200 54 18 138 14 ""
;5 Static 0x54000000 0x0 72 50 40 12 "How many?"
;6 Edit 0x54030080 0x200 112 48 24 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030207 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,str- pho
,if(!OpenSaveDialog(0 pho "bmp, jpg, gif[]*.bmp;*.jpg;*.gif[]")) ret
,pho.setwintext(id(4 hDlg))
,case IDOK
,typelib Word {00020905-0000-0000-C000-000000000046} 8.1
,
,int cuantas=val(_s.getwintext(id(6 hDlg)))
,
,run "winword""" "" "" 0x200
,
,Word.Application app._getactive
,Word.Document doc=app.ActiveDocument
,Word.Table table

,app.Selection.InlineShapes.AddPicture(pho)
,doc.InlineShapes.Item(1).LockAspectRatio= -1 ;;msoTrue
,doc.InlineShapes.Item(1).Height=70.84
,doc.InlineShapes.Item(1).Width=50.14
,doc.InlineShapes.Item(1).Select
,app.Selection.Cut
,
,VARIANT worddefault(Word.wdWord9ListBehavior) wordauto(Word.wdAutoFitFixed) wordcell(Word.wdCell)
,doc.Tables.Add(app.Selection.Range 1 8 &worddefault &wordauto)
,app.Selection.Paste
,int i
,rep cuantas-1
,,app.Selection.MoveRight(&wordcell)
,,app.Selection.Paste
,case IDCANCEL
ret 1

sure can be improved ...


Forum Jump:


Users browsing this thread: 2 Guest(s)