Automating SWF Printer Pro printer
This page provides information on automating SWF Printer
(Pro) in silent mode when SWF/PDF conversion parameters are
loaded from Windows Registry and output PDF or SWF filename
is predefined in Registry as well so program won't display
any dialogs or boxes and will just produce the output file.
IMPORTANT: Use of "Silent"
mode described below in the Registered Version of SWF Printer
or SWF Printer Pro requires a special License(Workstation,
Developer or Web License).
For more information and prices please see http://bytescout.com/purchase_swfprinterpro_developer.html
Q.: How to turn ON Silent mode to suppress save dialog
and SWF or PDF format options dialog?
A: To turn on silent mode just set HKCU\Bytescout\Software\SWF
Printer\Silent to 1. To turn off set it to 0 (zero)
Example (VBScript):
Const RegistryKey = HKCU\Software\Bytescout\SWF Printer\
Set WSHShell = CreateObject(WScript.Shell)
WSHShell.RegWrite RegistryKey & Silent, 1
Q.: How to set output PDF (or SWF) document filename?
A: Write output document filename
to HKCU\Bytescout\Software\SWF Printer\OutputFilename.
Program will automatically determine output format using output
filename extension (.swf extension tells program to produce
.swf presentation movie, .pdf tells program to produce pdf
document file)
Example 1 (VBScript):
Const RegistryKey = HKCU\Software\Bytescout\SWF
Printer\
Set WSHShell = CreateObject(WScript.Shell)
WSHShell.RegWrite RegistryKey & Silent,
1
' write output SWF filename
WSHShell.RegWrite RegistryKey & OutputFilename,
c:\OutputMovie.swf
Example 2(VBScript):
Const RegistryKey = HKCU\Software\Bytescout\SWF
Printer\
Set WSHShell = CreateObject(WScript.Shell)
WSHShell.RegWrite RegistryKey & Silent,
1
' write output SWF filename
WSHShell.RegWrite RegistryKey & OutputFilename,
c:\OutputDoc.pdf
Q.: How to set PDF document options through Windows
Registry?
A: PDF document format options are
stored in HKCU\Bytescout\Software\SWF Printer\PDFFormatOptions.
This options are used in silent mode.
PDF format options stored in HKCU\Bytescout\Software\SWF
Printer\PDFFormatOptions are listed below:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\ByteScout\SWF Printer\PDFFormatOptions]
AllowPrinting=dword:00000001
AllowModifyStructure=dword:00000001
AllowCopyInformation=dword:00000001
ModifyAnnotation=dword:00000001
AllowHiQualityPrinting=dword:00000001
AllowFillAnnotation=dword:00000001
AllowExtractInfo=dword:00000001
AllowAssemble=dword:00000001
ProtectionKeyLength=dword:00000000
CompressionType=dword:00000001
PDFVersion=dword:00000000
PageOrientation=dword:00000000
PageSize=dword:00000002
LeftMargin=dword:00000005
RightMargin=dword:00000005
TopMargin=dword:00000005
BottomMargin=dword:00000005
ProtectionEnabled=dword:00000000
UserPasswordEnabled=dword:00000000
MasterPasswordEnabled=dword:00000000
FontCharset=dword:00000001
DownloadImages=dword:00000001
AutoOpenPDF=dword:00000001
Creator=
Title=
Keywords=
Author=
Subject=
Description:
Creator - name of program creating the document
Title - title of the document
Keywords - keywords for document
Author - author of the document
Subject - subject of the document
ProtectionEnabled - 0 to disable protection,
1 to enable protection
UserPasswordEnabled - 0 to disable user password
and 1 to enable
SilentUserPassword - user password used in
silent mode document (UserPasswordEnabled should
be 1)
MasterPasswordEnabled - 0 to disable master
password and 1 to enable
SilentMasterPassword - master password used
in silent mode document (MasterPasswordEnabled should
be 1)
FontCharset - font charset used for outlines
and annotations (integer value starting from 0 or 1 (default
charset))
AllowPrinting (ProtectionEnabled
should be 1 to enable) -1 to allow printing and 0 to disallow
printing of PDF document
AllowModifyStructure (ProtectionEnabled
should be 1 to enable) -1 to allow document structure modifcation
and 0 to disallow
AllowCopyInformation (ProtectionEnabled
should be 1 to enable) -1 to allow copying of information
from document and 0 to disallow
ModifyAnnotation (ProtectionEnabled
should be 1 to enable) -1 to allow annotations modification
and 0 to disallow
AllowHiQualityPrinting (ProtectionEnabled
should be 1 to enable) -1 to allow printing in high quality
and 0 to disallow
AllowFillAnnotation (ProtectionEnabled
should be 1 to enable) -1 to allow annotation filling and
0 to disallow
AllowExtractInfo (ProtectionEnabled
should be 1 to enable) -1 to allow information extraction
and 0 to disallow
AllowAssemble (ProtectionEnabled
should be 1 to enable) -1 to allow document assembling and
0 to disallow
ProtectionKeyLength(ProtectionEnabled
should be 1 to enable) - 0 to use 40-bit protection key, 1
to use 128-bit key
CompressionType - 0 is no compression, 1
is flate compression type used for document
PDFVersion - 0 is 1.3 version of PDF format,
1 is 1.4 version of PDF format, 2 is 1.5 version of PDF format,
4 is 1.6 version of PDF format,
PageOrientation - 0 is Portrait orientation,
1 is Landscape orientation
PageSize - predefined page size in PDF document:
1 is Letter, 2 is A4, 3 is A3, 4 is Legal, 5 is B5, 6 is C5,
7 is 8x11, 8 is B4, 9 is A5, 10 is Folio, 11 is Executive,
12 is EnvB4, 13 is EnvB5, 14 is EnvC6, 15 is EnvDL, 16 is
EnvMonarch, 17 is Env9, 18 is Env10,19 is Env11
LeftMargin - left margin value
RightMargin - right margin value
TopMargin - top margin value
BottomMargin - bottom margin value
Q.: How to set SWF document options through Windows
Registry?
A: SWF document format options are
stored in HKCU\Bytescout\Software\SWF Printer\SWFFormatOptions.
This options are used in silent mode.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\ByteScout\SWF Printer\SWFFormatOptions]
SlideWidth=dword:00000280
SlideHeight=dword:000001e0
LeftMargin=dword:00000005
RightMargin=dword:00000005
TopMargin=dword:00000005
BottomMargin=dword:00000005
JPEGQuality=dword:0000004b
AddButtons=dword:00000001
SWFButtonFile=C:\\Program Files\\SWF Printer Pro\\swfbuttons\\Blue
Buttons.swf
SWFButtonIndex=dword:00000000
ButtonsAlign=dword:00000004
SlideShowMode=dword:00000002
AutomaticFixedTime=dword:0000001e
FullScreen=dword:00000000
UseVectorImages=dword:00000000
AllowScaling=dword:00000001
FitToScreen=dword:00000001
ContextualMenu=dword:00000001
KeyboardNavigation=dword:00000001
BackgroundColor=dword:00ffffff
SetBackgrColor=dword:00000000
AddPreloader=dword:00000001
PreloaderImageFile=
PreloaderText=Loading (%d% completed)...
ProgressBarStartColor=dword:00ffffff
ProgressBarEndColor=dword:00000000
AddSoundtrack=dword:00000000
AudioFile=
SoundTrackLoop=dword:00000000
SoundTrackLoopCount=dword:00000063
SoundTrackFadeOut=dword:00000000
EMF2SWF_HighestQuality=dword:00000001
Description:
SlideWidth - width of slides
SlideHeight - height of slides
LeftMargin - left margin value
RightMargin - right margin value
TopMargin - top margin value
BottomMargin - bottom margin value
JPEGQuality - JPEG compression quality used
for images to store inside flash movie (default value is 75)
AddButtons - 1 to add navigation buttons
to the produced flash movie, 0 - do not add
SWFButtonFile - absolute path to SWF file
with navigation buttons
SWFButtonIndex - index of SWF file with navigation
buttons to pick up from list of available buttons in SWF format
options dialog
ButtonsAlign - where to place navigation
buttons: 0 is TopLeft, 1 is TopCenter, 2 is TopRight, 3 is
RightCenter, 4 is BottomRight, 5 is BottomCenter,6 is BottomLeft,
7 is LeftCenter;
SlideShowMode - 0 is Normal mode, 1 is fixed
time mode (slides are changed after fixed time), 2 is Manual
mode
AutomaticFixedTime - time in seconds to show
slide (when SlideShowMode = 1)
FullScreen - 1 is full screen mode, 0 is
normal mode
UseVectorImages - 1 is to use vector mode
for producing flash movie from printed document, 0 is to use
raster images mode
EMF2SWF_HighestQuality - 1 to use high quality
mode for vector mode rendering
AllowScaling - 1 is to allow scaling , 0
is normal mode
FitToScreen - 1 is to fit slides to the screen,
0 is normal mode
ContextualMenu - 1 is to enable right-click
context popup menu, 0 is to disable
KeyboardNavigation - 1 is to allow keyboard
navigation (space to show next slide, backspace to show prev
slide)
BackgroundColor - background RGB color value
(converted to integer)
SetBackgrColor - 1 to set background color
using BackgroundColor value
AddPreloader - 1 is to add preloader, 0 to
skip preloader
PreloaderImageFile - absolute path to file
(JPG, BMP) with image for use in preloader
PreloaderText - text to show while preloading
move (default value is Loading (%d% completed)...
ProgressBarStartColor - RGB color value for
progress bar displayed while preloader is displayed
ProgressBarEndColor - second RGB color value
for progress bar displayed while preloader is displayed
AddSoundtrack - 1 is to add soundtrack to
the produced flash movie
AudioFile - absolute path to filename (mp3
or wav) with soundtrack for use in flash movie
SoundTrackLoop - 1 to loop soundtrack, 0
is to play soundtrack one time
SoundTrackLoopCount - number of loops soundtrack
is playing (if SoundTrackLoop is enabled)
SoundTrackFadeOut - 1 to fade out soundtrack,
0 to play as is
Q.: How to convert Word document into PDF document
using SWF Printer Pro
A: You should have Word 2003 or
higher installed.
Place test.doc to the c:\
and run the following script (save it as .VBS and double click
to run) to convert test.doc into test.pdf
in automated mode using SWF Printer Pro
Const WordFileName = "c:\test.doc"
Const OutputPDFFileName = "c:\test.pdf"
Const RegistryKey = "HKCU\Software\Bytescout\SWF Printer\"
' MS Word-related constants
Const WdDoNotSaveChanges = 0
'declare Word variables
Dim objWord, oDoc
' turn on "silent" mode and set output file
by setting HCKU\Software\Bytescout\SWF Printer\Silent to 1
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite RegistryKey & "Silent", 1
' write output PDF filename
' WSHShell.RegWrite RegistryKey & "OutputFilename",
OutputPDFFileName
'create an instance of Word
Set objWord = CreateObject("Word.Application")
If objWord Is Nothing Then
MsgBox "Couldn't start Word.", 48, "Application
Start Error"
Else
'open the file inside Word
objWord.Documents.Open WordFileName
'do all this in the background
objWord.Visible = False
'create a new document and save it as Filtered HTML
Set oDoc = objWord.ActiveDocument
' Remember current active printer
sPrevPrinter = objWord.ActivePrinter
objWord.ActivePrinter = "SWF Printer"
' print the document
objWord.ActiveDocument.PrintOut
Do While objWord.BackgroundPrintingStatus > 0
Loop
objWord.Quit wdDoNotSaveChanges
Set oDoc = Nothing
End If
Q.: How to convert Word document into SWF flash movie
using SWF Printer Pro
A: You should have Word 2003 or
higher installed.
Place test.doc to the c:\
and run the following script (save it as .VBS and double click
to run) to convert test.doc into test.swf
in automated mode using SWF Printer Pro
Const WordFileName = "c:\test.doc"
Const OutputSWFFileName = "c:\test.swf"
Const RegistryKey = "HKCU\Software\Bytescout\SWF Printer\"
' MS Word-related constants
Const WdDoNotSaveChanges = 0
'declare Word variables
Dim objWord, oDoc
' turn on "silent" mode and set output file
by setting HCKU\Software\Bytescout\SWF Printer\Silent to 1
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite RegistryKey & "Silent", 1
' write output PDF filename
' WSHShell.RegWrite RegistryKey & "OutputFilename",
OutputSWFFileName
'create an instance of Word
Set objWord = CreateObject("Word.Application")
If objWord Is Nothing Then
MsgBox "Couldn't start Word.", 48, "Application
Start Error"
Else
'open the file inside Word
objWord.Documents.Open WordFileName
'do all this in the background
objWord.Visible = False
'create a new document and save it as Filtered HTML
Set oDoc = objWord.ActiveDocument
' Remember current active printer
sPrevPrinter = objWord.ActivePrinter
objWord.ActivePrinter = "SWF Printer"
' print the document
objWord.ActiveDocument.PrintOut
Do While objWord.BackgroundPrintingStatus > 0
Loop
objWord.Quit wdDoNotSaveChanges
Set oDoc = Nothing
End If